universal-tool-calling-protocol/code-mode
🔌 Plug-and-play library to enable agents to call MCP and UTCP tools via code execution.
What it solves
Traditional AI tool calling often requires multiple round-trips between the LLM and the application to execute a sequence of tools, which is slow and expensive. Code-Mode replaces this by allowing an LLM to write a single block of TypeScript code that can call multiple tools, process data in a sandbox, and return a final result in one execution.
How it works
The library provides a secure Node.js VM sandbox where TypeScript code generated by the LLM is executed. Instead of the LLM calling tools individually, it uses a callToolChain method to run a script that interacts with registered tool ecosystems (such as MCP servers, HTTP APIs, or CLI tools). The system supports progressive tool discovery, allowing agents to search for relevant tools and retrieve their TypeScript interfaces before executing code.
Who it’s for
Developers building AI agents that need to perform complex, multi-step workflows involving various APIs and tools without the overhead of traditional function calling.
Highlights
- Batching Advantage: Reduces API round-trips by executing multiple tool calls in a single code block.
- Multi-Protocol Support: Works with MCP (Model Context Protocol), HTTP, File, and CLI tool ecosystems.
- Secure Sandboxing: Uses Node.js VM isolates to prevent unauthorized access and includes configurable timeout protection.
- Enterprise-Ready: Features runtime interface introspection, full console output capture for observability, and auto-generated TypeScript interfaces for IDE support.
- cantidad de CLI Tooling: Includes a
utcpCLI for shell-capable agents to self-configure and run tool-chains directly from the terminal.
Related
- Project
- Project
- Project
- Project