Home
Relevant source files
The following files were used as context for generating this wiki page:- README.md
- core/README.md
- plugins/communication_protocols/cli/README.md
- plugins/communication_protocols/http/README.md
- plugins/communication_protocols/mcp/README.md
- plugins/communication_protocols/text/README.md
- plugins/communication_protocols/websocket/README.md
- CLAUDE.md
- scripts/extract_required_docs.py
- plugins/communication_protocols/http/pyproject.toml
- plugins/communication_protocols/text/pyproject.toml
The Universal Tool Calling Protocol (UTCP) is a secure, scalable, and extensible standard for defining and interacting with tools across a wide variety of communication protocols. It is designed to handle a large number of tools and providers without compromising performance, and its pluggable architecture allows developers to easily add new communication protocols, tool storage, and search strategies without modifying the core library.
UTCP's primary goal is to provide interoperability, enabling integration with almost any existing service or infrastructure through a growing ecosystem of protocol plugins. The protocol is built on simple, well-defined Pydantic models, making it easy for developers to implement and use.
Sources: README.md:8-19, core/README.md:11-22
Architecture Overview
UTCP features a modular architecture that separates a core library from protocol-specific plugins. The core package (utcp) provides foundational components, while plugins handle the implementation details for different communication protocols.
Sources: README.md:27-29, core/README.md:28-29
This diagram illustrates the high-level architecture of the UTCP client and its interaction with the core components and various protocol plugins.
Sources: README.md:31-37, core/README.md:31-37, CLAUDE.md:28-35
Core Components
The core utcp package contains the foundational elements of the protocol.
| Component | Description | Source File |
|---|---|---|
UtcpClient | The main entry point for interacting with the UTCP ecosystem. It handles tool discovery, registration, and execution. | core/README.md |
UtcpClientConfig | A Pydantic model for client configuration, defining variables, tool repositories, search strategies, and manual templates. | CLAUDE.md |
| Data Models | Pydantic models for Tool, CallTemplate, UtcpManual, and Auth that define the structure of the protocol. | core/README.md |
| Plugin System | A set of extensible interfaces for communication protocols, tool repositories, and search strategies. | core/README.md |
| Default Implementations | Built-in strategies for tool storage (InMemToolRepository) and search (TagAndDescriptionWordMatchStrategy). | core/README.md |
Sources: core/README.md:32-37, CLAUDE.md:31-35, README.md:92-95
Protocol Plugins
UTCP's functionality is extended through protocol-specific plugins. These are separate, installable packages that allow UTCP to communicate over different protocols.
| Plugin | Description | Status |
|---|---|---|
utcp-http | HTTP/REST APIs, SSE, streaming, and OpenAPI conversion. | ✅ Stable |
utcp-cli | Execute local command-line tools and scripts. | ✅ Stable |
utcp-websocket | Real-time bidirectional communication over WebSocket. | ✅ Stable |
utcp-mcp | Interoperability with Model Context Protocol (MCP) servers. | ✅ Stable |
utcp-text | Read local files as tool outputs, useful for mock data or static content. | ✅ Stable |
utcp-socket | TCP/UDP protocols. | 🚧 In Progress |
utcp-gql | GraphQL APIs. | 🚧 In Progress |
Sources: README.md:58-68, core/README.md:46-55
To use a plugin, it must be installed alongside the core utcp package.
# Install core + HTTP plugin (most common)
pip install utcp utcp-http
# Install additional plugins as needed
pip install utcp-cli utcp-websocket
Sources: README.md:46-51
Core Concepts
UtcpClient Initialization
The UtcpClient is the central component for using UTCP. It can be initialized in several ways, providing flexibility for different use cases.
This flowchart shows the different paths to creating a UtcpClient instance.
Sources: README.md:128-131, core/README.md:127-130
An example of creating a client from a dictionary:
from utcp.utcp_client import UtcpClient
# Create client with an HTTP API manual
client = await UtcpClient.create(config={
"manual_call_templates": [{
"name": "my_api",
"call_template_type": "http",
"url": "https://api.example.com/utcp"
}]
})
Sources: README.md:53-61
UtcpManual and Tool Models
A UTCPManual is a document that describes a collection of tools. Each Tool definition within the manual includes its name, description, I/O schemas, and a tool_call_template. The tool_call_template is a critical field that replaced the legacy tool_provider and specifies how to execute the tool, including the protocol type (call_template_type) and other protocol-specific details.
{
"manual_version": "1.0.0",
"utcp_version": "1.0.2",
"tools": [
{
"name": "get_weather",
"description": "Get current weather for a location",
"inputs": {
"type": "object",
"properties": { "location": {"type": "string"} }
},
"outputs": {
"type": "object",
"properties": {
"temperature": {"type": "number"},
"conditions": {"type": "string"}
}
},
"tool_call_template": {
"call_template_type": "http",
"url": "https://example.com/api/weather",
"http_method": "GET"
}
}
]
}
Sources: README.md:204-220, core/README.md:203-219
Tool Calling
Tools are invoked using the call_tool method on the UtcpClient. Tool names are namespaced with the format manual_name.tool_name to prevent naming conflicts between different tool manuals.
The following diagram shows the sequence of a tool call.
Sources: README.md:96, CLAUDE.md:48-49, core/README.md:175-179
OpenAPI Ingestion
A key feature of UTCP is its ability to automatically convert an OpenAPI 2.0/3.0 specification into a set of UTCP tools. This allows AI agents to interact with existing REST APIs directly without requiring any server-side modifications or additional infrastructure.
Key Benefits:
- Zero Infrastructure: No need to deploy or maintain wrapper servers.
- Direct API Calls: Interacts directly with the API for native performance.
- Automatic Conversion: Transforms OpenAPI schemas into UTCP tools.
- Selective Authentication: Applies authentication only to protected endpoints as defined in the OpenAPI spec.
You can use this feature by pointing a manual_call_templates entry of type http to an OpenAPI specification URL.
from utcp.utcp_client import UtcpClient
client = await UtcpClient.create(config={
"manual_call_templates": [{
"name": "github",
"call_template_type": "http",
"url": "https://api.github.com/openapi.json",
"auth_tools": { # Authentication for generated tools requiring auth
"auth_type": "api_key",
"api_key": "Bearer ${GITHUB_TOKEN}",
"var_name": "Authorization",
"location": "header"
}
}]
})
Sources: README.md:326-361, plugins/communication_protocols/text/README.md:15-17
Migration from 0.x to 1.0.0
Version 1.0.0 introduced significant breaking changes focused on modularity and configuration.
- Dependencies: The project is split into a core
utcppackage and separate plugin packages (e.g.,utcp-http,utcp-cli). You must install the plugins you need. - Configuration:
UtcpClientis now initialized with aUtcpClientConfigobject, a dictionary, or a JSON file path.- The
providers_file_pathoption is removed. Tool manuals are now defined via themanual_call_templateslist in the configuration. - The term
provideris replaced withcall_template, andprovider_typeis nowcall_template_type.
- Tool Naming: Tool names are now namespaced as
manual_name.tool_name. - Imports: Imports must be updated to reflect the new modular structure (e.g.,
from utcp_http.http_call_template import HttpCallTemplate).
Sources: README.md:83-99, core/README.md:82-98