Skip to content

Commit db89ade

Browse files
authored
Merge pull request #9 from universal-tool-calling-protocol/dev
v1.0
2 parents b02a2c1 + d13bade commit db89ade

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+3126
-597
lines changed

README.md

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ UTCP offers a unified framework for integrating disparate tools and services, ma
1414
* **Automatic Plugin Registration**: The official plugins are automatically discovered and registered when you import the core client—no manual setup required. For other plugins, you will need to register them manually.
1515
* **Scalability**: Designed to handle a large number of tools and providers without compromising performance.
1616
* **Extensibility**: A pluggable architecture allows developers to easily add new communication protocols, tool storage mechanisms, and search strategies without modifying the core library.
17-
* **Interoperability**: With a growing ecosystem of protocol plugins—including HTTP, MCP, Text, and CLI—UTCP can integrate with almost any existing service or infrastructure.
17+
* **Interoperability**: With a growing ecosystem of protocol plugins—including HTTP, MCP, Text, File, and CLI—UTCP can integrate with almost any existing service or infrastructure.
1818
* **Type Safety**: Built on well-defined TypeScript interfaces and runtime validation powered by Zod, making it robust and developer-friendly.
1919
* **Secure Variable Management**: Namespace-isolated variables prevent leakage between manuals, with support for environment variables and .env files.
2020

@@ -28,10 +28,13 @@ Install UTCP packages from npm:
2828

2929
```bash
3030
# Install core SDK and desired protocol plugins
31-
npm install @utcp/sdk @utcp/http @utcp/mcp @utcp/text
31+
npm install @utcp/sdk @utcp/http @utcp/mcp @utcp/text @utcp/file
32+
33+
# Optional: Add dotenv variable loader for Node.js
34+
npm install @utcp/dotenv-loader
3235

3336
# Or using bun
34-
bun add @utcp/sdk @utcp/http @utcp/mcp @utcp/text
37+
bun add @utcp/sdk @utcp/http @utcp/mcp @utcp/text @utcp/file
3538
```
3639

3740
### For Development
@@ -98,13 +101,13 @@ main().catch(console.error);
98101
import { UtcpClient } from '@utcp/sdk';
99102
import { HttpCallTemplateSerializer } from '@utcp/http';
100103
import { McpCallTemplateSerializer } from '@utcp/mcp';
101-
import { TextCallTemplateSerializer } from '@utcp/text';
104+
import { FileCallTemplateSerializer } from '@utcp/file';
102105

103106
async function main() {
104107
// Create serializers for each protocol
105108
const httpSerializer = new HttpCallTemplateSerializer();
106109
const mcpSerializer = new McpCallTemplateSerializer();
107-
const textSerializer = new TextCallTemplateSerializer();
110+
const fileSerializer = new FileCallTemplateSerializer();
108111

109112
// Validate and create call templates
110113
const httpTemplate = httpSerializer.validateDict({
@@ -132,9 +135,9 @@ async function main() {
132135
}
133136
});
134137

135-
const textTemplate = textSerializer.validateDict({
138+
const fileTemplate = fileSerializer.validateDict({
136139
name: 'local_tools',
137-
call_template_type: 'text',
140+
call_template_type: 'file',
138141
file_path: './config/tools.json'
139142
});
140143

@@ -152,7 +155,7 @@ async function main() {
152155
manual_call_templates: [
153156
httpTemplate, // HTTP API
154157
mcpTemplate, // MCP Server
155-
textTemplate // Local file-based tools
158+
fileTemplate // Local file-based tools
156159
]
157160
});
158161

@@ -383,15 +386,34 @@ const mcpTemplate = serializer.validateDict({
383386

384387
### Text Protocol
385388

386-
Load tools from local JSON/YAML files or OpenAPI specs:
389+
Handle direct text/string content (browser-compatible):
387390

388391
```typescript
389392
import { TextCallTemplateSerializer } from '@utcp/text';
390393

391394
const serializer = new TextCallTemplateSerializer();
392395
const textTemplate = serializer.validateDict({
393-
name: 'local_tools',
396+
name: 'inline_tools',
394397
call_template_type: 'text',
398+
content: JSON.stringify({
399+
tools: [
400+
// UTCP manual or OpenAPI spec as string
401+
]
402+
})
403+
});
404+
```
405+
406+
### File Protocol
407+
408+
Load tools from local JSON/YAML files or OpenAPI specs (Node.js only):
409+
410+
```typescript
411+
import { FileCallTemplateSerializer } from '@utcp/file';
412+
413+
const serializer = new FileCallTemplateSerializer();
414+
const fileTemplate = serializer.validateDict({
415+
name: 'local_tools',
416+
call_template_type: 'file',
395417
file_path: './config/tools.json'
396418
// Supports: .json, .yaml, .yml, OpenAPI specs
397419
});
@@ -425,7 +447,10 @@ typescript-utcp/
425447
│ ├── core/ # Core SDK with UtcpClient and interfaces
426448
│ ├── http/ # HTTP protocol plugin
427449
│ ├── mcp/ # MCP protocol plugin
428-
│ ├── text/ # Text/file protocol plugin
450+
│ ├── text/ # Text/string content protocol plugin (browser-compatible)
451+
│ ├── file/ # File system protocol plugin (Node.js only)
452+
│ ├── dotenv-loader/ # DotEnv variable loader plugin (Node.js only)
453+
│ ├── direct-call/ # Direct call protocol plugin
429454
│ └── cli/ # CLI protocol plugin
430455
├── tests/ # End-to-end integration tests
431456
└── README.md
@@ -435,7 +460,10 @@ Each package is independently published to npm:
435460
- `@utcp/sdk` - Core SDK library (required)
436461
- `@utcp/http` - HTTP protocol support
437462
- `@utcp/mcp` - MCP protocol support
438-
- `@utcp/text` - File-based tools
463+
- `@utcp/text` - Direct text/string content (browser-compatible)
464+
- `@utcp/file` - File system operations (Node.js only)
465+
- `@utcp/dotenv-loader` - DotEnv variable loader (Node.js only)
466+
- `@utcp/direct-call` - Direct function call protocol
439467
- `@utcp/cli` - Command-line tools
440468

441469
## Development & Testing

bun.lock

Lines changed: 50 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
"packages/cli": {
1919
"name": "@utcp/cli",
20-
"version": "1.0.4",
20+
"version": "1.0.6",
2121
"dependencies": {
2222
"@utcp/sdk": "^1.0.4",
2323
},
@@ -29,7 +29,7 @@
2929
},
3030
"packages/core": {
3131
"name": "@utcp/sdk",
32-
"version": "1.0.5",
32+
"version": "1.0.8",
3333
"dependencies": {
3434
"dotenv": "^17.2.1",
3535
"zod": "^3.23.8",
@@ -41,7 +41,7 @@
4141
},
4242
"packages/direct-call": {
4343
"name": "@utcp/direct-call",
44-
"version": "1.0.0",
44+
"version": "1.0.1",
4545
"dependencies": {
4646
"@utcp/sdk": "^1.0.4",
4747
},
@@ -51,11 +51,40 @@
5151
"typescript": "^5.0.0",
5252
},
5353
},
54+
"packages/dotenv-loader": {
55+
"name": "@utcp/dotenv-loader",
56+
"version": "1.0.0",
57+
"dependencies": {
58+
"dotenv": "^17.2.1",
59+
"zod": "^3.23.8",
60+
},
61+
"devDependencies": {
62+
"bun-types": "latest",
63+
"typescript": "^5.0.0",
64+
},
65+
"peerDependencies": {
66+
"@utcp/sdk": "^1.0.8",
67+
},
68+
},
69+
"packages/file": {
70+
"name": "@utcp/file",
71+
"version": "1.0.0",
72+
"dependencies": {
73+
"@utcp/http": "^1.0.7",
74+
"@utcp/sdk": "^1.0.8",
75+
"js-yaml": "^4.1.0",
76+
},
77+
"devDependencies": {
78+
"@types/bun": "latest",
79+
"bun-types": "latest",
80+
"typescript": "^5.0.0",
81+
},
82+
},
5483
"packages/http": {
5584
"name": "@utcp/http",
56-
"version": "1.0.4",
85+
"version": "1.0.8",
5786
"dependencies": {
58-
"@utcp/sdk": "^1.0.4",
87+
"@utcp/sdk": "^1.0.6",
5988
"axios": "^1.11.0",
6089
"js-yaml": "^4.1.0",
6190
},
@@ -67,7 +96,7 @@
6796
},
6897
"packages/mcp": {
6998
"name": "@utcp/mcp",
70-
"version": "1.0.4",
99+
"version": "1.0.6",
71100
"dependencies": {
72101
"@modelcontextprotocol/sdk": "^1.17.4",
73102
"@utcp/sdk": "^1.0.4",
@@ -82,12 +111,13 @@
82111
},
83112
"packages/text": {
84113
"name": "@utcp/text",
85-
"version": "1.0.4",
114+
"version": "1.0.11",
86115
"dependencies": {
87-
"@utcp/sdk": "^1.0.4",
116+
"@utcp/http": "^1.0.8",
117+
"@utcp/sdk": "^1.0.8",
118+
"js-yaml": "^4.1.0",
88119
},
89120
"devDependencies": {
90-
"@types/bun": "latest",
91121
"bun-types": "latest",
92122
"typescript": "^5.0.0",
93123
},
@@ -229,6 +259,10 @@
229259

230260
"@utcp/direct-call": ["@utcp/direct-call@workspace:packages/direct-call"],
231261

262+
"@utcp/dotenv-loader": ["@utcp/dotenv-loader@workspace:packages/dotenv-loader"],
263+
264+
"@utcp/file": ["@utcp/file@workspace:packages/file"],
265+
232266
"@utcp/http": ["@utcp/http@workspace:packages/http"],
233267

234268
"@utcp/mcp": ["@utcp/mcp@workspace:packages/mcp"],
@@ -591,13 +625,17 @@
591625

592626
"@utcp/direct-call/bun-types": ["[email protected]", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-u8X0thhx+yJ0KmkxuEo9HAtdfgCBaM/aI9K90VQcQioAmkVp3SG3FkwWGibUFz3WdXAdcsqOcbU40lK7tbHdkQ=="],
593627

594-
"@utcp/http/bun-types": ["[email protected]", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-u8X0thhx+yJ0KmkxuEo9HAtdfgCBaM/aI9K90VQcQioAmkVp3SG3FkwWGibUFz3WdXAdcsqOcbU40lK7tbHdkQ=="],
628+
"@utcp/dotenv-loader/bun-types": ["[email protected]", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-NMrcy7smratanWJ2mMXdpatalovtxVggkj11bScuWuiOoXTiKIu2eVS1/7qbyI/4yHedtsn175n4Sm4JcdHLXw=="],
629+
630+
"@utcp/file/bun-types": ["[email protected]", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-NMrcy7smratanWJ2mMXdpatalovtxVggkj11bScuWuiOoXTiKIu2eVS1/7qbyI/4yHedtsn175n4Sm4JcdHLXw=="],
631+
632+
"@utcp/http/bun-types": ["[email protected]", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-NMrcy7smratanWJ2mMXdpatalovtxVggkj11bScuWuiOoXTiKIu2eVS1/7qbyI/4yHedtsn175n4Sm4JcdHLXw=="],
595633

596634
"@utcp/mcp/bun-types": ["[email protected]", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-u8X0thhx+yJ0KmkxuEo9HAtdfgCBaM/aI9K90VQcQioAmkVp3SG3FkwWGibUFz3WdXAdcsqOcbU40lK7tbHdkQ=="],
597635

598-
"@utcp/sdk/bun-types": ["[email protected].0", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-u8X0thhx+yJ0KmkxuEo9HAtdfgCBaM/aI9K90VQcQioAmkVp3SG3FkwWGibUFz3WdXAdcsqOcbU40lK7tbHdkQ=="],
636+
"@utcp/sdk/bun-types": ["[email protected].1", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-NMrcy7smratanWJ2mMXdpatalovtxVggkj11bScuWuiOoXTiKIu2eVS1/7qbyI/4yHedtsn175n4Sm4JcdHLXw=="],
599637

600-
"@utcp/text/bun-types": ["[email protected].0", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-u8X0thhx+yJ0KmkxuEo9HAtdfgCBaM/aI9K90VQcQioAmkVp3SG3FkwWGibUFz3WdXAdcsqOcbU40lK7tbHdkQ=="],
638+
"@utcp/text/bun-types": ["[email protected].1", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-NMrcy7smratanWJ2mMXdpatalovtxVggkj11bScuWuiOoXTiKIu2eVS1/7qbyI/4yHedtsn175n4Sm4JcdHLXw=="],
601639

602640
"accepts/mime-types": ["[email protected]", "", { "dependencies": { "mime-db": "^1.54.0" } }, "sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA=="],
603641

0 commit comments

Comments
 (0)