Skip to main content

Overview

Custom tools allow you to extend Composio’s functionality with your own implementations while keeping a consistent interface with built-in tools. You can create tools with custom logic, integrate with any API, and optionally leverage connected accounts for authentication.

Creating a Custom Tool

Custom Tools with Authentication

Custom tools can leverage connected accounts from existing toolkits for authentication:

Execute with Connected Account

Making Authenticated API Calls

The executeToolRequest function allows you to make authenticated requests using the connected account:
The executeToolRequest function is only available for custom tools that specify a toolkitSlug. It will throw an error for standalone custom tools without a toolkit.

Standalone Custom Tools

Create tools without requiring authentication:

Complex Input Parameters

Define complex nested schemas:

Managing Custom Tools

Retrieving Custom Tools

Using Custom Tools with AI Providers

Custom tools work seamlessly with AI provider integrations:

Error Handling in Custom Tools

Implement robust error handling:

Best Practices

Use Descriptive Slugs

Choose clear, uppercase slugs with underscores (e.g., MY_CUSTOM_TOOL) for consistency.

Document Parameters

Use Zod’s .describe() method to add clear descriptions to all input parameters.

Handle Errors Gracefully

Always return structured error objects with meaningful messages and error codes.

Leverage Connected Accounts

Use toolkitSlug and executeToolRequest for authenticated API calls when possible.

Common Patterns

Database Integration

Webhook Integration

File Processing

Limitations

  • Custom tools are stored in-memory and not persisted across SDK instances
  • The executeToolRequest function only works with custom tools that have a toolkitSlug
  • Custom tools cannot use Composio’s automatic file upload/download features
  • Tool schemas are validated at creation time, not at runtime

Next Steps

Tool Execution

Learn how to execute custom and built-in tools

Modifiers

Apply modifiers to customize tool behavior

Authentication Flows

Set up connected accounts for authenticated custom tools

Error Handling

Handle errors in custom tool execution