Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ComposioHQ/composio/llms.txt

Use this file to discover all available pages before exploring further.

The Tools class manages tool retrieval and execution. Use composio.tools.get() to retrieve tools formatted for your AI provider, and composio.tools.execute() to run any tool directly. All tools — both built-in Composio tools and custom tools registered via createCustomTool() — are accessible through this interface.

tools.get()

Retrieve tools formatted for your AI provider. The returned collection depends on the active provider — for OpenAIProvider this is an array of OpenAI function-calling tool definitions.
composio.tools.get(
  userId: string,
  filters: ToolListParams,
  options?: ProviderOptions
): Promise<TToolCollection>
You can also retrieve a single tool by slug:
composio.tools.get(
  userId: string,
  slug: string,
  options?: ProviderOptions
): Promise<TToolCollection>
userId
string
required
External user identifier whose connected accounts are used to scope tool execution.
filters
ToolListParams
Filters that control which tools are returned. Provide one of toolkits, tools, search, or authConfigIds.
options
ProviderOptions
Provider-level options applied during tool retrieval.

tools.execute()

Execute any tool directly by slug. This bypasses the provider and returns a raw ToolExecuteResponse. By default, manual execution requires a pinned toolkit version — pass dangerouslySkipVersionCheck: true or configure toolkitVersions at SDK initialization to avoid the version check.
composio.tools.execute(
  slug: string,
  body: ToolExecuteParams,
  modifiers?: ExecuteToolModifiers
): Promise<ToolExecuteResponse>
slug
string
required
Tool identifier (e.g. 'GITHUB_CREATE_ISSUE').
body
ToolExecuteParams
required
Execution parameters.
modifiers
ExecuteToolModifiers
Lifecycle hooks for the execution.

ToolExecuteResponse

data
Record<string, unknown>
The tool’s output data.
error
string | null
Error message if the tool failed, otherwise null.
successful
boolean
true when the tool executed without errors.
logId
string | undefined
Composio log identifier for this execution, useful for debugging.
sessionInfo
unknown | undefined
Optional session metadata returned by the backend for tool router session executions.

tools.getRawComposioTools()

Fetch tools in the internal SDK format without provider wrapping. Useful when you need to inspect tool schemas directly or build custom provider integrations.
composio.tools.getRawComposioTools(
  query: ToolListParams,
  options?: { modifySchema?: TransformToolSchemaModifier }
): Promise<Tool[]>

tools.getRawComposioToolBySlug()

Fetch a single tool by slug in the internal SDK format.
composio.tools.getRawComposioToolBySlug(
  slug: string,
  options?: { modifySchema?: TransformToolSchemaModifier; version?: string }
): Promise<Tool>

tools.proxyExecute()

Proxy a custom HTTP request through a toolkit’s connected account authentication layer, without calling a specific tool.
composio.tools.proxyExecute(body: ToolProxyParams): Promise<ToolProxyResponse>
body.endpoint
string
required
The API endpoint URL to call.
body.method
string
required
HTTP method ('GET', 'POST', 'PUT', 'DELETE', 'PATCH').
body.connectedAccountId
string
required
Connected account whose credentials are injected.
body.body
unknown
Request body for POST/PUT/PATCH requests.
body.parameters
array
Additional query or header parameters to inject.

Modifiers

Modifiers are hooks that transform tool inputs and outputs globally for all provider-dispatched calls.
ModifierWhen it runsUse case
beforeExecuteBefore tool executionInject extra arguments, log requests, enforce policies
afterExecuteAfter tool executionSanitize responses, log results, transform output
modifySchemaDuring tool retrievalAdd/remove schema fields, override descriptions

Examples

import { Composio } from '@composio/core';
import OpenAI from 'openai';

const composio = new Composio({ apiKey: process.env.COMPOSIO_API_KEY });
const openai = new OpenAI();

// Get GitHub tools for a user — provider formats them as OpenAI function definitions
const tools = await composio.tools.get('user_123', {
  toolkits: ['github'],
  limit: 10,
});

const response = await openai.chat.completions.create({
  model: 'gpt-4o',
  messages: [{ role: 'user', content: 'List my GitHub repositories.' }],
  tools,
});

Build docs developers (and LLMs) love