Code-Mode Tool
AI-generatedSummary
Execute user-provided TypeScript code within a secure sandbox that can call configured tools from Model Context Protocol (MCP) servers and optionally auto-registered sibling AI tools for efficient multi-tool orchestration.
Inputs
- Auto-Register Sibling Tools — Toggle to automatically detect and register sibling AI tool sub-nodes connected to this node so they can be invoked from inside the code sandbox.
- MCP Server Presets — Configure one or more pre-built Model Context Protocol server integrations (Filesystem, GitHub, Brave Search, SQLite, Memory) by specifying server type and relevant credentials or paths. The matching MCP server package must be installed separately via npm.
- Additional Tool Sources (JSON) — Provide a JSON array of manual UTCP (Universal Tool Call Protocol) tool source configurations for custom MCP servers or HTTP APIs not covered by presets. These configurations merge with the preset servers.
- Timeout (ms) — Maximum allowed execution time in milliseconds for the TypeScript code running in the sandbox.
- Memory Limit (MB) — Maximum allowed memory allocation in megabytes for the isolated sandbox running the code.
- Enable Trace — Enable detailed tracing of tool call timing and include this trace data in the output's metadata.
Output shape
a single JSON string containing the sandbox execution result, logs, optional error details, and metadata about executed code and tool call token savings
The input to the node should include a .json.code string property with TypeScript code that uses the registered tools. The code can call MCP tools via
manual.toolName({ params })and, if enabled, sibling tools viasibling.toolName({ params }). The output JSON includes the result of the code execution, logs, error if any, and metadata such as token estimates and optional trace data if enabled. Errors during execution are reported in the output JSON's error field.
Examples
Example 1: Call a filesystem MCP server to read a file within the sandboxed TypeScript code.
Configure MCP Server Presets with a Filesystem server type and Allowed Directory (e.g., /tmp). Set your TypeScript code under the input .json.code that calls manual.fs.readFile({ path: '/tmp/example.txt' }). The node executes the code within time and memory limits, returning results and logs.