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

Function showServerInfo

src/commands/mcp.ts:406–429  ·  view source on GitHub ↗

* 显示服务器信息

(client: MCPClient, sessionId: string)

Source from the content-addressed store, hash-verified

404 * 显示服务器信息
405 */
406async function showServerInfo(client: MCPClient, sessionId: string): Promise<void> {
407 try {
408 console.log(chalk.blue('\n📋 服务器信息:'));
409
410 // 列出资源
411 const resources = await client.listResources(sessionId);
412 console.log(chalk.green(`📁 可用资源 (${resources.length}):`));
413 resources.forEach(resource => {
414 console.log(chalk.gray(` • ${resource.name}: ${resource.description || resource.uri}`));
415 });
416
417 // 列出工具
418 const tools = await client.listTools(sessionId);
419 console.log(chalk.green(`🔧 可用工具 (${tools.length}):`));
420 tools.forEach(tool => {
421 console.log(chalk.gray(` • ${tool.name}: ${tool.description}`));
422 });
423 } catch (error) {
424 console.error(
425 chalk.red('❌ 获取服务器信息失败:'),
426 error instanceof Error ? error.message : error
427 );
428 }
429}
430
431/**
432 * 列出资源

Callers 1

mcpCommandFunction · 0.85

Calls 4

listResourcesMethod · 0.80
listToolsMethod · 0.80
logMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected