Docker Just Fixed 90% of AI Coding By Releasing This

Quick Overview

Docker fixed a major inefficiency in AI agent tool usage by introducing the Model Context Protocol (MCP) Gateway with dynamic tool selection via code-mode, allowing agents to avoid sending definitions for hundreds of unused tools in the context window, leading to significant token savings (up to 9,900 tokens per turn) and improved efficiency.

Key Points: The traditional method of using MCP tools involves sending definitions for all available tools (e.g., 47+ tools, totaling 10,000+ tokens every turn) into the context window, which is inefficient. The new 'code-mode' approach, enabled by the MCP Gateway, allows agents to dynamically select and use only the necessary tools by writing JavaScript code that calls tools directly, reducing context load. A real example showed that using code-mode saves approximately 9,900 tokens per turn by only referencing a custom 'analyzemyrepos' tool (100 tokens) instead of including 50+ tool definitions. The code-mode tool is a JavaScript-enabled meta-tool that runs in a secure sandbox, exposing MCP tools as plain JS functions (like searchrepositories()). The video demonstrated dynamically finding and adding the DuckDuckGo MCP server using 'mcp-find' and 'mcp-add' commands, solving the problem of which MCP servers to trust. State persistence is managed using volumes, ensuring that intermediate results and state are managed across tool calls without flooding the model's context window. The presenter successfully created a custom 'code-mode-multi-search-repos' tool to search GitHub using multiple keywords and output the clean results directly to a Notion page.

Context: The video discusses significant improvements to the Model Context Protocol (MCP) for AI assistants, driven by the need to manage the explosion in the number of available tools (hundreds or thousands) without overwhelming the LLM's context window, which increases cost and latency. The core issue addressed is how to efficiently provide agents access to only the relevant tools for a given task, moving away from hardcoding every tool definition into the prompt.

Raw markdown version of this recap