Skip to content

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

fix: standardize naming to "custom tool", fix lint errors, single export path

Dhawal Upadhyayf2e40c4b7839
diff --git a/ts/packages/core/src/experimental/index.ts b/ts/packages/core/src/experimental/index.ts
index 8f45f80f8..cc81a7e33 100644
--- a/ts/packages/core/src/experimental/index.ts
+++ b/ts/packages/core/src/experimental/index.ts
@@ -6,7 +6,7 @@
* '@composio/core' — only the import path changes.
*/
-// Custom local tools
+// Custom tools
export { createCustomTool } from '../models/CustomTool';
export type {
CustomTool,
diff --git a/ts/packages/core/src/index.ts b/ts/packages/core/src/index.ts
index 911b8dd60..6decb7207 100644
--- a/ts/packages/core/src/index.ts
+++ b/ts/packages/core/src/index.ts
@@ -11,8 +11,6 @@ export { MCP } from './models/MCP';
export { RemoteFile } from './models/RemoteFile';
export { createConnectionRequest } from './models/ConnectionRequest';
export { ToolRouterSession } from './models/ToolRouterSession';
-/** @experimental Create custom local tools — also available from '@composio/core/experimental' */
-export { createCustomTool } from './models/CustomTool';
export * from './types/provider.types';
export * from './types/customTool.types';
export * from './types/tool.types';
diff --git a/ts/packages/core/src/models/CustomTool.ts b/ts/packages/core/src/models/CustomTool.ts
index 8b2956261..38bf2a91b 100644
--- a/ts/packages/core/src/models/CustomTool.ts
+++ b/ts/packages/core/src/models/CustomTool.ts
@@ -1,5 +1,5 @@
/**
- * @fileoverview Standalone factory function for creating custom local tools.
+ * @fileoverview Standalone factory function for creating custom tools.
*
* Usage:
* ```typescript
@@ -31,7 +31,7 @@ import {
export const LOCAL_TOOL_PREFIX = 'LOCAL_';
/**
- * Create a custom local tool for use in tool router sessions.
+ * Create a custom tool for use in tool router sessions.
*
* The returned object is a lightweight reference containing the tool's metadata
* and execute function. Pass it to `composio.create(userId, { customTools: [...] })`
diff --git a/ts/packages/core/src/models/ToolRouterSession.ts b/ts/packages/core/src/models/ToolRouterSession.ts
index 6d7c3cb14..31fa2cb58 100644
--- a/ts/packages/core/src/models/ToolRouterSession.ts
+++ b/ts/packages/core/src/models/ToolRouterSession.ts
@@ -124,9 +124,9 @@ export class ToolRouterSession<
}
/**
- * Returns a dispatcher tool that exposes local custom tools for execution.
+ * Returns a dispatcher tool that exposes custom tools for execution.
* Primarily used in MCP flows where remote tools are served via an MCP server
- * and local tools need to be added alongside.
+ * and custom tools need to be added alongside.
*
* Not included in `session.tools()` — must be explicitly added to the agent's tool set.
*
@@ -137,7 +137,7 @@ export class ToolRouterSession<
* const agent = new Agent({
* tools: [
* hostedMcpTool(session.mcp.url), // remote tools from MCP
- * ...localTool, // local custom tools
+ * ...localTool, // custom tools
* ],
* });
* ```
@@ -156,14 +156,14 @@ export class ToolRouterSession<
// Collect local tool slugs and descriptions for the schema
const toolEntries = Array.from(this.customToolsMap!.byOriginal.entries());
const slugDescriptions = toolEntries
- .map(([slug, entry]) => `- ${entry.prefixedSlug}: ${entry.handle.description}`)
+ .map(([_slug, entry]) => `- ${entry.prefixedSlug}: ${entry.handle.description}`)
.join('\n');
// Build a synthetic Tool schema for COMPOSIO_EXECUTE_LOCAL_TOOL
const tool: Tool = {
slug: COMPOSIO_EXECUTE_LOCAL_TOOL,
name: 'Execute Local Tool',
- description: `Execute a local custom tool by slug.\n\nAvailable tools:\n${slugDescriptions}`,
+ description: `Execute a custom tool by slug.\n\nAvailable tools:\n${slugDescriptions}`,
inputParameters: {
type: 'object',
properties: {
@@ -299,8 +299,8 @@ export class ToolRouterSession<
/**
* Execute a tool within the session.
*
- * For custom local tools, accepts both the original slug (e.g. "GET_USER_CONTEXT")
- * and the prefixed slug (e.g. "LOCAL_GET_USER_CONTEXT"). Local tools are executed
+ * For custom tools, accepts both the original slug (e.g. "GET_USER_CONTEXT")
+ * and the prefixed slug (e.g. "LOCAL_GET_USER_CONTEXT"). Custom tools are executed
* in-process; remote tools are sent to the Composio backend.
*
* @param toolSlug - The tool slug to execute
@@ -457,16 +457,18 @@ export class ToolRouterSession<
}));
// Merge and re-index sequentially so there are no collisions
- const allResults = [...remoteResults, ...localEntries].map((entry: any, i) => ({
- ...entry,
- index: i,
- }));
+ const allResults = [...remoteResults, ...localEntries].map(
+ (entry: Record<string, unknown>, i) => ({
+ ...entry,
+ index: i,
+ })
+ );
const hasAnyError = localResults.some(r => r.result.error) || !!remoteResult?.error;
return {
data: { ...remoteData, results: allResults },
error: hasAnyError
- ? `${allResults.filter((r: any) => r.error).length} out of ${allResults.length} tools failed`
+ ? `${allResults.filter((r: Record<string, unknown>) => r.error).length} out of ${allResults.length} tools failed`
: null,
successful: !hasAnyError,
};
diff --git a/ts/packages/core/src/types/customTool.types.ts b/ts/packages/core/src/types/customTool.types.ts
index dbba13d77..68fc1be4d 100644
--- a/ts/packages/core/src/types/customTool.types.ts
+++ b/ts/packages/core/src/types/customTool.types.ts
@@ -116,7 +116,7 @@ export const CreateCustomToolBaseSchema = z.object({
toolkit: z.string().optional(),
});
-/** Options for creating a custom local tool via `createCustomTool()`. */
+/** Options for creating a custom tool via `createCustomTool()`. */
export type CreateCustomToolParams<T extends z.ZodType> = z.infer<
typeof CreateCustomToolBaseSchema
> & {
diff --git a/ts/packages/core/src/types/toolRouter.types.ts b/ts/packages/core/src/types/toolRouter.types.ts
index 29520ba0c..eaa51483a 100644
--- a/ts/packages/core/src/types/toolRouter.types.ts
+++ b/ts/packages/core/src/types/toolRouter.types.ts
@@ -220,7 +220,7 @@ export const ToolRouterCreateSessionConfigSchema = z
.array(z.custom<CustomTool>())
.optional()
.describe(
- 'Custom local tools to include in this session. Created via CustomTool() from @composio/core/experimental.'
+ 'Custom tools to include in this session. Created via createCustomTool() from @composio/core/experimental.'
),
})
.partial()
@@ -440,7 +440,7 @@ export interface Session<
search: ToolRouterSessionSearchFn;
/** Execute a tool within the session */
execute: ToolRouterSessionExecuteFn;
- /** Get provider-wrapped local custom tools for MCP flows */
+ /** Get provider-wrapped custom tools for MCP flows */
localTools: () => Promise<ReturnType<TProvider['wrapTools']>>;
/** Experimental features (files, assistive prompt, etc.) */
experimental: SessionExperimental;