Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
Update execute tool to handle custom tool execution
haxzie8d727d403fb2
diff --git a/packages/core/src/models/Tools.ts b/packages/core/src/models/Tools.tsindex d0023db92..2881b8d93 100644--- a/packages/core/src/models/Tools.ts+++ b/packages/core/src/models/Tools.ts@@ -153,17 +153,27 @@ export class Tools {}}- let result = await this.client.tools.execute(slug, {- allow_tracing: body.allowTracing,- connected_account_id: body.connectedAccountId,- custom_auth_params: body.customAuthParams,- arguments: body.arguments,- entity_id: body.userId,- version: body.version,- text: body.text,- });- // apply transformations to the response- result = this.transformToolExecuteResponse(result);+ let result: ToolExecuteResponse;+ // check if the tool is a custom tool+ const customTool = await this.customTools.getCustomToolBySlug(slug);+ if (customTool) {+ result = await this.customTools.executeCustomTool(slug, body, {+ userId: body.userId || 'default',+ connectedAccountId: body.connectedAccountId,+ });+ } else {+ result = await this.client.tools.execute(slug, {+ allow_tracing: body.allowTracing,+ connected_account_id: body.connectedAccountId,+ custom_auth_params: body.customAuthParams,+ arguments: body.arguments,+ entity_id: body.userId,+ version: body.version,+ text: body.text,+ });+ // apply transformations to the response+ result = this.transformToolExecuteResponse(result);+ }// apply local modifiers if they are providedif (modifiers && modifiers.afterToolExecute) {