After Anthropic published code execution with MCP on November 4, how should search_tools and on-demand tool manifest JSON replace stuffing every MCP definition into context?

As of 7 November 2026: callMCPTool still maps to JSON-RPC tools/call; use search_tools or a filesystem manifest, filter in the sandbox, return summary JSON to the chat.

On 4 November 2026 Anthropic’s engineering blog published Code execution with MCP. Instead of stuffing every connected server into the model’s tools array each turn, the harness exposes a code sandbox, on-demand tool manifests (filesystem or search_tools), and a stable callMCPTool bridge. Intermediate MCP payloads are filtered in the runtime before a short JSON summary reaches the chat. Wire protocol stays MCP JSON-RPC tools/call; what changes is who assembles JSON in the agent loop.

Dated 7 November 2026 from that post and pre–MCP birthday (25 November) discussion. Two days ago we covered GPT-Image-2.6 request JSON; four days ago, message threads for incremental Messages bodies. Here, threads shrink history; code+MCP shrinks tool defs and fat tool results. For hop-by-hop JSON see Agent JSON data flow.

Why direct tool calling breaks at scale

Classic MCP clients preload every tools[] entry—name, long description, full input_schema—into each model request. Dozens of servers mean six-figure definition tokens before the user prompt. Orchestration hurts too: a 50k-token transcript copied from tool A into tool B’s arguments can flow through context twice.

Code execution keeps MCP but moves listing, parameter assembly, and chaining into generated code with a sandboxed runtime. Vendors like Cloudflare describe the same pattern as Code Mode: let the model program the glue.

search_tools request JSON

Progressive disclosure uses a meta-tool instead of upfront definitions. Shape it with JSON Schema, for example:

{
  "name": "search_tools",
  "input_schema": {
    "type": "object",
    "properties": {
      "query": { "type": "string", "minLength": 1 },
      "detail_level": {
        "type": "string",
        "enum": ["name", "name_description", "full"]
      }
    },
    "required": ["query"],
    "additionalProperties": false
  }
}

A tool_use might pass {"query":"salesforce","detail_level":"full"}; the tool_result should be a filtered array of matches, not the raw tools/list dump. Filesystem discovery (servers/<server>/<tool>.ts) is an alternative—avoid both at once loading everything upfront.

From callMCPTool to tools/call

await callMCPTool('google_drive__get_document', {
  documentId: 'abc123'
});

The host emits standard MCP JSON-RPC:

{
  "jsonrpc": "2.0",
  "id": 42,
  "method": "tools/call",
  "params": {
    "name": "google_drive__get_document",
    "arguments": { "documentId": "abc123" }
  }
}

Full result.content should stay in sandbox logs unless you explicitly log or return a summary to the model.

Filter in the sandbox first

const allRows = await gdrive.getSheet({ sheetId: 'abc123' });
const pending = allRows.filter(r => r.Status === 'pending');
console.log(JSON.stringify({
  pending_count: pending.length,
  sample: pending.slice(0, 5)
}));

The model sees counts and a sample, not 10k rows. Loops and waits run as code instead of extra tool round-trips. Hosts may tokenize PII in JSON visible to the assistant.

What JSON still enters each turn

Visible tool_results are fewer and smaller—often execute + stdout summary—while MCP calls happen inside the sandbox. Create turns still carry system (paths, callMCPTool rules) and a slim tools set. With message threads, fix tools on create; continue must not resend them.

Validating manifest JSON locally

Keep sample JSON for search_tools, tools/call, and max summary payloads. Use JSON Diff against legacy full tools arrays and JSON validation on schemas.

FAQ

Does this replace MCP with plain Function Calling?

No. MCP remains the JSON-RPC layer; only what enters model context changes.

Still send huge tools arrays every turn?

Not full catalogs—discovery and execution meta-tools on create, schemas on demand.

Compatible with message threads?

Yes. Threads handle history; code+MCP handles defs and results. Fix tools on create.

Same as Cloudflare Code Mode?

Same insight; sandboxes and discovery APIs differ. Align JSON-RPC with MCP spec.

Production without a sandbox?

No. Generated code is RCE risk—limits, network policy, and audit are required.

Default for detail_level?

Use name_description; request full only when generating a call.

Summary

Code execution with MCP trades sandbox discipline for far less tool and intermediate JSON in context—MCP on the wire, accounting in the host.