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 22, 03:15 UTC
docs: clean up custom tools docs, remove internal LOCAL_ prefix references
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Dhawal Upadhyay committed
Mar 17, 2026 at 11:37 UTC
03cce344cb30da3ae06f200847634d8df5872d85
1 file changed
+20
-20
ts/docs/api/tool-router.md
+20
-20
@@ -267,11 +267,11 @@ The `userTimezone` field accepts an IANA timezone identifier (e.g., 'America/New
267
268
#### Custom Tools & Custom Toolkits
269
270
-Add user-defined tools that execute locally (in-process) alongside Composio's remote tools. Custom tools are indexed by the backend for search and returned to the LLM with the correct `LOCAL_` prefixed slug.
270
+Define your own tools that run in-process alongside Composio's remote tools. Custom tools are automatically indexed for search and routed to your `execute` function when called.
271
272
There are three ways to define custom tools:
273
274
-**1. Standalone tool** — no auth, passed in `customTools`:
274
+**1. Standalone tool** — no auth needed, passed in `customTools`:
275
276
```typescript
277
import { experimental_createTool } from '@composio/core';
@@ -285,9 +285,7 @@ const grep = experimental_createTool('GREP', {
285
});
286
```
287
288
-Slug format: `LOCAL_GREP`
289
-
290
-**2. Extension tool** — extends a Composio toolkit (inherits auth), passed in `customTools`:
288
+**2. Extension tool** — extends a Composio toolkit, inherits its auth. Passed in `customTools` with `extendsToolkit`:
289
290
```typescript
291
const getImportant = experimental_createTool('GET_IMPORTANT_EMAILS', {
@@ -302,9 +300,7 @@ const getImportant = experimental_createTool('GET_IMPORTANT_EMAILS', {
300
});
301
```
302
305
-Slug format: `LOCAL_GMAIL_GET_IMPORTANT_EMAILS`
306
-
307
-**3. Custom toolkit** — groups no-auth tools, passed in `customToolkits`:
303
+**3. Custom toolkit** — groups related no-auth tools. Passed in `customToolkits`:
304
305
```typescript
306
import { experimental_createToolkit } from '@composio/core';
@@ -323,9 +319,7 @@ const devTools = experimental_createToolkit('DEV_TOOLS', {
319
});
320
```
321
326
-Slug format: `LOCAL_DEV_TOOLS_SED`
327
-
328
-**Using in a session:**
322
+**Creating a session with custom tools:**
323
324
```typescript
325
const session = await composio.create('user_123', {
@@ -335,15 +329,22 @@ const session = await composio.create('user_123', {
329
customToolkits: [devTools],
330
},
331
});
332
+```
333
+
334
+**Executing custom tools** — use the same slug you defined:
335
+
336
+```typescript
337
+// Standalone tool
338
+await session.execute('GREP', { pattern: 'TODO', path: '/src' });
339
339
-// Execute locally via session.execute()
340
-const result = await session.execute('GREP', { pattern: 'TODO', path: '/src' });
340
+// Extension tool
341
+await session.execute('GET_IMPORTANT_EMAILS', { limit: 5 });
342
342
-// Also works with prefixed slug
343
-const result2 = await session.execute('LOCAL_DEV_TOOLS_SED', { pattern: 'foo', replacement: 'bar' });
343
+// Toolkit tool
344
+await session.execute('SED', { pattern: 'foo', replacement: 'bar' });
345
```
346
346
-Custom tools are searched alongside Composio tools. When an LLM calls a custom tool via `COMPOSIO_MULTI_EXECUTE_TOOL`, the SDK intercepts it and executes locally — remote tools in the same batch are sent to the backend in parallel.
347
+Custom tools are searched alongside Composio tools. When the LLM calls a custom tool, the SDK executes it in-process — remote tools in the same batch are sent to the backend in parallel.
348
349
## Session Properties
350
@@ -431,16 +432,15 @@ This method is useful when you need direct access to the underlying meta tools w
432
433
### `execute()`
434
434
-Execute a tool within the session. Custom tools run locally in-process; remote tools are sent to the Composio backend. Accepts both the original slug and the `LOCAL_`-prefixed slug for custom tools.
435
+Execute a tool within the session. Custom tools run in-process; remote tools are sent to the Composio backend. Works with any tool — custom or remote — using the same API.
436
437
```typescript
437
-// Execute a custom tool
438
+// Custom tool
439
const result = await session.execute('GET_USER_CONTEXT', { category: 'prefs' });
440
console.log(result.data); // { preferences: { ... } }
441
console.log(result.error); // null on success
441
-console.log(result.logId); // 'local' for custom tools, backend log ID for remote tools
442
443
-// Execute a remote Composio tool
443
+// Remote Composio tool — same API
444
const weather = await session.execute('WEATHERMAP_WEATHER', { location: 'Tokyo' });
445
```
446