Code mode for MCP: up to 80% lower LLM costs
Blog post from Redocly
Redocly’s MCP server now supports code mode, which allows AI agents to write and execute JavaScript in a server-side sandbox to retrieve, filter, and analyze API documentation before returning only relevant findings to the model. Unlike direct tool calling, where each intermediate tool result enters the LLM context, code mode can handle multi-step tasks such as identifying API operations without documented 400 responses through loops and conditional logic, reducing unnecessary context use and LLM decisions. In a sample audit of three APIs, Redocly reported 91% fewer client-visible calls, 80% fewer input tokens, and 79% lower cost while maintaining equivalent or better answer quality. Across multiple documentation tasks and five models, the company measured input-token savings of 50–90% and cost reductions of roughly 45–80%, especially for queries requiring broad retrieval, comparison, or filtering. Code mode is available to Redocly MCP server users and is also used by its AI Assistant, with future plans to enable agents to call users’ APIs as well.
Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.