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

Function displayToolsTable

src/commands/tools.ts:288–315  ·  view source on GitHub ↗

* 显示工具表格

(tools: ToolDefinition[])

Source from the content-addressed store, hash-verified

286 * 显示工具表格
287 */
288function displayToolsTable(tools: ToolDefinition[]): void {
289 UIDisplay.section('🔧 可用工具列表');
290
291 // 按分类分组
292 const categories = tools.reduce(
293 (acc, tool) => {
294 const category = tool.category || '其他';
295 if (!acc[category]) acc[category] = [];
296 acc[category].push(tool);
297 return acc;
298 },
299 {} as Record<string, ToolDefinition[]>
300 );
301
302 Object.entries(categories).forEach(([category, categoryTools]) => {
303 UIDisplay.section(category);
304
305 const toolList = categoryTools.map(tool => {
306 const tags = tool.tags?.length ? ` (${tool.tags.join(', ')})` : '';
307 return `${tool.name}: ${tool.description}${tags}`;
308 });
309
310 UIList.simple(toolList);
311 UIDisplay.newline();
312 });
313
314 UIDisplay.info(`共找到 ${tools.length} 个工具`);
315}
316
317/**
318 * 显示工具详细信息

Callers 1

toolsCommandFunction · 0.85

Calls 4

sectionMethod · 0.80
simpleMethod · 0.80
newlineMethod · 0.80
infoMethod · 0.45

Tested by

no test coverage detected