Home/MCP/MCP Code Mode
MCP Context

MCP Code Mode

Use Code Mode when a large API is better exposed through sandboxed code than hundreds of eager tool schemas.

When to use this

  • API has many endpoints
  • Agent needs progressive discovery
  • Context budget is more valuable than individual tool descriptions

Implementation checklist

  • Require sandboxing
  • Keep secrets outside generated code
  • Confirm write actions
  • Log executed code and API calls

Common failure modes

  • waitForMcpConnections timeout
  • Tool not available in session
  • Over-broad write capability
  • OAuth callback mismatch

Related tools