Browse the blog

Reduce MCP tool context with CodeCall

  • frontmcp
  • mcp
  • codecall
  • plugins

Maintained guide. How checks work.

A large MCP tool catalog consumes context even when a request needs only a few tools. Multi-step requests add intermediate results that travel back through the model. CodeCall lets the client discover relevant tools and send a script that combines results on the server. The tradeoff is another execution layer to configure and monitor.

Code execution is an architectural pattern, described in Anthropic's code-execution article. It is distinct from any particular provider's hosted tool-execution feature. CodeCall implements that pattern in a FrontMCP server; it does not establish universal compatibility with every model or client.

For the maintained reference, see CodeCall and the lesson Letting the Model Write Code with CodeCall.

The call sequence

  1. The client calls codecall:search for relevant tools.
  2. It reads selected schemas through codecall:describe.
  3. It sends a script to codecall:execute.
  4. The script calls allowed tools and returns a selected result.

After discovery, one execution call can combine several underlying tool calls. The discovery and schema requests still count. For one small lookup, a direct tool call may be simpler.

Add CodeCall to an app

Install the plugin at the same release as the SDK:

npm install @frontmcp/sdk@1.12.2 @frontmcp/plugin-codecall@1.12.2
import { App } from "@frontmcp/sdk";
import { CodeCallPlugin } from "@frontmcp/plugin-codecall";
import { SearchTickets, GetCustomer } from "./tools";

@App({
  id: "help-desk",
  name: "Help Desk",
  tools: [SearchTickets, GetCustomer],
  plugins: [CodeCallPlugin.init({ mode: "codecall_only" })],
})
export class HelpDeskApp {}

This registration sketch assumes your tool implementations. The CodeCall lesson and CRM example provide complete runnable files and positive/negative checks.

Execution checks and limits

CodeCall checks scripts and limits execution according to its configuration. Tool permissions still matter. Decide which tools scripts may discover and call; test that sensitive operations are refused through both scripts and direct calls. Hiding a tool from a list is not a substitute for authorization.

The Node VM is not a standalone security boundary. Review CodeCall's execution limits and the security hub before exposing sensitive tools. Self-hosting controls where this process runs; APIs and a client's hosted model may still receive data.

Measure the workload you have

The old token/cost illustrations were not a reproducible FrontMCP benchmark and have been removed. Use the reproducible CodeCall evaluation to compare the same fixture through direct calls and scripts.

The existing CRM has 47 tools and a scripted workflow. Catalog bytes, response bytes, tool calls and script wall time can be measured locally. Those are not model tokens, answer accuracy or hosted-model latency. Price arithmetic needs a dated model price and actual token accounting.

Measure a small-catalog case too. Code execution earns its maintenance cost when it solves a demonstrated discovery or intermediate-data problem. Keep direct calls when they already serve the task.

Report a docs issue. Site usage and privacy.