Skip to content

Commit f61fd18

Browse files
authored
Do not cache the toolsList per default (#128)
1 parent 3f0f51b commit f61fd18

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

.changeset/ten-lizards-deny.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@openai/agents-core': minor
3+
---
4+
5+
Don't enable `cacheToolsList` per default for MCP servers

packages/agents-core/src/mcp.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export abstract class BaseMCPServerStdio implements MCPServer {
4545
constructor(options: MCPServerStdioOptions) {
4646
this.logger =
4747
options.logger ?? getLogger(DEFAULT_STDIO_MCP_CLIENT_LOGGER_NAME);
48-
this.cacheToolsList = options.cacheToolsList ?? true;
48+
this.cacheToolsList = options.cacheToolsList ?? false;
4949
}
5050

5151
abstract get name(): string;
@@ -78,7 +78,7 @@ export abstract class BaseMCPServerStreamableHttp implements MCPServer {
7878
this.logger =
7979
options.logger ??
8080
getLogger(DEFAULT_STREAMABLE_HTTP_MCP_CLIENT_LOGGER_NAME);
81-
this.cacheToolsList = options.cacheToolsList ?? true;
81+
this.cacheToolsList = options.cacheToolsList ?? false;
8282
}
8383

8484
abstract get name(): string;

packages/agents-core/test/mcpCache.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class StubServer extends NodeMCPServerStdio {
99
constructor(name: string, tools: any[]) {
1010
super({ command: 'noop', name });
1111
this.toolList = tools;
12+
this.cacheToolsList = true;
1213
}
1314
async connect(): Promise<void> {}
1415
async close(): Promise<void> {}

0 commit comments

Comments
 (0)