Skip to content

Commit af4bf6c

Browse files
committed
updated toolbox
1 parent 50ecbb6 commit af4bf6c

File tree

3 files changed

+63
-2
lines changed

3 files changed

+63
-2
lines changed

Diff for: docs/api/agentlib/index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ cbapicategory:
88
description: Class for loading and managing AI system prompts from YAML files with key-based retrieval.
99
- name: taskInstructions
1010
link: /docs/api/agentlib/taskInstructions
11-
description:
11+
description: Encapsulates task instructions and their metadata, handling loading/processing from YAML files.
1212
- name: usermessage
1313
link: /docs/api/agentlib/usermessage
14-
description:
14+
description: Handles user message processing with file/environment context attachment
1515

1616
---
1717
# cbstate

Diff for: docs/api/toolbox/_category_.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"label": "Toolbox",
3+
"position": 2.5,
4+
"collapsible": true,
5+
"collapsed": true,
6+
"className": "red",
7+
"link": {
8+
"type": "doc",
9+
"id": "api/toolbox/toolbox"
10+
}
11+
}

Diff for: docs/api/toolbox/toolbox.md

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
name: ToolBox
3+
cbbaseinfo:
4+
description: A versatile server for managing and interacting with tools, resources, and prompts. Supports custom tools, resources, and prompts with `stdio` or `SSE` transport mechanisms.
5+
cbparameters:
6+
parameters:
7+
- name: options
8+
typeName: ServerOptions
9+
description: Configuration options for the ToolBox, including name, version, and authentication logic.
10+
returns:
11+
signatureTypeName: ToolBox
12+
description: A configured ToolBox instance for managing tools, resources, and prompts.
13+
typeArgs: []
14+
data:
15+
name: ToolBox
16+
category: server-management
17+
link: ToolBox.md
18+
---
19+
<CBBaseInfo/>
20+
<CBParameters/>
21+
22+
### Example
23+
24+
```typescript
25+
import { ToolBox } from './toolbox';
26+
import { z } from 'zod';
27+
28+
// Create a ToolBox instance
29+
const toolbox = new ToolBox({
30+
name: 'MyToolBox',
31+
version: '1.0.0',
32+
});
33+
34+
// Add a tool
35+
toolbox.addTool({
36+
name: 'greet',
37+
description: 'A tool to greet the user',
38+
parameters: z.object({ name: z.string() }),
39+
execute: async (args) => `Hello, ${args.name}!`,
40+
});
41+
42+
// Start the server with stdio transport
43+
await toolbox.start({ transportType: 'stdio' });
44+
45+
// Example usage of the tool
46+
const greeting = await toolbox.sessions[0].requestSampling({
47+
params: { name: 'Alice' },
48+
});
49+
50+
console.log("Greeting:", greeting);

0 commit comments

Comments
 (0)