Skip to main content
Custom tools allow you to extend Composio with your own implementations while keeping a consistent interface with built-in tools. Custom tools can be standalone or integrate with existing toolkits for authentication.

Creating Custom Tools

createCustomTool()

Create a custom tool with your own execution logic.
CustomToolOptions
required

Examples

Execute Function Signature

The execute function receives three parameters:

Input Parameter

Parsed and validated input matching your Zod schema:

Connection Config

Auth credentials when toolkitSlug is provided:

Execute Tool Request

Make authenticated API calls to the toolkit:
ToolProxyParams
required

Return Value

The execute function must return a ToolExecuteResponse:

Using Custom Tools

Once created, custom tools work like any built-in tool:

Best Practices

  1. Clear Descriptions: Write clear tool descriptions for AI models
  2. Input Validation: Use Zod for robust input validation
  3. Error Handling: Return proper error messages in the response
  4. Type Safety: Use TypeScript for type-safe implementations
  5. Idempotency: Make tools idempotent when possible
  6. Rate Limiting: Handle rate limits in your implementation
  7. Logging: Log errors for debugging

Limitations

  • Custom tools are stored in-memory (not persisted)
  • Re-create custom tools on each SDK initialization
  • Cannot use executeToolRequest without toolkitSlug
  • Custom tools require manual version management

Next Steps

Tools API

Learn about built-in tools

Toolkits

Browse available toolkits

Connected Accounts

Set up authentication

Providers

Choose your AI framework