Skip to content

Commit 4e090c3

Browse files
authored
Revise README for improved clarity and structure
Updated README.md to enhance clarity and organization of features, benefits, and installation instructions.
1 parent 424776a commit 4e090c3

File tree

1 file changed

+53
-9
lines changed

1 file changed

+53
-9
lines changed

README.md

Lines changed: 53 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,62 @@
22

33
[![npm](https://img.shields.io/npm/v/@utcp/code-mode)](https://www.npmjs.com/package/@utcp/code-mode)
44

5-
A plug-and-play library to enable agents to call MCP and UTCP tools via typescript code execution in 3 lines of code.
5+
**A plug-and-play library that lets agents call MCP and UTCP tools through TypeScript code - in just 3 lines.**
66

7-
## Features
7+
LLMs are far better at writing code than managing complex tool calls. Instead of exposing hundreds of tools directly to the model, Code Mode gives it a single tool. The model writes TypeScript/JavaScript that calls your MCP or UTCP tools via HTTP, enabling scalable, context-efficient orchestration.`execute_code`
88

9-
- **TypeScript Code Execution**: Execute TypeScript code snippets with full access to registered tools
10-
- **Hierarchical Tool Access**: Tools organized by manual namespace (e.g., `math_tools.add()`)
11-
- **Hierarchical Type Definitions**: TypeScript interfaces organized in namespaces matching tool structure
12-
- **Runtime Interface Access**: Access TypeScript interfaces at runtime for introspection
13-
- **Type Safety**: Generates proper TypeScript interfaces for all tool inputs and outputs
14-
- **Secure Execution**: Uses Node.js VM module for safe code execution with timeout support
15-
- **Chain Tool Calls**: Combine multiple tool calls in a single TypeScript code block
9+
## 🚀 Features
1610

11+
- **TypeScript Code Execution** – Run TypeScript with full access to registered MCP/UTCP tools
12+
- **Hierarchical Tool Access** – Tools organized by namespace (e.g. `math_tools.add()`)
13+
- **Auto-Generated Type Definitions** – Type-safe interfaces for tool inputs and outputs
14+
- **Runtime Interface Access** – Introspect TypeScript interfaces at runtime
15+
- **Secure Execution** – Node.js VM sandbox with timeout and resource limits
16+
- **Composable Calls – Chain** multiple tool calls within a single TypeScript code block
17+
18+
## 🧠 Why Code Mode
19+
20+
### The problem
21+
22+
Direct tool calling doesn't scale:
23+
24+
- Each tool definition consumes context tokens
25+
- Every intermediate result passes through the model
26+
27+
Connecting many MCP servers quickly overloads the context window and increases latency and cost.
28+
29+
### The approach
30+
31+
Code Mode flips this model:
32+
33+
1. The LLM gets a single tool: **`execute_code`**
34+
2. It writes JS/TS that calls your MCP pr UTCP endpoints
35+
3. A lightweight HTTP proxy forwards requests
36+
4. Results flow back through the execution environment
37+
38+
This leverages what LLMs excel at - **writing code** - while keeping tool orchestration efficient and stateless.
39+
40+
## 📦 Benefits
41+
42+
### 🧭 Progressive Disclosure
43+
44+
Tools can be explored like files on a filesystem — loaded only when needed. Agents can also search for tools dynamically () to keep context lean.`search_tools`
45+
46+
### 💾 Context Efficiency
47+
48+
Large datasets can be filtered, joined, or aggregated *in code* before returning results, saving thousands of tokens.
49+
50+
### 🔁 Smarter Control Flow
51+
52+
Loops, conditionals, and error handling happen naturally in code - not through multiple tool calls.
53+
54+
### 🔒 Privacy & Security
55+
56+
Intermediate results stay within the sandbox; sensitive data can be tokenized automatically before reaching the model.
57+
58+
### 🧱 State & Skills
59+
60+
Agents can persist data or reusable functions (), gradually building their own "skills" over time.`./skills/*.ts`
1761
## Installation
1862

1963
```bash

0 commit comments

Comments
 (0)