composio generate command automatically detects your project language (TypeScript or Python) and generates type-safe code for Composio toolkits, tools, and triggers.
Usage
Description
Thegenerate command:
-
Auto-detects your project language by scanning for:
- TypeScript:
package.json,tsconfig.json,package-lock.json,pnpm-lock.yaml,bun.lockb - Python:
pyproject.toml,requirements.txt,Pipfile,poetry.lock
- TypeScript:
-
Delegates to the appropriate generator:
- TypeScript →
composio ts generate - Python →
composio py generate
- TypeScript →
-
Generates type definitions for:
- Toolkits - Collections of related tools (e.g.,
github,gmail,slack) - Tools - Individual functions (e.g.,
GITHUB_CREATE_REPO,GMAIL_SEND_EMAIL) - Triggers - Event listeners for external services
- Toolkits - Collections of related tools (e.g.,
Options
Output directory for generated type stubs.
- TypeScript: Defaults to
node_modules/@composio/core/generated/ - Python: Defaults to current directory
TypeScript only. Generate typed input/output schemas for each tool.
Only generate types for specific toolkits. Can be specified multiple times.Example:
Examples
Basic Generation
Generate for Specific Toolkits
Custom Output Directory
./composio-types/ instead of the default location.
Generate with Full Type Definitions (TypeScript)
Language-Specific Behavior
TypeScript Projects
When detected, runs:Python Projects
When detected, runs:Auto-Detection Logic
The CLI scans your current directory for project files:| File | Detected Language |
|---|---|
package.json | TypeScript |
tsconfig.json | TypeScript |
package-lock.json | TypeScript |
pnpm-lock.yaml | TypeScript |
yarn.lock | TypeScript |
bun.lockb | TypeScript |
pyproject.toml | Python |
requirements.txt | Python |
Pipfile | Python |
poetry.lock | Python |
If both TypeScript and Python files are detected, TypeScript takes precedence.
Caching
The CLI caches API responses for faster subsequent runs: Cache location:~/.composio/
Cached files:
toolkits.json- Toolkit metadatatools.json- Tool definitionstools-as-enums.json- Tool name enumstrigger-types.json- Trigger type definitions
Toolkit Version Overrides
You can pin specific toolkit versions using environment variables:Toolkit version overrides only apply when using
--type-tools. Without it, versions are ignored.Performance
Generation speed depends on:- —toolkits filter: Faster (only fetches specified toolkits)
- —type-tools flag: Slower (fetches full tool schemas)
- Cache availability: Much faster (skips API calls)
| Scenario | Time |
|---|---|
| Full generation (no types) | ~5-10 seconds |
| Full generation (with types) | ~30-60 seconds |
| Filtered (3 toolkits, no types) | ~2-3 seconds |
| Cached (offline) | Less than 1 second |
Troubleshooting
Project Type Not Detected
If the CLI can’t detect your project type:Cannot Write to node_modules
If you get permission errors:Invalid Toolkits
If you specify invalid toolkit names:Related Commands
composio ts generate- TypeScript-specific generation (auto-detected)composio py generate- Python-specific generation (auto-detected)
Next Steps
Toolkit Versions
Pin toolkit versions
Environment Variables
Configure via environment