Skip to content

Commit 8a0a449

Browse files
perrozzih3xxitcubic-dev-ai[bot]
authored
Enhance documentation: Move docs to class docstrings and improve README files (#59)
* Move documentation from docs folder to class docstrings and document undocumented classes * Improve README files with comprehensive documentation and cross-references * Update core/src/utcp/implementations/tag_search.py Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> * Update plugins/communication_protocols/cli/src/utcp_cli/cli_call_template.py Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> * Update some docstrings --------- Co-authored-by: Razvan Radulescu <43811028+h3xxit@users.noreply.github.com> Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
1 parent fe3aad0 commit 8a0a449

16 files changed

Lines changed: 1163 additions & 629 deletions

File tree

README.md

Lines changed: 60 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -19,47 +19,76 @@ In contrast to other protocols, UTCP places a strong emphasis on:
1919

2020
![MCP vs. UTCP](https://github.com/user-attachments/assets/3cadfc19-8eea-4467-b606-66e580b89444)
2121

22-
## New Architecture in 1.0.0
22+
## Repository Structure
2323

24-
UTCP has been refactored into a core library and a set of optional plugins.
24+
This repository contains the complete UTCP Python implementation:
25+
26+
- **[`core/`](core/)** - Core `utcp` package with foundational components ([README](core/README.md))
27+
- **[`plugins/communication_protocols/`](plugins/communication_protocols/)** - Protocol-specific plugins:
28+
- [`http/`](plugins/communication_protocols/http/) - HTTP/REST, SSE, streaming, OpenAPI ([README](plugins/communication_protocols/http/README.md))
29+
- [`cli/`](plugins/communication_protocols/cli/) - Command-line tools ([README](plugins/communication_protocols/cli/README.md))
30+
- [`mcp/`](plugins/communication_protocols/mcp/) - Model Context Protocol ([README](plugins/communication_protocols/mcp/README.md))
31+
- [`text/`](plugins/communication_protocols/text/) - File-based tools ([README](plugins/communication_protocols/text/README.md))
32+
- [`socket/`](plugins/communication_protocols/socket/) - TCP/UDP (🚧 In Progress)
33+
- [`gql/`](plugins/communication_protocols/gql/) - GraphQL (🚧 In Progress)
34+
35+
## Architecture Overview
36+
37+
UTCP uses a modular architecture with a core library and protocol plugins:
2538

2639
### Core Package (`utcp`)
2740

28-
The `utcp` package provides the central components and interfaces:
29-
* **Data Models**: Pydantic models for `Tool`, `CallTemplate`, `UtcpManual`, and `Auth`.
30-
* **Pluggable Interfaces**:
31-
* `CommunicationProtocol`: Defines the contract for protocol-specific communication (e.g., HTTP, CLI).
32-
* `ConcurrentToolRepository`: An interface for storing and retrieving tools with thread-safe access.
33-
* `ToolSearchStrategy`: An interface for implementing tool search algorithms.
34-
* `VariableSubstitutor`: Handles variable substitution in configurations.
35-
* `ToolPostProcessor`: Allows for modifying tool results before they are returned.
36-
* **Default Implementations**:
37-
* `UtcpClient`: The main client for interacting with the UTCP ecosystem.
38-
* `InMemToolRepository`: An in-memory tool repository with asynchronous read-write locks.
39-
* `TagAndDescriptionWordMatchStrategy`: An improved search strategy that matches on tags and description keywords.
40-
41-
### Protocol Plugins
42-
43-
Communication protocols are now separate, installable packages. This keeps the core lean and allows users to install only the protocols they need.
44-
* `utcp-http`: Supports HTTP, SSE, and streamable HTTP, plus an OpenAPI converter.
45-
* `utcp-cli`: For wrapping local command-line tools.
46-
* `utcp-mcp`: For interoperability with the Model Context Protocol (MCP).
47-
* `utcp-text`: For reading text files.
48-
* `utcp-socket`: Scaffolding for TCP and UDP protocols. (Work in progress, requires update)
49-
* `utcp-gql`: Scaffolding for GraphQL. (Work in progress, requires update)
50-
51-
## Installation
52-
53-
Install the core library and any required protocol plugins.
41+
The [`core/`](core/) directory contains the foundational components:
42+
- **Data Models**: Pydantic models for `Tool`, `CallTemplate`, `UtcpManual`, and `Auth`
43+
- **Client Interface**: Main `UtcpClient` for tool interaction
44+
- **Plugin System**: Extensible interfaces for protocols, repositories, and search
45+
- **Default Implementations**: Built-in tool storage and search strategies
46+
47+
## Quick Start
48+
49+
### Installation
50+
51+
Install the core library and any required protocol plugins:
5452

5553
```bash
56-
# Install the core client and the HTTP plugin
54+
# Install core + HTTP plugin (most common)
5755
pip install utcp utcp-http
5856

59-
# Install the CLI plugin as well
60-
pip install utcp-cli
57+
# Install additional plugins as needed
58+
pip install utcp-cli utcp-mcp utcp-text
6159
```
6260

61+
### Basic Usage
62+
63+
```python
64+
from utcp.utcp_client import UtcpClient
65+
66+
# Create client with HTTP API
67+
client = await UtcpClient.create(config={
68+
"manual_call_templates": [{
69+
"name": "my_api",
70+
"call_template_type": "http",
71+
"url": "https://api.example.com/utcp"
72+
}]
73+
})
74+
75+
# Call a tool
76+
result = await client.call_tool("my_api.get_data", {"id": "123"})
77+
```
78+
79+
## Protocol Plugins
80+
81+
UTCP supports multiple communication protocols through dedicated plugins:
82+
83+
| Plugin | Description | Status | Documentation |
84+
|--------|-------------|--------|---------------|
85+
| [`utcp-http`](plugins/communication_protocols/http/) | HTTP/REST APIs, SSE, streaming | ✅ Stable | [HTTP Plugin README](plugins/communication_protocols/http/README.md) |
86+
| [`utcp-cli`](plugins/communication_protocols/cli/) | Command-line tools | ✅ Stable | [CLI Plugin README](plugins/communication_protocols/cli/README.md) |
87+
| [`utcp-mcp`](plugins/communication_protocols/mcp/) | Model Context Protocol | ✅ Stable | [MCP Plugin README](plugins/communication_protocols/mcp/README.md) |
88+
| [`utcp-text`](plugins/communication_protocols/text/) | Local file-based tools | ✅ Stable | [Text Plugin README](plugins/communication_protocols/text/README.md) |
89+
| [`utcp-socket`](plugins/communication_protocols/socket/) | TCP/UDP protocols | 🚧 In Progress | [Socket Plugin README](plugins/communication_protocols/socket/README.md) |
90+
| [`utcp-gql`](plugins/communication_protocols/gql/) | GraphQL APIs | 🚧 In Progress | [GraphQL Plugin README](plugins/communication_protocols/gql/README.md) |
91+
6392
For development, you can install the packages in editable mode from the cloned repository:
6493

6594
```bash

0 commit comments

Comments
 (0)