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
fix: standardize naming to "custom tool", fix lint errors, single export path
- Replace all "custom local" / "local custom" with "custom tool" in user-facing text - Fix toolRouter.types.ts description: CustomTool() → createCustomTool() - Remove createCustomTool from stable root export — canonical import is @composio/core/experimental only (types still exported from stable root) - Fix lint: unused slug → _slug, replace no-explicit-any with Record<string, unknown> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Dhawal Upadhyay committed
Mar 10, 2026 at 21:56 UTC
f2e40c4b7839b4f1b7736981ae18908c6f2e0576
6 files changed
+20
-20
ts/packages/core/src/experimental/index.ts
+1
-1
@@ -6,7 +6,7 @@
6
* '@composio/core' — only the import path changes.
7
*/
8
9
-// Custom local tools
9
+// Custom tools
10
export { createCustomTool } from '../models/CustomTool';
11
export type {
12
CustomTool,
ts/packages/core/src/index.ts
-2
@@ -11,8 +11,6 @@ export { MCP } from './models/MCP';
11
export { RemoteFile } from './models/RemoteFile';
12
export { createConnectionRequest } from './models/ConnectionRequest';
13
export { ToolRouterSession } from './models/ToolRouterSession';
14
-/** @experimental Create custom local tools — also available from '@composio/core/experimental' */
15
-export { createCustomTool } from './models/CustomTool';
14
export * from './types/provider.types';
15
export * from './types/customTool.types';
16
export * from './types/tool.types';
ts/packages/core/src/models/CustomTool.ts
+2
-2
@@ -1,5 +1,5 @@
1
/**
2
- * @fileoverview Standalone factory function for creating custom local tools.
2
+ * @fileoverview Standalone factory function for creating custom tools.
3
*
4
* Usage:
5
* ```typescript
@@ -31,7 +31,7 @@ import {
31
export const LOCAL_TOOL_PREFIX = 'LOCAL_';
32
33
/**
34
- * Create a custom local tool for use in tool router sessions.
34
+ * Create a custom tool for use in tool router sessions.
35
*
36
* The returned object is a lightweight reference containing the tool's metadata
37
* and execute function. Pass it to `composio.create(userId, { customTools: [...] })`
ts/packages/core/src/models/ToolRouterSession.ts
+14
-12
@@ -124,9 +124,9 @@ export class ToolRouterSession<
124
}
125
126
/**
127
- * Returns a dispatcher tool that exposes local custom tools for execution.
127
+ * Returns a dispatcher tool that exposes custom tools for execution.
128
* Primarily used in MCP flows where remote tools are served via an MCP server
129
- * and local tools need to be added alongside.
129
+ * and custom tools need to be added alongside.
130
*
131
* Not included in `session.tools()` — must be explicitly added to the agent's tool set.
132
*
@@ -137,7 +137,7 @@ export class ToolRouterSession<
137
* const agent = new Agent({
138
* tools: [
139
* hostedMcpTool(session.mcp.url), // remote tools from MCP
140
- * ...localTool, // local custom tools
140
+ * ...localTool, // custom tools
141
* ],
142
* });
143
* ```
@@ -156,14 +156,14 @@ export class ToolRouterSession<
156
// Collect local tool slugs and descriptions for the schema
157
const toolEntries = Array.from(this.customToolsMap!.byOriginal.entries());
158
const slugDescriptions = toolEntries
159
- .map(([slug, entry]) => `- ${entry.prefixedSlug}: ${entry.handle.description}`)
159
+ .map(([_slug, entry]) => `- ${entry.prefixedSlug}: ${entry.handle.description}`)
160
.join('\n');
161
162
// Build a synthetic Tool schema for COMPOSIO_EXECUTE_LOCAL_TOOL
163
const tool: Tool = {
164
slug: COMPOSIO_EXECUTE_LOCAL_TOOL,
165
name: 'Execute Local Tool',
166
- description: `Execute a local custom tool by slug.\n\nAvailable tools:\n${slugDescriptions}`,
166
+ description: `Execute a custom tool by slug.\n\nAvailable tools:\n${slugDescriptions}`,
167
inputParameters: {
168
type: 'object',
169
properties: {
@@ -299,8 +299,8 @@ export class ToolRouterSession<
299
/**
300
* Execute a tool within the session.
301
*
302
- * For custom local tools, accepts both the original slug (e.g. "GET_USER_CONTEXT")
303
- * and the prefixed slug (e.g. "LOCAL_GET_USER_CONTEXT"). Local tools are executed
302
+ * For custom tools, accepts both the original slug (e.g. "GET_USER_CONTEXT")
303
+ * and the prefixed slug (e.g. "LOCAL_GET_USER_CONTEXT"). Custom tools are executed
304
* in-process; remote tools are sent to the Composio backend.
305
*
306
* @param toolSlug - The tool slug to execute
@@ -457,16 +457,18 @@ export class ToolRouterSession<
457
}));
458
459
// Merge and re-index sequentially so there are no collisions
460
- const allResults = [...remoteResults, ...localEntries].map((entry: any, i) => ({
461
- ...entry,
462
- index: i,
463
- }));
460
+ const allResults = [...remoteResults, ...localEntries].map(
461
+ (entry: Record<string, unknown>, i) => ({
462
+ ...entry,
463
+ index: i,
464
+ })
465
+ );
466
const hasAnyError = localResults.some(r => r.result.error) || !!remoteResult?.error;
467
468
return {
469
data: { ...remoteData, results: allResults },
470
error: hasAnyError
469
- ? `${allResults.filter((r: any) => r.error).length} out of ${allResults.length} tools failed`
471
+ ? `${allResults.filter((r: Record<string, unknown>) => r.error).length} out of ${allResults.length} tools failed`
472
: null,
473
successful: !hasAnyError,
474
};
ts/packages/core/src/types/customTool.types.ts
+1
-1
@@ -116,7 +116,7 @@ export const CreateCustomToolBaseSchema = z.object({
116
toolkit: z.string().optional(),
117
});
118
119
-/** Options for creating a custom local tool via `createCustomTool()`. */
119
+/** Options for creating a custom tool via `createCustomTool()`. */
120
export type CreateCustomToolParams<T extends z.ZodType> = z.infer<
121
typeof CreateCustomToolBaseSchema
122
> & {
ts/packages/core/src/types/toolRouter.types.ts
+2
-2
@@ -220,7 +220,7 @@ export const ToolRouterCreateSessionConfigSchema = z
220
.array(z.custom<CustomTool>())
221
.optional()
222
.describe(
223
- 'Custom local tools to include in this session. Created via CustomTool() from @composio/core/experimental.'
223
+ 'Custom tools to include in this session. Created via createCustomTool() from @composio/core/experimental.'
224
),
225
})
226
.partial()
@@ -440,7 +440,7 @@ export interface Session<
440
search: ToolRouterSessionSearchFn;
441
/** Execute a tool within the session */
442
execute: ToolRouterSessionExecuteFn;
443
- /** Get provider-wrapped local custom tools for MCP flows */
443
+ /** Get provider-wrapped custom tools for MCP flows */
444
localTools: () => Promise<ReturnType<TProvider['wrapTools']>>;
445
/** Experimental features (files, assistive prompt, etc.) */
446
experimental: SessionExperimental;