Use simple name for MCP tools where possible. (#4459)

This commit is contained in:
Tommaso Sciortino
2025-07-18 14:29:09 -07:00
committed by GitHub
parent d7041a6595
commit b5f5ea2c31
6 changed files with 96 additions and 176 deletions

View File

@@ -210,35 +210,31 @@ describe('ToolRegistry', () => {
const mcpTool1_c = new DiscoveredMCPTool(
mockCallable,
server1Name,
`${server1Name}__zebra-tool`,
'zebra-tool',
'd1',
{},
'zebra-tool',
);
const mcpTool1_a = new DiscoveredMCPTool(
mockCallable,
server1Name,
`${server1Name}__apple-tool`,
'apple-tool',
'd2',
{},
'apple-tool',
);
const mcpTool1_b = new DiscoveredMCPTool(
mockCallable,
server1Name,
`${server1Name}__banana-tool`,
'banana-tool',
'd3',
{},
'banana-tool',
);
const mcpTool2 = new DiscoveredMCPTool(
mockCallable,
server2Name,
'server2Name__tool-on-server2',
'tool-on-server2',
'd4',
{},
'tool-on-server2',
);
const nonMcpTool = new MockTool('regular-tool');
@@ -253,11 +249,7 @@ describe('ToolRegistry', () => {
// Assert that the array has the correct tools and is sorted by name
expect(toolsFromServer1).toHaveLength(3);
expect(toolNames).toEqual([
`${server1Name}__apple-tool`,
`${server1Name}__banana-tool`,
`${server1Name}__zebra-tool`,
]);
expect(toolNames).toEqual(['apple-tool', 'banana-tool', 'zebra-tool']);
// Assert that all returned tools are indeed from the correct server
for (const tool of toolsFromServer1) {