* 显示工具执行结果
(response: any)
| 365 | * 显示工具执行结果 |
| 366 | */ |
| 367 | function displayToolResult(response: any): void { |
| 368 | if (response.success) { |
| 369 | UIDisplay.success('工具执行成功'); |
| 370 | |
| 371 | if (response.data) { |
| 372 | UIDisplay.section('执行结果'); |
| 373 | if (typeof response.data === 'string') { |
| 374 | UIDisplay.text(response.data); |
| 375 | } else { |
| 376 | console.log(JSON.stringify(response.data, null, 2)); |
| 377 | } |
| 378 | } |
| 379 | |
| 380 | if (response.metadata) { |
| 381 | UIDisplay.section('元数据'); |
| 382 | console.log(JSON.stringify(response.metadata, null, 2)); |
| 383 | } |
| 384 | } else { |
| 385 | UIDisplay.error('工具执行失败'); |
| 386 | if (response.error) { |
| 387 | UIDisplay.text(`错误信息: ${response.error}`); |
| 388 | } |
| 389 | } |
| 390 | } |
| 391 | |
| 392 | /** |
| 393 | * 生成工具文档 |