Skip to content

Commit a5ff923

Browse files
committed
lint'n'test against normalized names!
1 parent ae00ce4 commit a5ff923

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

packages/app/src/server/mcp-server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -685,9 +685,9 @@ export const createServerFactory = (_webServerInstance: WebServer, sharedApiClie
685685

686686
// Remove the completions capability that was auto-added by prompt registration
687687
// The MCP SDK automatically adds this when prompts are registered, but we don't want it
688-
// @ts-ignore - accessing private property to remove unwanted capability
688+
// @ts-expect-error
689689
if (server.server._capabilities?.completions) {
690-
// @ts-ignore
690+
// @ts-expect-error
691691
delete server.server._capabilities.completions;
692692
logger.debug('Removed auto-added completions capability');
693693
}

packages/app/test/server/utils/tool-selection-strategy.test.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import type { AppSettings } from '../../../src/shared/settings.js';
1010
import type { TransportInfo } from '../../../src/shared/transport-info.js';
1111
import { ALL_BUILTIN_TOOL_IDS, TOOL_ID_GROUPS } from '@llmindset/hf-mcp';
1212
import { extractAuthBouquetAndMix } from '../../../src/server/utils/auth-utils.js';
13+
import { normalizeBuiltInTools } from '../../../src/shared/tool-normalizer.js';
1314

1415
describe('extractBouquetAndMix', () => {
1516
it('should extract bouquet from headers', () => {
@@ -169,7 +170,7 @@ describe('ToolSelectionStrategy', () => {
169170
const result = await strategy.selectTools(context);
170171

171172
expect(result.mode).toBe(ToolSelectionMode.BOUQUET_OVERRIDE);
172-
expect(result.enabledToolIds).toEqual(ALL_BUILTIN_TOOL_IDS);
173+
expect(result.enabledToolIds).toEqual(normalizeBuiltInTools(ALL_BUILTIN_TOOL_IDS));
173174
expect(result.reason).toBe('Bouquet override: all');
174175
});
175176

@@ -183,7 +184,7 @@ describe('ToolSelectionStrategy', () => {
183184

184185
// Should fall through to fallback since no valid bouquet or user settings
185186
expect(result.mode).toBe(ToolSelectionMode.FALLBACK);
186-
expect(result.enabledToolIds).toEqual(ALL_BUILTIN_TOOL_IDS);
187+
expect(result.enabledToolIds).toEqual(normalizeBuiltInTools(ALL_BUILTIN_TOOL_IDS));
187188
});
188189

189190
it('should prefer bouquet over mix when both are present', async () => {
@@ -287,7 +288,7 @@ describe('ToolSelectionStrategy', () => {
287288

288289
// Should fall through to fallback since no user settings to mix with
289290
expect(result.mode).toBe(ToolSelectionMode.FALLBACK);
290-
expect(result.enabledToolIds).toEqual(ALL_BUILTIN_TOOL_IDS);
291+
expect(result.enabledToolIds).toEqual(normalizeBuiltInTools(ALL_BUILTIN_TOOL_IDS));
291292
});
292293

293294
it('should ignore invalid mix bouquet names', async () => {
@@ -380,7 +381,7 @@ describe('ToolSelectionStrategy', () => {
380381
const result = await strategy.selectTools(context);
381382

382383
expect(result.mode).toBe(ToolSelectionMode.FALLBACK);
383-
expect(result.enabledToolIds).toEqual(ALL_BUILTIN_TOOL_IDS);
384+
expect(result.enabledToolIds).toEqual(normalizeBuiltInTools(ALL_BUILTIN_TOOL_IDS));
384385
expect(result.reason).toBe('Fallback - no settings available');
385386
expect(result.baseSettings).toBeUndefined();
386387
});
@@ -394,7 +395,7 @@ describe('ToolSelectionStrategy', () => {
394395
const result = await strategy.selectTools(context);
395396

396397
expect(result.mode).toBe(ToolSelectionMode.FALLBACK);
397-
expect(result.enabledToolIds).toEqual(ALL_BUILTIN_TOOL_IDS);
398+
expect(result.enabledToolIds).toEqual(normalizeBuiltInTools(ALL_BUILTIN_TOOL_IDS));
398399
});
399400
});
400401

@@ -457,7 +458,7 @@ describe('ToolSelectionStrategy', () => {
457458
expect(result.mixedBouquet).toBe(bouquetName);
458459

459460
const expectedTools = [...new Set([...userSettings.builtInTools, ...bouquetConfig.builtInTools])];
460-
expect(result.enabledToolIds).toEqual(expectedTools);
461+
expect(result.enabledToolIds).toEqual(normalizeBuiltInTools(expectedTools));
461462
}
462463
});
463464

@@ -494,7 +495,7 @@ describe('ToolSelectionStrategy', () => {
494495

495496
// Should get user's minimal tools + ALL built-in tools (deduplicated)
496497
const expectedBuiltInTools = [...new Set([...userSettings.builtInTools, ...ALL_BUILTIN_TOOL_IDS])];
497-
expect(result.enabledToolIds).toEqual(expectedBuiltInTools);
498+
expect(result.enabledToolIds).toEqual(normalizeBuiltInTools(expectedBuiltInTools));
498499

499500
// Should preserve base settings including gradio endpoints
500501
expect(result.baseSettings).toEqual(userSettings);

0 commit comments

Comments
 (0)