🏷️ fix: Add user ID to MCP tools cache keys (#10201)

* add user id to mcp tools cache key

* tests

* clean up redundant tests

* remove unused imports
This commit is contained in:
Federico Ruggi 2025-10-30 22:09:56 +01:00 committed by GitHub
parent 8f4705f683
commit ea45d0b9c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 52 additions and 30 deletions

View file

@ -1931,7 +1931,7 @@ describe('models/Agent', () => {
});
// Mock getMCPServerTools to return tools for each server
getMCPServerTools.mockImplementation(async (server) => {
getMCPServerTools.mockImplementation(async (_userId, server) => {
if (server === 'server1') {
return { tool1_mcp_server1: {} };
} else if (server === 'server2') {
@ -2125,7 +2125,7 @@ describe('models/Agent', () => {
getCachedTools.mockResolvedValue(availableTools);
// Mock getMCPServerTools to return all tools for server1
getMCPServerTools.mockImplementation(async (server) => {
getMCPServerTools.mockImplementation(async (_userId, server) => {
if (server === 'server1') {
return availableTools; // All 100 tools belong to server1
}
@ -2674,7 +2674,7 @@ describe('models/Agent', () => {
});
// Mock getMCPServerTools to return only tools matching the server
getMCPServerTools.mockImplementation(async (server) => {
getMCPServerTools.mockImplementation(async (_userId, server) => {
if (server === 'server1') {
// Only return tool that correctly matches server1 format
return { tool_mcp_server1: {} };