ClientMCP

Implements IMCP

A client-side implementation of the IMCP interface for managing tools and their operations.

constructor(params: IMCPParams);
params: IMCPParams
fetchTools: any

Memoized function to fetch and cache tools for a given client ID.

listTools(clientId: string): Promise<IMCPTool<MCPToolProperties>[]>;

Lists all available tools for a given client.

hasTool(toolName: string, clientId: string): Promise<boolean>;

Checks if a specific tool exists for a given client.

updateToolsForClient(clientId: string): Promise<void>;

Updates the list of tools by clearing the cache and invoking the update callback.

updateToolsForAll(): Promise<void>;

Updates the list of tools for all clients by clearing the cache and invoking the update callback.

callTool<T extends MCPToolValue = MCPToolValue>(toolName: string, dto: IMCPToolCallDto<T>): Promise<MCPToolOutput>;

Calls a specific tool with the provided parameters.

dispose(clientId: string): void;

Disposes of resources associated with a client, clearing cached tools and invoking the dispose callback.