execute_code and search_tools so agents run JavaScript with access to connected MCP tools instead of making individual tool calls. Node.js only.
Enable
Executors
(code, timeout?) and returns an ExecutionResult.
It owns cleanup for whatever runtime it wraps — client.close() does not
release anything on its behalf. A non-arrow function is invoked with the
MCPClient as its this, so it can reach the client without closing over it:
Agent integration
Use with@mcp-use/agent and PROMPTS.CODE_MODE:
Reference
Client API reference — config types,searchTools, and ExecutionResult.
Anthropic: Code execution with MCP