update at 2025-10-14 21:52:11
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type { MCPServerConfig, ServerCapabilities, Tool, Resource, Prompt } from '../types';
|
||||
import type { MCPServerConfig } from '../types';
|
||||
import type { ServerCapabilities, Tool, Resource, Prompt } from '../types/index';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { SSETransport } from './SSETransport';
|
||||
|
||||
@@ -302,6 +303,18 @@ export class MCPClientService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取服务器的工具列表
|
||||
*/
|
||||
getTools(serverId: string): Tool[] {
|
||||
const serverInfo = this.clients.get(serverId);
|
||||
if (!serverInfo) {
|
||||
console.warn(`服务器 ${serverId} 未连接`);
|
||||
return [];
|
||||
}
|
||||
return serverInfo.capabilities?.tools || [];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取提示
|
||||
*/
|
||||
@@ -361,7 +374,7 @@ export class MCPClientService {
|
||||
return false;
|
||||
}
|
||||
|
||||
const { client, config } = serverInfo;
|
||||
const { client } = serverInfo;
|
||||
|
||||
try {
|
||||
if (client.type === 'sse') {
|
||||
|
||||
Reference in New Issue
Block a user