Skip to content

Commit 0b57cb9

Browse files
Move GetMapboxDocSourceTool to RESOURCE_FALLBACK_TOOLS
The get_latest_mapbox_docs_tool duplicates functionality of the resource://mapbox-documentation resource. It should only be available to clients that don't properly support resources. Changes: - Move GetMapboxDocSourceTool from CORE_TOOLS to RESOURCE_FALLBACK_TOOLS - CORE_TOOLS now has 24 tools (down from 25) - RESOURCE_FALLBACK_TOOLS now has 2 tools (up from 1): * get_reference_tool (reference resources) * get_latest_mapbox_docs_tool (documentation resource) - Update tests to reflect new categorization - Add test for get_latest_mapbox_docs_tool in resource fallback tools Clients that properly support resources will no longer see this tool, reducing clutter in their tool list. All 536 tests pass. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 5a59eb2 commit 0b57cb9

2 files changed

Lines changed: 20 additions & 7 deletions

File tree

src/tools/toolRegistry.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ export const CORE_TOOLS = [
5252
new CoordinateConversionTool(),
5353
new GetFeedbackTool({ httpRequest }),
5454
new ListFeedbackTool({ httpRequest }),
55-
new GetMapboxDocSourceTool({ httpRequest }),
5655
new TilequeryTool({ httpRequest }),
5756
new ValidateExpressionTool(),
5857
new ValidateGeojsonTool(),
@@ -73,11 +72,17 @@ export const ELICITATION_TOOLS = [] as const;
7372
* Tools that serve as bridges/workarounds for missing resource support
7473
* These tools are only registered if client does NOT support resources properly
7574
*
76-
* Context: GetReferenceTool exists as a workaround for Claude Desktop's limitation
77-
* where it can list resources but doesn't automatically fetch them. Clients that
78-
* properly support resources don't need this bridge tool.
75+
* Context: These tools exist as workarounds for clients (like Claude Desktop) that
76+
* can list resources but don't automatically fetch them. Clients that properly
77+
* support resources don't need these bridge tools.
78+
*
79+
* - GetReferenceTool: Provides access to reference resources (style layers, Streets v8 fields, token scopes, layer type mapping)
80+
* - GetMapboxDocSourceTool: Provides access to Mapbox documentation (resource://mapbox-documentation)
7981
*/
80-
export const RESOURCE_FALLBACK_TOOLS = [new GetReferenceTool()] as const;
82+
export const RESOURCE_FALLBACK_TOOLS = [
83+
new GetReferenceTool(),
84+
new GetMapboxDocSourceTool({ httpRequest })
85+
] as const;
8186

8287
/**
8388
* All tools combined (for backward compatibility and testing)

test/tools/toolRegistry.test.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ describe('Tool Registry', () => {
4444

4545
// Resource fallback tools should not be in core
4646
expect(toolNames).not.toContain('get_reference_tool');
47+
expect(toolNames).not.toContain('get_latest_mapbox_docs_tool');
4748
});
4849
});
4950

@@ -70,14 +71,20 @@ describe('Tool Registry', () => {
7071
it('should return an array of resource fallback tools', () => {
7172
const resourceFallbackTools = getResourceFallbackTools();
7273
expect(Array.isArray(resourceFallbackTools)).toBe(true);
73-
expect(resourceFallbackTools.length).toBe(1);
74+
expect(resourceFallbackTools.length).toBe(2);
7475
});
7576

7677
it('should include get_reference_tool', () => {
7778
const resourceFallbackTools = getResourceFallbackTools();
7879
const toolNames = resourceFallbackTools.map((tool) => tool.name);
7980
expect(toolNames).toContain('get_reference_tool');
8081
});
82+
83+
it('should include get_latest_mapbox_docs_tool', () => {
84+
const resourceFallbackTools = getResourceFallbackTools();
85+
const toolNames = resourceFallbackTools.map((tool) => tool.name);
86+
expect(toolNames).toContain('get_latest_mapbox_docs_tool');
87+
});
8188
});
8289

8390
describe('getAllTools', () => {
@@ -109,8 +116,9 @@ describe('Tool Registry', () => {
109116
// Core tools
110117
expect(toolNames).toContain('list_styles_tool');
111118
expect(toolNames).toContain('preview_style_tool');
112-
// Resource fallback tool
119+
// Resource fallback tools
113120
expect(toolNames).toContain('get_reference_tool');
121+
expect(toolNames).toContain('get_latest_mapbox_docs_tool');
114122
// Note: No elicitation tools yet (empty array)
115123
});
116124
});

0 commit comments

Comments
 (0)