You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: simplify code_execution description and add it to /mcp/call mode
- Remove bloated tool catalog from code_execution description on /mcp/code
(was embedding ALL upstream tool names, now references retrieve_tools)
- Add code_execution tool to /mcp/call mode (user requested)
- Extract buildCodeExecutionTool() helper shared by both routing modes
- retrieve_tools on /mcp/call still encourages call_tool_* workflow
- retrieve_tools on /mcp/code still encourages code_execution workflow
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
returnmcp.NewToolResultError("Code execution is disabled. Enable it by setting \"enable_code_execution\": true in your mcpproxy configuration file."), nil
226
-
},
227
-
})
228
-
} else {
229
-
// Build enhanced description with available tools catalog
230
-
ctx:=context.Background()
231
-
toolCatalog:=p.buildToolCatalogDescription(ctx)
232
-
233
-
codeExecDescription:=fmt.Sprintf(
234
-
"Execute JavaScript code that orchestrates multiple upstream MCP tools in a single request. "+
235
-
"Use this when you need to combine results from 2+ tools, implement conditional logic, loops, or data transformations.\n\n"+
236
-
"**Available in JavaScript**:\n"+
237
-
"- `input` global: Your input data passed via the 'input' parameter\n"+
"- Standard ES5.1+ JavaScript (no require(), filesystem, or network access)\n\n"+
240
-
"**Available tools for orchestration**:\n%s\n\n"+
241
-
"Use call_tool('serverName', 'toolName', {args}) to invoke tools.",
242
-
toolCatalog,
243
-
)
244
-
245
-
// code_execution tool with enhanced description
246
-
codeExecutionTool:=mcp.NewTool("code_execution",
247
-
mcp.WithDescription(codeExecDescription),
248
-
mcp.WithTitleAnnotation("Code Execution"),
249
-
mcp.WithDestructiveHintAnnotation(true),
250
-
mcp.WithString("code",
251
-
mcp.Required(),
252
-
mcp.Description("JavaScript source code (ES5.1+) to execute. Use `input` to access input data and `call_tool(serverName, toolName, args)` to invoke upstream tools."),
253
-
),
254
-
mcp.WithObject("input",
255
-
mcp.Description("Input data accessible as global `input` variable in JavaScript code (default: {})"),
256
-
),
257
-
mcp.WithObject("options",
258
-
mcp.Description("Execution options: timeout_ms (1-600000, default: 120000), max_tool_calls (>= 0, 0=unlimited), allowed_servers (array of server names, empty=all allowed)"),
returnmcp.NewToolResultError("Code execution is disabled. Enable it by setting \"enable_code_execution\": true in your mcpproxy configuration file."), nil
402
+
},
403
+
}}
463
404
}
464
405
465
-
returnsb.String()
406
+
codeExecutionTool:=mcp.NewTool("code_execution",
407
+
mcp.WithDescription("Execute JavaScript code that orchestrates multiple upstream MCP tools in a single request. "+
408
+
"Use when you need to combine results from 2+ tools, implement conditional logic, loops, or data transformations.\n\n"+
409
+
"**Available in JavaScript**:\n"+
410
+
"- `input` global: Your input data passed via the 'input' parameter\n"+
"- ES5.1+ JavaScript (no require(), filesystem, or network access)\n\n"+
413
+
"Use `retrieve_tools` to discover available tools, then call them via `call_tool('serverName', 'toolName', {args})`."),
414
+
mcp.WithTitleAnnotation("Code Execution"),
415
+
mcp.WithDestructiveHintAnnotation(true),
416
+
mcp.WithString("code",
417
+
mcp.Required(),
418
+
mcp.Description("JavaScript source code (ES5.1+) to execute. Use `input` to access input data and `call_tool(serverName, toolName, args)` to invoke upstream tools."),
419
+
),
420
+
mcp.WithObject("input",
421
+
mcp.Description("Input data accessible as global `input` variable in code (default: {})"),
422
+
),
423
+
mcp.WithObject("options",
424
+
mcp.Description("Execution options: timeout_ms (1-600000, default: 120000), max_tool_calls (>= 0, 0=unlimited), allowed_servers (array of server names, empty=all allowed)"),
425
+
),
426
+
)
427
+
return []mcpserver.ServerTool{{
428
+
Tool: codeExecutionTool,
429
+
Handler: p.handleCodeExecution,
430
+
}}
466
431
}
467
432
468
433
// initRoutingModeServers creates separate MCP server instances for each routing mode.
0 commit comments