@devries-cameron20 / composio Mirror · read-only / commits / 80448048a
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 19:45 UTC

docs: remove legacy custom tools references and retarget redirects (#3510)

This PR is **part 3 of 3** splitting https://github.com/ComposioHQ/composio/pull/3505 to make the removal of the old 2025 custom tools easier to review. It carries the **docs** slice. - builds on top of https://github.com/ComposioHQ/composio/pull/3509 (stacked — this PR's base is `remove-ts-custom-tools`) - deletes the legacy `/docs/tools-direct/custom-tools` page and prunes its `meta.json` entry - retargets redirects for `/docs/tools-direct/custom-tools` and the `:path*` wildcard to `/docs/toolkits/custom-tools-and-toolkits`, with matching `redirects.test.ts` expectations - updates migration-guide, glossary, proxy-execute, and executing-tools prose; fixes the `ctx.proxyExecute` example to include the required GitHub toolkit - updates agent guidance (`AGENTS.md`, `building-agents` skills) to the experimental custom tools API ## Notes - This slice is a byte-identical subset of #3505 — the three split branches recombine to that PR's exact tree. Docs link/redirect checks could not run in the source checkout (missing docs deps); CI runs them per PR.

Alberto Schiabel committed Jun 5, 2026 at 10:54 UTC 80448048a80f7f2e28bbfca6a33bb9529ae95f85
11 files changed +97 -536
.agents/skills/building-agents/SKILL.md
+12 -6
@@ -384,14 +384,20 @@ const account = await composio.connectedAccounts.initiate({
384
385 ### 3. Custom Tools
386 ```typescript
387 -// Create custom tools
388 -const customTool = await composio.tools.createCustomTool({
387 +import { experimental_createTool } from '@composio/core';
388 +import { z } from 'zod';
389 +
390 +// Custom tools are session-scoped: define a local tool, then attach it
391 +// when creating a Tool Router session.
392 +const myTool = experimental_createTool('MY_TOOL', {
393 name: 'My Tool',
394 description: 'Tool description',
391 - execute: async (input) => {
392 - // Implementation
393 - return { data: 'result' };
394 - },
395 + inputParams: z.object({ param: z.string() }),
396 + execute: async input => ({ result: input.param }),
397 +});
398 +
399 +const session = await composio.create('user-id', {
400 + experimental: { customTools: [myTool] },
401 });
402 ```
403
.claude/skills/building-agents/SKILL.md
+12 -6
@@ -384,14 +384,20 @@ const account = await composio.connectedAccounts.initiate({
384
385 ### 3. Custom Tools
386 ```typescript
387 -// Create custom tools
388 -const customTool = await composio.tools.createCustomTool({
387 +import { experimental_createTool } from '@composio/core';
388 +import { z } from 'zod';
389 +
390 +// Custom tools are session-scoped: define a local tool, then attach it
391 +// when creating a Tool Router session.
392 +const myTool = experimental_createTool('MY_TOOL', {
393 name: 'My Tool',
394 description: 'Tool description',
391 - execute: async (input) => {
392 - // Implementation
393 - return { data: 'result' };
394 - },
395 + inputParams: z.object({ param: z.string() }),
396 + execute: async input => ({ result: input.param }),
397 +});
398 +
399 +const session = await composio.create('user-id', {
400 + experimental: { customTools: [myTool] },
401 });
402 ```
403
AGENTS.md
+13 -8
@@ -149,23 +149,28 @@ const wrappedTools = provider.wrapTools(tools);
149
150 ### Custom Tool Creation
151 ```typescript
152 +import { Composio, experimental_createTool } from '@composio/core';
153 import { z } from 'zod';
154
154 -const customTool = await composio.tools.createCustomTool({
155 +const composio = new Composio();
156 +
157 +// Custom tools are session-scoped: define a local tool, then attach it when
158 +// creating a Tool Router session. Use `extendsToolkit` + `ctx.proxyExecute`
159 +// to inherit a toolkit's managed auth and call its API.
160 +const myTool = experimental_createTool('MY_TOOL', {
161 name: 'My Tool',
162 description: 'Tool description',
157 - slug: 'MY_TOOL',
163 inputParams: z.object({
164 param: z.string().describe('Parameter description')
165 }),
161 - execute: async (input) => {
162 - return {
163 - data: { result: input.param },
164 - error: null,
165 - successful: true
166 - };
166 + execute: async input => {
167 + return { result: input.param };
168 }
169 });
170 +
171 +const session = await composio.create('user-id', {
172 + experimental: { customTools: [myTool] }
173 +});
174 ```
175
176 ## Python SDK Development
docs/content/docs/glossary.mdx
+1 -1
@@ -40,7 +40,7 @@ The object returned when you initiate authentication. Contains the Connect Link
40 </GlossaryTerm>
41
42 <GlossaryTerm name="Custom Tool">
43 -A user-defined tool used alongside Composio's built-in tools. For sessions, use local experimental custom tools and custom toolkits via [Custom tools and toolkits](/docs/toolkits/custom-tools-and-toolkits). For direct execution, see [Creating custom tools](/docs/tools-direct/custom-tools).
43 +A user-defined tool used alongside Composio's built-in tools. Use local experimental custom tools and custom toolkits via [Custom tools and toolkits](/docs/toolkits/custom-tools-and-toolkits).
44 </GlossaryTerm>
45
46 <GlossaryTerm name="In-Chat Authentication">
docs/content/docs/migration-guide/new-sdk.mdx
+40 -128
@@ -561,155 +561,67 @@ const result_2 = await composio.tools.execute(
561
562 ### Custom Tools
563
564 -The SDK continues to support custom tools. [Creating tools from your methods](/docs/tools-direct/custom-tools#creating-a-custom-tool) remains possible. We recommend reviewing the [detailed custom tools documentation](/docs/tools-direct/custom-tools#creating-a-custom-tool) for more information.
564 +Custom tools are now session-scoped. Define local tools with the experimental custom-tools API and attach them when creating or reusing a session.
565
566 -Due to changes in the SDK architecture, creating custom tools that use Composio's managed authentication has been modified. In the previous SDK, you could create a custom tool as follows:
567 -
568 -<Tabs groupId="language" items={['Python (previous)', 'TypeScript (previous)']} persist>
569 - <Tab value="Python (previous)">
570 -```python
571 -# Python Example using execute_request
572 -from composio import action, ComposioToolSet
573 -import typing as t
574 -
575 -toolset = ComposioToolSet()
576 -
577 -@action(toolname="github") # Associate with GitHub app for auth
578 -def get_github_repo_topics(
579 - owner: t.Annotated[str, "Repository owner username"],
580 - repo: t.Annotated[str, "Repository name"],
581 - execute_request: t.Callable # Injected by Composio
582 -) -> dict:
583 - """Gets the topics associated with a specific GitHub repository."""
584 - response_data = execute_request(
585 - endpoint=f"/repos/{owner}/{repo}/topics", # API path relative to base URL
586 - method="GET"
587 - )
588 - if isinstance(response_data, dict):
589 - return {"topics": response_data.get("names", [])}
590 -```
591 - </Tab>
592 - <Tab value="TypeScript (previous)">
593 -```typescript
594 -// @noErrors
595 -import { OpenAIToolSet, type ActionExecutionResDto } from "composio-core";
596 -import { z } from "zod";
597 -
598 -const toolset = new OpenAIToolSet();
599 -
600 -await toolset.createAction({
601 - actionName: "get_github_repo_topics",
602 - toolName: "github",
603 - description: "Gets the topics associated with a specific GitHub repository.",
604 - inputParams: z.object({
605 - owner: z.string().describe("Repository owner username"),
606 - repo: z.string().describe("Repository name"),
607 - }),
608 - callback: async (inputParams, _authCredentials, executeRequest): Promise<ActionExecutionResDto> => {
609 - const { owner, repo } = inputParams as { owner: string, repo: string };
610 - const response = await executeRequest({
611 - endpoint: `/repos/${owner}/${repo}/topics`,
612 - method: "GET",
613 - parameters: [],
614 - });
615 -
616 - const topics = (response as any)?.names ?? [];
617 - return { successful: true, data: { topics: topics } };
618 - }
619 -});
620 -```
621 - </Tab>
622 -</Tabs>
623 -
624 -The *execute tool request* method handles injection of the appropriate base URL and authentication credentials for the tool:
625 -
626 -<Tabs groupId="language" items={['Python (current)', 'TypeScript (current)']} persist>
627 - <Tab value="Python (current)">
566 +<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
567 + <Tab value="Python">
568 ```python
629 -from pydantic import BaseModel, Field
569 from composio import Composio
631 -from composio.core.models.custom_tools import ExecuteRequestFn
632 -
570 +from pydantic import BaseModel, Field
571
572 composio = Composio()
573
574 class GetIssueInfoInput(BaseModel):
637 - issue_number: int = Field(
638 - ...,
639 - description="The number of the issue to get information about",
640 - )
575 + issue_number: int = Field(..., description="The issue number")
576
642 -# function name will be used as slug
643 -@composio.tools.custom_tool(toolkit="github")
644 -def get_issue_info(
645 - request: GetIssueInfoInput,
646 - execute_request: ExecuteRequestFn,
647 - auth_credentials: dict,
648 -) -> dict:
577 +@composio.experimental.tool(extends_toolkit="github")
578 +def get_issue_info(input: GetIssueInfoInput, ctx) -> dict:
579 """Get information about a GitHub issue."""
650 - response = execute_request(
651 - endpoint=f"/repos/composiohq/composio/issues/{request.issue_number}",
580 + result = ctx.proxy_execute(
581 + toolkit="github",
582 + endpoint=f"/repos/composiohq/composio/issues/{input.issue_number}",
583 method="GET",
653 - parameters=[
654 - {
655 - "name": "Accept",
656 - "value": "application/vnd.github.v3+json",
657 - "type": "header",
658 - },
659 - {
660 - "name": "Authorization",
661 - "value": f"Bearer {auth_credentials['access_token']}",
662 - "type": "header",
663 - },
664 - ],
584 )
666 - return {"data": response.data}
585 + return {"data": result.data}
586 +
587 +session = composio.create(
588 + user_id="default",
589 + experimental={"custom_tools": [get_issue_info]},
590 +)
591 ```
592 </Tab>
669 - <Tab value="TypeScript (current)">
593 + <Tab value="TypeScript">
594 ```typescript
671 -// @noErrors
672 -import { Composio } from "@composio/core";
673 -import z from "zod";
595 +import { Composio, experimental_createTool } from "@composio/core";
596 +import { z } from "zod";
597
598 const composio = new Composio();
599
677 -const tool = await composio.tools.createCustomTool({
678 - slug: 'GITHUB_STAR_COMPOSIOHQ_REPOSITORY',
679 - name: 'Github star composio repositories',
680 - toolkitSlug: 'github',
681 - description: 'Star any specificied repo of `composiohq` user',
682 - inputParams: z.object({
683 - repository: z.string().describe('The repository to star'),
684 - page: z.number().optional().describe('Pagination page number'),
685 - customHeader: z.string().optional().describe('Custom header'),
686 - }),
687 - execute: async (input, connectionConfig, executeToolRequest) => {
688 - const result = await executeToolRequest({
689 - endpoint: `/user/starred/composiohq/${input.repository}`,
690 - method: 'PUT',
691 - body: {},
692 - parameters: [
693 - {
694 - name: 'page',
695 - value: input.page?.toString() || '1',
696 - in: 'query',
697 - },
698 - {
699 - name: 'x-custom-header',
700 - value: input.customHeader || 'default-value',
701 - in: 'header',
702 - },
703 - ],
704 - });
705 - return result;
706 - },
707 - });
600 +const getIssueInfo = experimental_createTool("GET_ISSUE_INFO", {
601 + name: "Get issue info",
602 + description: "Get information about a GitHub issue.",
603 + extendsToolkit: "github",
604 + inputParams: z.object({
605 + issueNumber: z.number().describe("The issue number"),
606 + }),
607 + execute: async (input, ctx) => {
608 + const result = await ctx.proxyExecute({
609 + toolkit: "github",
610 + endpoint: `/repos/composiohq/composio/issues/${input.issueNumber}`,
611 + method: "GET",
612 + });
613 + return { data: result.data };
614 + },
615 +});
616 +
617 +const session = await composio.create("default", {
618 + experimental: { customTools: [getIssueInfo] },
619 +});
620 ```
621 </Tab>
622 </Tabs>
623
712 -For more information, including executing custom tools and defining custom headers and query parameters, refer to the [Custom Tools](/docs/tools-direct/custom-tools) documentation.
624 +For more information, see [Custom Tools and Toolkits](/docs/toolkits/custom-tools-and-toolkits).
625
626 ### Auth configs (formerly integrations)
627
docs/content/docs/proxy-execute.mdx
+1 -1
@@ -321,7 +321,7 @@ curl --location 'https://backend.composio.dev/api/v3.1/tools/execute/proxy' \
321 ```
322
323 <Callout type="warn">
324 -`binary_body` posts the file as the request body with a single `Content-Type` header. It does **not** build a `multipart/form-data` payload, so APIs that require multipart uploads (for example, Twitter / X media upload, Slack `files.upload`, some Google upload endpoints) are not supported today. For those, wrap the call in a [custom tool](/docs/tools-direct/custom-tools) that constructs the multipart body yourself.
324 +`binary_body` posts the file as the request body with a single `Content-Type` header. It does **not** build a `multipart/form-data` payload, so APIs that require multipart uploads (for example, Twitter / X media upload, Slack `files.upload`, some Google upload endpoints) are not supported today. For those, wrap the call in a [session custom tool](/docs/toolkits/custom-tools-and-toolkits) that constructs the multipart body yourself.
325 </Callout>
326
327 See the [binary data changelog entry](/docs/changelog/2025/12/30) for the full upload and download flow.
docs/content/docs/tools-direct/custom-tools.mdx deleted
-380
@@ -1,380 +0,0 @@
1 ----
2 -title: Creating Custom Tools
3 -description: Learn how to extend Composio's toolkits with your own tools
4 -keywords: [create tool, custom action, extend, standalone tool]
5 -llmGuardrails: "direct-execution"
6 ----
7 -
8 -<Callout type="info">
9 -If you're building an agent, we recommend using [sessions](/docs/configuring-sessions) instead. See [Custom Tools and Toolkits (Experimental)](/docs/toolkits/custom-tools-and-toolkits) for defining local tools that run in-process alongside remote Composio tools within a session.
10 -</Callout>
11 -
12 -Custom tools allow you to create your own tools that can be used with Composio.
13 -
14 -1. **Standalone tools** - Simple tools that don't require any authentication
15 -2. **Toolkit-based tools** - Tools that require authentication and can use toolkit credentials
16 -
17 -## Creating a Custom Tool
18 -
19 -### Standalone Tool
20 -
21 -A standalone tool is the simplest form of custom tool. It only requires input parameters and an execute function:
22 -
23 -<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
24 - <Tab value="Python">
25 -```python
26 -from pydantic import BaseModel, Field
27 -
28 -from composio import Composio
29 -from composio.types import ExecuteRequestFn
30 -
31 -composio = Composio()
32 -
33 -
34 -class AddTwoNumbersInput(BaseModel):
35 - a: int = Field(
36 - ...,
37 - description="The first number to add",
38 - )
39 - b: int = Field(
40 - ...,
41 - description="The second number to add",
42 - )
43 -
44 -# function name will be used as slug
45 -@composio.tools.custom_tool
46 -def add_two_numbers(request: AddTwoNumbersInput) -> int:
47 - """Add two numbers."""
48 - return request.a + request.b
49 -```
50 - </Tab>
51 - <Tab value="TypeScript">
52 -```typescript
53 -import { Composio } from '@composio/core';
54 -import { z } from 'zod/v3';
55 -const composio = new Composio({ apiKey: 'your_api_key' });
56 -// ---cut---
57 -const tool = await composio.tools.createCustomTool({
58 - slug: 'CALCULATE_SQUARE',
59 - name: 'Calculate Square',
60 - description: 'Calculates the square of a number',
61 - inputParams: z.object({
62 - number: z.number().describe('The number to calculate the square of'),
63 - }),
64 - execute: async input => {
65 - const { number } = input;
66 - return {
67 - data: { result: number * number },
68 - error: null,
69 - successful: true,
70 - };
71 - },
72 -});
73 -```
74 - </Tab>
75 -</Tabs>
76 -
77 -### Toolkit-based Tool
78 -
79 -A toolkit-based tool has access to two ways of making authenticated requests:
80 -
81 -**1. Using `executeToolRequest`** - The recommended way to make authenticated requests to the toolkit's API endpoints. Composio automatically handles credential injection and baseURL resolution:
82 -
83 -<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
84 - <Tab value="Python">
85 -```python
86 -class GetIssueInfoInput(BaseModel):
87 - issue_number: int = Field(
88 - ...,
89 - description="The number of the issue to get information about",
90 - )
91 -
92 -# function name will be used as slug
93 -@composio.tools.custom_tool(toolkit="github")
94 -def get_issue_info(
95 - request: GetIssueInfoInput,
96 - execute_request: ExecuteRequestFn,
97 - auth_credentials: dict,
98 -) -> dict:
99 - """Get information about a GitHub issue."""
100 - response = execute_request(
101 - endpoint=f"/repos/composiohq/composio/issues/{request.issue_number}",
102 - method="GET",
103 - parameters=[
104 - {
105 - "name": "Accept",
106 - "value": "application/vnd.github.v3+json",
107 - "type": "header",
108 - },
109 - {
110 - "name": "Authorization",
111 - "value": f"Bearer {auth_credentials['access_token']}",
112 - "type": "header",
113 - },
114 - ],
115 - )
116 - return {"data": response.data}
117 -```
118 - </Tab>
119 - <Tab value="TypeScript">
120 -```typescript
121 -import { Composio } from '@composio/core';
122 -import { z } from 'zod/v3';
123 -const composio = new Composio({ apiKey: 'your_api_key' });
124 -// ---cut---
125 -const tool = await composio.tools.createCustomTool({
126 - slug: 'GITHUB_STAR_COMPOSIOHQ_REPOSITORY',
127 - name: 'Github star composio repositories',
128 - toolkitSlug: 'github',
129 - description: 'Star any specified repo of `composiohq` user',
130 - inputParams: z.object({
131 - repository: z.string().describe('The repository to star'),
132 - page: z.number().optional().describe('Pagination page number'),
133 - customHeader: z.string().optional().describe('Custom header'),
134 - }),
135 - execute: async (input, connectionConfig, executeToolRequest) => {
136 - // This method makes authenticated requests to the relevant API
137 - // You can use relative paths!
138 - // Composio will automatically inject the baseURL
139 - const result = await executeToolRequest({
140 - endpoint: `/user/starred/composiohq/${input.repository}`,
141 - method: 'PUT',
142 - body: {},
143 - // Add custom headers or query parameters
144 - parameters: [
145 - // Add query parameters
146 - {
147 - name: 'page',
148 - value: input.page?.toString() || '1',
149 - in: 'query',
150 - },
151 - // Add custom headers
152 - {
153 - name: 'x-custom-header',
154 - value: input.customHeader || 'default-value',
155 - in: 'header',
156 - },
157 - ],
158 - });
159 - return result;
160 - },
161 -});
162 -```
163 - </Tab>
164 -</Tabs>
165 -
166 -**2. Using `connectionConfig`** - For making direct API calls when needed:
167 -
168 -<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
169 - <Tab value="Python">
170 -```python
171 -import requests
172 -
173 -@composio.tools.custom_tool(toolkit="github")
174 -def get_issue_info_direct(
175 - request: GetIssueInfoInput,
176 - execute_request: ExecuteRequestFn,
177 - auth_credentials: dict,
178 -) -> dict:
179 - """Get information about a GitHub issue."""
180 - response = requests.get(
181 - f"https://api.github.com/repos/composiohq/composio/issues/{request.issue_number}",
182 - headers={
183 - "Accept": "application/vnd.github.v3+json",
184 - "Authorization": f"Bearer {auth_credentials['access_token']}",
185 - },
186 - )
187 - return {"data": response.json()}
188 -```
189 - </Tab>
190 - <Tab value="TypeScript">
191 -```typescript
192 -import { Composio } from '@composio/core';
193 -import { z } from 'zod/v3';
194 -const composio = new Composio({ apiKey: 'your_api_key' });
195 -// ---cut---
196 -const tool = await composio.tools.createCustomTool({
197 - slug: 'GITHUB_DIRECT_API',
198 - name: 'Direct GitHub API Call',
199 - description: 'Makes direct calls to GitHub API',
200 - toolkitSlug: 'github',
201 - inputParams: z.object({
202 - repo: z.string().describe('Repository name'),
203 - }),
204 - execute: async (input, connectionConfig, executeToolRequest) => {
205 - // Use connectionConfig for direct API calls
206 - if (!connectionConfig || connectionConfig.authScheme !== 'OAUTH2') {
207 - throw new Error('OAuth2 connection required');
208 - }
209 - const result = await fetch(`https://api.github.com/repos/${input.repo}`, {
210 - headers: {
211 - Authorization: `Bearer ${connectionConfig.val.access_token}`,
212 - },
213 - });
214 -
215 - return {
216 - data: await result.json(),
217 - error: null,
218 - successful: true,
219 - };
220 - },
221 -});
222 -```
223 - </Tab>
224 -</Tabs>
225 -
226 -### Using Custom Headers and Query Parameters
227 -
228 -You can add custom headers and query parameters to your toolkit-based tools using the `parameters` option in `executeToolRequest`:
229 -
230 -<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
231 - <Tab value="Python">
232 -```python
233 -@composio.tools.custom_tool(toolkit="github")
234 -def get_issue_info(
235 - request: GetIssueInfoInput,
236 - execute_request: ExecuteRequestFn,
237 - auth_credentials: dict,
238 -) -> dict:
239 - """Get information about a GitHub issue."""
240 - response = execute_request(
241 - endpoint=f"/repos/composiohq/composio/issues/{request.issue_number}",
242 - method="GET",
243 - parameters=[
244 - {
245 - "name": "Accept",
246 - "value": "application/vnd.github.v3+json",
247 - "type": "header",
248 - },
249 - {
250 - "name": "Authorization",
251 - "value": f"Bearer {auth_credentials['access_token']}",
252 - "type": "header",
253 - },
254 - {
255 - "name": 'X-Custom-Header',
256 - "value": 'custom-value',
257 - "type": 'header',
258 - },
259 - ],
260 - )
261 - return {"data": response.data}
262 -```
263 - </Tab>
264 - <Tab value="TypeScript">
265 -```typescript
266 -import { Composio } from '@composio/core';
267 -import { z } from 'zod/v3';
268 -const composio = new Composio({ apiKey: 'your_api_key' });
269 -// ---cut---
270 -const tool = await composio.tools.createCustomTool({
271 - slug: 'GITHUB_SEARCH_REPOSITORIES',
272 - name: 'Search GitHub Repositories',
273 - description: 'Search for repositories with custom parameters',
274 - toolkitSlug: 'github',
275 - inputParams: z.object({
276 - query: z.string().describe('Search query'),
277 - perPage: z.number().optional().describe('Results per page'),
278 - acceptType: z.string().optional().describe('Custom accept header'),
279 - }),
280 - execute: async (input, connectionConfig, executeToolRequest) => {
281 - const result = await executeToolRequest({
282 - endpoint: '/search/repositories',
283 - method: 'GET',
284 - parameters: [
285 - // Add query parameters for pagination
286 - {
287 - name: 'q',
288 - value: input.query,
289 - in: 'query',
290 - },
291 - {
292 - name: 'per_page',
293 - value: (input.perPage || 30).toString(),
294 - in: 'query',
295 - },
296 - // Add custom headers
297 - {
298 - name: 'Accept',
299 - value: input.acceptType || 'application/vnd.github.v3+json',
300 - in: 'header',
301 - },
302 - {
303 - name: 'X-Custom-Header',
304 - value: 'custom-value',
305 - in: 'header',
306 - },
307 - ],
308 - });
309 - return result;
310 - },
311 -});
312 -```
313 - </Tab>
314 -</Tabs>
315 -
316 -## Executing Custom Tools
317 -
318 -You can execute custom tools just like any other tool:
319 -
320 -<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
321 - <Tab value="Python">
322 -```python
323 -response = composio.tools.execute(
324 - user_id="default",
325 - slug="TOOL_SLUG", # For the tool above you can use `get_issue_info.slug`
326 - arguments={"issue_number": 1},
327 -)
328 -```
329 - </Tab>
330 - <Tab value="TypeScript">
331 -```typescript
332 -import { Composio } from '@composio/core';
333 -const composio = new Composio({ apiKey: 'your_api_key' });
334 -// ---cut---
335 -const result = await composio.tools.execute('TOOL_SLUG', {
336 - arguments: {
337 - // Tool input parameters
338 - },
339 - userId: 'user-id',
340 - connectedAccountId: 'optional-account-id', // Required for toolkit-based tools
341 -});
342 -```
343 - </Tab>
344 -</Tabs>
345 -
346 -## Best Practices
347 -
348 -1. Use descriptive names and slugs for your tools
349 -2. Always provide descriptions for input parameters using `describe()`
350 -3. Handle errors gracefully in your execute function
351 -4. For toolkit-based tools:
352 - - Prefer `executeToolRequest` over direct API calls when possible
353 - - Use relative paths with `executeToolRequest` - Composio will automatically inject the correct baseURL
354 - - Use the `parameters` option to add custom headers or query parameters:
355 - ```typescript
356 - parameters: [
357 - { name: 'page', value: '1', in: 'query' }, // Adds ?page=1 to URL
358 - { name: 'x-custom', value: 'value', in: 'header' }, // Adds header
359 - ];
360 - ```
361 - - Remember that `executeToolRequest` can only call tools from the same toolkit
362 - - Use `executeToolRequest` to leverage Composio's automatic credential handling
363 - - Only use `connectionConfig` when you need to make direct API calls or interact with different services
364 -5. Chain multiple toolkit operations using `executeToolRequest` for better maintainability
365 -
366 -## Limitations
367 -
368 -1. Custom tools are stored in memory and are not persisted
369 -2. They need to be recreated when the application restarts
370 -3. Toolkit-based tools require a valid connected account with the specified toolkit
371 -4. `executeToolRequest` can only execute tools from the same toolkit that the custom tool belongs to
372 -5. Each toolkit-based tool can only use one connected account at a time
373 -
374 -## What to read next
375 -
376 -<Cards>
377 - <Card icon={<Play />} title="Executing tools" href="/docs/tools-direct/executing-tools" description="Run tools with providers, agentic frameworks, or direct execution" />
378 - <Card icon={<Wrench />} title="Fetching tools" href="/docs/tools-direct/fetching-tools" description="Fetch and filter tools, inspect schemas, and search semantically" />
379 - <Card icon={<Key />} title="Authenticating tools" href="/docs/tools-direct/authenticating-tools" description="Create auth configs and connect user accounts" />
380 -</Cards>
docs/content/docs/tools-direct/executing-tools.mdx
+2 -2
@@ -307,7 +307,7 @@ console.log(data);
307 </Tabs>
308
309 <Callout type="info">
310 -Need an API that isn't supported by any Composio toolkit, or want to extend an existing one? Learn how to [create custom tools](/docs/tools-direct/custom-tools).
310 +Need an API that isn't supported by any Composio toolkit, or want to extend an existing one? Learn how to [create session custom tools](/docs/toolkits/custom-tools-and-toolkits).
311 </Callout>
312
313 ## Automatic File Handling
@@ -599,5 +599,5 @@ await composio.tools.execute('GOOGLEDRIVE_UPLOAD_FILE', {
599 <Cards>
600 <Card icon={<Wrench />} title="Fetching tools" href="/docs/tools-direct/fetching-tools" description="Fetch and filter tools, inspect schemas, and search semantically" />
601 <Card icon={<Key />} title="Authenticating tools" href="/docs/tools-direct/authenticating-tools" description="Create auth configs and connect user accounts" />
602 - <Card icon={<Wrench />} title="Custom tools" href="/docs/tools-direct/custom-tools" description="Create your own standalone or toolkit-based tools" />
602 + <Card icon={<Wrench />} title="Custom tools" href="/docs/toolkits/custom-tools-and-toolkits" description="Create local tools that run inside sessions" />
603 </Cards>
docs/content/docs/tools-direct/meta.json
-1
@@ -6,7 +6,6 @@
6 "authenticating-tools",
7 "executing-tools",
8 "modify-tool-behavior",
9 - "custom-tools",
9 "toolkit-versioning"
10 ]
11 }
docs/next.config.mjs
+12 -2
@@ -354,7 +354,17 @@ const config = {
354 },
355 {
356 source: '/docs/custom-tools',
357 - destination: '/docs/tools-direct/custom-tools',
357 + destination: '/docs/toolkits/custom-tools-and-toolkits',
358 + permanent: true,
359 + },
360 + {
361 + source: '/docs/tools-direct/custom-tools',
362 + destination: '/docs/toolkits/custom-tools-and-toolkits',
363 + permanent: true,
364 + },
365 + {
366 + source: '/docs/tools-direct/custom-tools/:path*',
367 + destination: '/docs/toolkits/custom-tools-and-toolkits',
368 permanent: true,
369 },
370 {
@@ -428,7 +438,7 @@ const config = {
438 },
439 {
440 source: '/custom-tools/:path*',
431 - destination: '/docs/tools-direct/custom-tools',
441 + destination: '/docs/toolkits/custom-tools-and-toolkits',
442 permanent: true,
443 },
444 // Error handling redirect (old fern URL)
docs/tests/integration/redirects.test.ts
+4 -1
@@ -23,7 +23,10 @@ const REDIRECTS = [
23 { from: "/docs/providers/langgraph", to: "/docs/providers/langchain" },
24 { from: "/tools", to: "/toolkits" },
25 { from: "/docs/fetching-tools", to: "/docs/tools-direct/fetching-tools" },
26 - { from: "/docs/custom-tools", to: "/docs/tools-direct/custom-tools" },
26 + { from: "/docs/custom-tools", to: "/docs/toolkits/custom-tools-and-toolkits" },
27 + { from: "/docs/tools-direct/custom-tools", to: "/docs/toolkits/custom-tools-and-toolkits" },
28 + { from: "/docs/tools-direct/custom-tools/github", to: "/docs/toolkits/custom-tools-and-toolkits" },
29 + { from: "/custom-tools/github", to: "/docs/toolkits/custom-tools-and-toolkits" },
30 { from: "/docs/how-tools-work", to: "/docs/tools-and-toolkits" },
31 { from: "/authentication", to: "/docs/authentication" },
32 { from: "/changelog", to: "/docs/changelog" },