XNews

mcp-use Implements Code Mode and Related Tools

mcp-use Implements Code Mode and Related Tools

mcp-use has implemented Code Mode in the open-source library, allowing models under MCP to generate and execute Python code for batch tool calls, addressing three major pain points of traditional tool invocation.

Key insights

Code Mode Addresses Inefficiencies in Tool Invocation by Enabling Model Code Generation

The core of Code Mode is to allow models to generate Python code and execute it in a controlled environment, thus avoiding frequent sequential tool calls. The post summarizes three major pain points of traditional methods: context inflation, high overhead of sequential execution, and the model's greater proficiency in writing code. Code Mode can achieve significant speed improvements and token savings through one-time batch execution (e.g., a for loop for file renaming).

mcp-use Industrializes Code Mode within the MCP Protocol Framework

mcp-use implements Code Mode in the open-source library: enabling this mode when creating the MCPClient, exposing two special tools to the model (dynamic discovery of MCP servers/tools and code execution tools), and importing the MCP SDK as a Python module for direct invocation in the code execution environment. This implementation complies with MCP standards and leverages its certification and documentation advantages to ensure secure network operations.

Grok 4.1 Fast API Released with Context and Pricing Details

Grok 4.1 Fast API has been released, providing a 2M token tool invocation proxy for supporting scenarios such as finance and web search. Supported tools include web/search, code execution, files, and MCP. Pricing is set at $0.20 per million for input, $0.50 per million for output, and tools starting from $5 per thousand. The Agent Tools API is free, and OpenRouter offers a free usage period until December 3.

Source posts