Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions packages/core/src/tools/mcp-client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1244,9 +1244,15 @@ describe('mcp-client', () => {
await client.disconnect();

expect(mockedClient.close).toHaveBeenCalledOnce();
expect(mockedToolRegistry.removeMcpToolsByServer).toHaveBeenCalledOnce();
expect(mockedPromptRegistry.removePromptsByServer).toHaveBeenCalledOnce();
expect(resourceRegistry.removeResourcesByServer).toHaveBeenCalledOnce();
expect(mockedToolRegistry.removeMcpToolsByServer).toHaveBeenCalledWith(
'test-server',
);
expect(mockedPromptRegistry.removePromptsByServer).toHaveBeenCalledWith(
'test-server',
);
expect(resourceRegistry.removeResourcesByServer).toHaveBeenCalledWith(
'test-server',
);
});
});

Expand Down Expand Up @@ -1570,8 +1576,8 @@ describe('mcp-client', () => {
// Trigger notification - should fail internally but catch the error
await notificationCallback();

// Should try to remove tools
expect(mockedToolRegistry.removeMcpToolsByServer).toHaveBeenCalled();
// Should NOT try to remove tools because discovery failed (atomic refresh)
expect(mockedToolRegistry.removeMcpToolsByServer).not.toHaveBeenCalled();

// Should NOT emit success feedback
expect(coreEvents.emitFeedback).not.toHaveBeenCalledWith(
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/tools/mcp-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1404,6 +1404,7 @@ export async function discoverTools(
error,
mcpServerName,
);
throw error;
}
return [];
}
Expand Down
Loading