Skip to main content
The composio generate command automatically detects your project language (TypeScript or Python) and generates type-safe code for Composio toolkits, tools, and triggers.

Usage

Description

The generate command:
  1. 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
  2. Delegates to the appropriate generator:
    • TypeScript → composio ts generate
    • Python → composio py generate
  3. 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

Options

string
Output directory for generated type stubs.
  • TypeScript: Defaults to node_modules/@composio/core/generated/
  • Python: Defaults to current directory
boolean
default:"false"
TypeScript only. Generate typed input/output schemas for each tool.
Enables full type definitions but is slower. Fetches complete tool schemas from the API.
string[]
Only generate types for specific toolkits. Can be specified multiple times.Example:

Examples

Basic Generation

Output:

Generate for Specific Toolkits

Fetches and generates types for only the specified toolkits (faster than full generation).

Custom Output Directory

Writes generated files to ./composio-types/ instead of the default location.

Generate with Full Type Definitions (TypeScript)

Generates complete input/output schemas for each tool (slower but provides full type safety).

Language-Specific Behavior

TypeScript Projects

When detected, runs:
Generated files:
Usage:

Python Projects

When detected, runs:
Generated files:
Usage:

Auto-Detection Logic

The CLI scans your current directory for project files:
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 metadata
  • tools.json - Tool definitions
  • tools-as-enums.json - Tool name enums
  • trigger-types.json - Trigger type definitions
Force cache usage:
Uses cached data if available (works offline).

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.
See Toolkit Versions for more details.

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)
Typical timing:

Troubleshooting

Project Type Not Detected

If the CLI can’t detect your project type:
Solution: Use language-specific commands:

Cannot Write to node_modules

If you get permission errors:
Solution: Specify a custom output directory:

Invalid Toolkits

If you specify invalid toolkit names:
Solution: Check available toolkits:
  • 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