# Code-Mode

A library that lets AI agents call MCP and UTCP tools by writing and executing code instead of making individual tool calls, reducing the round trips needed for multi-step tasks.

Code-Mode gives an AI agent one tool that executes TypeScript code with access to a registered toolkit, instead of exposing many individual tools directly. An agent can register a tool manual, such as an MCP server, discover relevant tools by searching rather than loading every definition, and then call a chain of tools from a single generated code block.

Generated code runs inside a Node.js VM sandbox with timeout protection, and TypeScript interfaces for each tool's inputs are generated automatically. The library is written in TypeScript and licensed under MPL-2.0.

Website: https://github.com/universal-tool-calling-protocol/code-mode
