@devries-cameron20 / composio-1 / commits / 8d727d403
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.

Update execute tool to handle custom tool execution

haxzie committed May 14, 2025 at 12:36 UTC 8d727d403fb26c5ced7eea29e9da4960d65d8754
1 file changed +21 -11
packages/core/src/models/Tools.ts
+21 -11
@@ -153,17 +153,27 @@ export class Tools {
153 }
154 }
155
156 - let result = await this.client.tools.execute(slug, {
157 - allow_tracing: body.allowTracing,
158 - connected_account_id: body.connectedAccountId,
159 - custom_auth_params: body.customAuthParams,
160 - arguments: body.arguments,
161 - entity_id: body.userId,
162 - version: body.version,
163 - text: body.text,
164 - });
165 - // apply transformations to the response
166 - result = this.transformToolExecuteResponse(result);
156 + let result: ToolExecuteResponse;
157 + // check if the tool is a custom tool
158 + const customTool = await this.customTools.getCustomToolBySlug(slug);
159 + if (customTool) {
160 + result = await this.customTools.executeCustomTool(slug, body, {
161 + userId: body.userId || 'default',
162 + connectedAccountId: body.connectedAccountId,
163 + });
164 + } else {
165 + result = await this.client.tools.execute(slug, {
166 + allow_tracing: body.allowTracing,
167 + connected_account_id: body.connectedAccountId,
168 + custom_auth_params: body.customAuthParams,
169 + arguments: body.arguments,
170 + entity_id: body.userId,
171 + version: body.version,
172 + text: body.text,
173 + });
174 + // apply transformations to the response
175 + result = this.transformToolExecuteResponse(result);
176 + }
177
178 // apply local modifiers if they are provided
179 if (modifiers && modifiers.afterToolExecute) {