* 显示工具表格
(tools: ToolDefinition[])
| 286 | * 显示工具表格 |
| 287 | */ |
| 288 | function 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 | * 显示工具详细信息 |
no test coverage detected