MCPcopy Create free account
hub / github.com/echoVic/blade-code / basicExample

Function basicExample

examples/tools-example.ts:13–41  ·  view source on GitHub ↗

* 基础使用示例

()

Source from the content-addressed store, hash-verified

11 * 基础使用示例
12 */
13async function basicExample() {
14 console.log('=== 基础使用示例 ===\n');
15
16 // 创建工具管理器
17 const toolManager = await createToolManager({
18 debug: true,
19 maxConcurrency: 5,
20 });
21
22 // 获取所有工具
23 const tools = toolManager.getTools();
24 console.log(`已加载 ${tools.length} 个工具\n`);
25
26 // 按分类显示工具
27 const categories = tools.reduce(
28 (acc, tool) => {
29 const category = tool.category || 'other';
30 if (!acc[category]) acc[category] = [];
31 acc[category].push(tool.name);
32 return acc;
33 },
34 {} as Record<string, string[]>
35 );
36
37 for (const [category, toolNames] of Object.entries(categories)) {
38 console.log(`${category}: ${toolNames.join(', ')}`);
39 }
40 console.log('');
41}
42
43/**
44 * 文本处理工具示例

Callers 1

mainFunction · 0.85

Calls 3

createToolManagerFunction · 0.85
logMethod · 0.45
getToolsMethod · 0.45

Tested by

no test coverage detected