@@ -35,6 +35,7 @@ export interface MCPServer {
3535 toolName : string ,
3636 args : Record < string , unknown > | null ,
3737 ) : Promise < CallToolResultContent > ;
38+ invalidateToolsCache ( ) : Promise < void > ;
3839}
3940
4041export abstract class BaseMCPServerStdio implements MCPServer {
@@ -56,6 +57,7 @@ export abstract class BaseMCPServerStdio implements MCPServer {
5657 _toolName : string ,
5758 _args : Record < string , unknown > | null ,
5859 ) : Promise < CallToolResultContent > ;
60+ abstract invalidateToolsCache ( ) : Promise < void > ;
5961
6062 /**
6163 * Logs a debug message when debug logging is enabled.
@@ -89,6 +91,7 @@ export abstract class BaseMCPServerStreamableHttp implements MCPServer {
8991 _toolName : string ,
9092 _args : Record < string , unknown > | null ,
9193 ) : Promise < CallToolResultContent > ;
94+ abstract invalidateToolsCache ( ) : Promise < void > ;
9295
9396 /**
9497 * Logs a debug message when debug logging is enabled.
@@ -154,6 +157,9 @@ export class MCPServerStdio extends BaseMCPServerStdio {
154157 ) : Promise < CallToolResultContent > {
155158 return this . underlying . callTool ( toolName , args ) ;
156159 }
160+ invalidateToolsCache ( ) : Promise < void > {
161+ return this . underlying . invalidateToolsCache ( ) ;
162+ }
157163}
158164
159165export class MCPServerStreamableHttp extends BaseMCPServerStreamableHttp {
@@ -187,6 +193,9 @@ export class MCPServerStreamableHttp extends BaseMCPServerStreamableHttp {
187193 ) : Promise < CallToolResultContent > {
188194 return this . underlying . callTool ( toolName , args ) ;
189195 }
196+ invalidateToolsCache ( ) : Promise < void > {
197+ return this . underlying . invalidateToolsCache ( ) ;
198+ }
190199}
191200
192201/**
@@ -225,7 +234,7 @@ const _cachedTools: Record<string, MCPTool[]> = {};
225234 *
226235 * @param serverName - Name of the MCP server whose cache should be cleared.
227236 */
228- export function invalidateServerToolsCache ( serverName : string ) {
237+ export async function invalidateServerToolsCache ( serverName : string ) {
229238 delete _cachedTools [ serverName ] ;
230239}
231240/**
0 commit comments