tool_call
Execute specific methods of various tools with required parameters using this function. Specify the tool name, method, and parameters to perform actions like sending messages or listing events.
Instructions
"Use this tool to execute a specific method of another tool with the provided parameters based on get-tools tool response. You need to specify the tool name, method name, and any required parameters for that method."
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| method | Yes | The method of the tool to call (e.g., 'get_messages', 'send_message', 'list_events') | |
| parameters | No | The parameters required by the specific tool method being called, it is MUST HAVE field. | |
| question | No | User question that you want find answer for. Try to ALWAYS provide this field based on conversation with user. Could be your reasoning for calling tool. | |
| tool | Yes | The name of the tool to call (e.g., 'gmail', 'google-calendar', 'slack') |
Implementation Reference
- src/tools/tool-call.ts:26-66 (handler)The execute method implements the core logic of the 'tool_call' tool. It constructs a URL based on the tool, method, and optional question, posts parameters to veyraxClient, returns the response as text content, and handles specific errors like 404 (not found) and 500 (server error).async execute({ tool, method, parameters, question }: z.infer<typeof this.schema>) { try { const url = `/tool-call/${tool}/${method}?include_component=false${question ? `&question=${encodeURIComponent(question)}` : ''}`; const { data } = await veyraxClient.post(url, parameters); return { content: [ { type: "text" as const, text: JSON.stringify(data, null, 2), }, ], }; } catch (error: any) { console.error(`Error calling tool ${tool}.${method}:`, error); if (error?.response) { if (error.response.status === 404) { return { content: [ { type: "text" as const, text: `Tool or method not found: ${tool}.${method}. Please check the tool name and method name.`, }, ], }; } else if (error.response.status === 500) { return { content: [ { type: "text" as const, text: `Server error occurred while calling ${tool}.${method}. Please try again later.`, }, ], }; } } throw error; } }
- src/tools/tool-call.ts:15-24 (schema)Zod schema defining input validation for 'tool_call': required 'tool' (string), 'method' (string), 'parameters' (record, default {}), optional 'question' (string).schema = z.object({ tool: z.string().describe("The name of the tool to call (e.g., 'gmail', 'google-calendar', 'slack')"), method: z.string().describe("The method of the tool to call (e.g., 'get_messages', 'send_message', 'list_events')"), parameters: z.record(z.any()) .default({}) .describe("The parameters required by the specific tool method being called, it is MUST HAVE field."), question: z.string() .optional() .describe("User question that you want find answer for. Try to ALWAYS provide this field based on conversation with user. Could be your reasoning for calling tool.") });
- src/index.ts:14-14 (registration)Registers the ToolCallTool with the MCP server instance.new ToolCallTool().register(server);
- src/tools/tool-call.ts:12-13 (registration)Sets the name to 'tool_call' and provides the tool description within the ToolCallTool class.name = toolName; description = toolDescription;