@mapbox/mcp-docs-server 0.1.0-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +196 -0
- package/dist/commonjs/config/toolConfig.d.ts +8 -0
- package/dist/commonjs/config/toolConfig.d.ts.map +1 -0
- package/dist/commonjs/config/toolConfig.js +41 -0
- package/dist/commonjs/config/toolConfig.js.map +1 -0
- package/dist/commonjs/constants/mapboxStreetsV8Fields.trimmed.d.ts +306 -0
- package/dist/commonjs/constants/mapboxStreetsV8Fields.trimmed.d.ts.map +1 -0
- package/dist/commonjs/constants/mapboxStreetsV8Fields.trimmed.js +2069 -0
- package/dist/commonjs/constants/mapboxStreetsV8Fields.trimmed.js.map +1 -0
- package/dist/commonjs/index.d.ts +2 -0
- package/dist/commonjs/index.d.ts.map +1 -0
- package/dist/commonjs/index.js +82 -0
- package/dist/commonjs/index.js.map +1 -0
- package/dist/commonjs/package.json +3 -0
- package/dist/commonjs/resources/BaseResource.d.ts +21 -0
- package/dist/commonjs/resources/BaseResource.d.ts.map +1 -0
- package/dist/commonjs/resources/BaseResource.js +21 -0
- package/dist/commonjs/resources/BaseResource.js.map +1 -0
- package/dist/commonjs/resources/index.d.ts +3 -0
- package/dist/commonjs/resources/index.d.ts.map +1 -0
- package/dist/commonjs/resources/index.js +9 -0
- package/dist/commonjs/resources/index.js.map +1 -0
- package/dist/commonjs/resources/mapbox-api-reference-resource/MapboxApiReferenceResource.d.ts +19 -0
- package/dist/commonjs/resources/mapbox-api-reference-resource/MapboxApiReferenceResource.d.ts.map +1 -0
- package/dist/commonjs/resources/mapbox-api-reference-resource/MapboxApiReferenceResource.js +61 -0
- package/dist/commonjs/resources/mapbox-api-reference-resource/MapboxApiReferenceResource.js.map +1 -0
- package/dist/commonjs/resources/mapbox-documentation-resource/MapboxDocumentationResource.d.ts +29 -0
- package/dist/commonjs/resources/mapbox-documentation-resource/MapboxDocumentationResource.d.ts.map +1 -0
- package/dist/commonjs/resources/mapbox-documentation-resource/MapboxDocumentationResource.js +66 -0
- package/dist/commonjs/resources/mapbox-documentation-resource/MapboxDocumentationResource.js.map +1 -0
- package/dist/commonjs/resources/mapbox-examples-resource/MapboxExamplesResource.d.ts +19 -0
- package/dist/commonjs/resources/mapbox-examples-resource/MapboxExamplesResource.d.ts.map +1 -0
- package/dist/commonjs/resources/mapbox-examples-resource/MapboxExamplesResource.js +61 -0
- package/dist/commonjs/resources/mapbox-examples-resource/MapboxExamplesResource.js.map +1 -0
- package/dist/commonjs/resources/mapbox-guides-resource/MapboxGuidesResource.d.ts +19 -0
- package/dist/commonjs/resources/mapbox-guides-resource/MapboxGuidesResource.d.ts.map +1 -0
- package/dist/commonjs/resources/mapbox-guides-resource/MapboxGuidesResource.js +61 -0
- package/dist/commonjs/resources/mapbox-guides-resource/MapboxGuidesResource.js.map +1 -0
- package/dist/commonjs/resources/mapbox-layer-type-mapping-resource/MapboxLayerTypeMappingResource.d.ts +19 -0
- package/dist/commonjs/resources/mapbox-layer-type-mapping-resource/MapboxLayerTypeMappingResource.d.ts.map +1 -0
- package/dist/commonjs/resources/mapbox-layer-type-mapping-resource/MapboxLayerTypeMappingResource.js +170 -0
- package/dist/commonjs/resources/mapbox-layer-type-mapping-resource/MapboxLayerTypeMappingResource.js.map +1 -0
- package/dist/commonjs/resources/mapbox-reference-resource/MapboxReferenceResource.d.ts +19 -0
- package/dist/commonjs/resources/mapbox-reference-resource/MapboxReferenceResource.d.ts.map +1 -0
- package/dist/commonjs/resources/mapbox-reference-resource/MapboxReferenceResource.js +61 -0
- package/dist/commonjs/resources/mapbox-reference-resource/MapboxReferenceResource.js.map +1 -0
- package/dist/commonjs/resources/mapbox-sdk-docs-resource/MapboxSdkDocsResource.d.ts +19 -0
- package/dist/commonjs/resources/mapbox-sdk-docs-resource/MapboxSdkDocsResource.d.ts.map +1 -0
- package/dist/commonjs/resources/mapbox-sdk-docs-resource/MapboxSdkDocsResource.js +61 -0
- package/dist/commonjs/resources/mapbox-sdk-docs-resource/MapboxSdkDocsResource.js.map +1 -0
- package/dist/commonjs/resources/mapbox-streets-v8-fields-resource/MapboxStreetsV8FieldsResource.d.ts +19 -0
- package/dist/commonjs/resources/mapbox-streets-v8-fields-resource/MapboxStreetsV8FieldsResource.d.ts.map +1 -0
- package/dist/commonjs/resources/mapbox-streets-v8-fields-resource/MapboxStreetsV8FieldsResource.js +30 -0
- package/dist/commonjs/resources/mapbox-streets-v8-fields-resource/MapboxStreetsV8FieldsResource.js.map +1 -0
- package/dist/commonjs/resources/mapbox-style-layers-resource/MapboxStyleLayersResource.d.ts +20 -0
- package/dist/commonjs/resources/mapbox-style-layers-resource/MapboxStyleLayersResource.d.ts.map +1 -0
- package/dist/commonjs/resources/mapbox-style-layers-resource/MapboxStyleLayersResource.js +323 -0
- package/dist/commonjs/resources/mapbox-style-layers-resource/MapboxStyleLayersResource.js.map +1 -0
- package/dist/commonjs/resources/mapbox-token-scopes-resource/MapboxTokenScopesResource.d.ts +20 -0
- package/dist/commonjs/resources/mapbox-token-scopes-resource/MapboxTokenScopesResource.d.ts.map +1 -0
- package/dist/commonjs/resources/mapbox-token-scopes-resource/MapboxTokenScopesResource.js +108 -0
- package/dist/commonjs/resources/mapbox-token-scopes-resource/MapboxTokenScopesResource.js.map +1 -0
- package/dist/commonjs/resources/resourceRegistry.d.ts +15 -0
- package/dist/commonjs/resources/resourceRegistry.d.ts.map +1 -0
- package/dist/commonjs/resources/resourceRegistry.js +39 -0
- package/dist/commonjs/resources/resourceRegistry.js.map +1 -0
- package/dist/commonjs/resources/utils/docParser.d.ts +28 -0
- package/dist/commonjs/resources/utils/docParser.d.ts.map +1 -0
- package/dist/commonjs/resources/utils/docParser.js +94 -0
- package/dist/commonjs/resources/utils/docParser.js.map +1 -0
- package/dist/commonjs/tools/BaseTool.d.ts +30 -0
- package/dist/commonjs/tools/BaseTool.d.ts.map +1 -0
- package/dist/commonjs/tools/BaseTool.js +63 -0
- package/dist/commonjs/tools/BaseTool.js.map +1 -0
- package/dist/commonjs/tools/batch-get-documents-tool/BatchGetDocumentsTool.d.ts +21 -0
- package/dist/commonjs/tools/batch-get-documents-tool/BatchGetDocumentsTool.d.ts.map +1 -0
- package/dist/commonjs/tools/batch-get-documents-tool/BatchGetDocumentsTool.input.schema.d.ts +6 -0
- package/dist/commonjs/tools/batch-get-documents-tool/BatchGetDocumentsTool.input.schema.d.ts.map +1 -0
- package/dist/commonjs/tools/batch-get-documents-tool/BatchGetDocumentsTool.input.schema.js +14 -0
- package/dist/commonjs/tools/batch-get-documents-tool/BatchGetDocumentsTool.input.schema.js.map +1 -0
- package/dist/commonjs/tools/batch-get-documents-tool/BatchGetDocumentsTool.js +94 -0
- package/dist/commonjs/tools/batch-get-documents-tool/BatchGetDocumentsTool.js.map +1 -0
- package/dist/commonjs/tools/get-document-tool/GetDocumentTool.d.ts +21 -0
- package/dist/commonjs/tools/get-document-tool/GetDocumentTool.d.ts.map +1 -0
- package/dist/commonjs/tools/get-document-tool/GetDocumentTool.input.schema.d.ts +6 -0
- package/dist/commonjs/tools/get-document-tool/GetDocumentTool.input.schema.d.ts.map +1 -0
- package/dist/commonjs/tools/get-document-tool/GetDocumentTool.input.schema.js +13 -0
- package/dist/commonjs/tools/get-document-tool/GetDocumentTool.input.schema.js.map +1 -0
- package/dist/commonjs/tools/get-document-tool/GetDocumentTool.js +80 -0
- package/dist/commonjs/tools/get-document-tool/GetDocumentTool.js.map +1 -0
- package/dist/commonjs/tools/index.d.ts +3 -0
- package/dist/commonjs/tools/index.d.ts.map +1 -0
- package/dist/commonjs/tools/index.js +10 -0
- package/dist/commonjs/tools/index.js.map +1 -0
- package/dist/commonjs/tools/toolRegistry.d.ts +12 -0
- package/dist/commonjs/tools/toolRegistry.d.ts.map +1 -0
- package/dist/commonjs/tools/toolRegistry.js +29 -0
- package/dist/commonjs/tools/toolRegistry.js.map +1 -0
- package/dist/commonjs/utils/docCache.d.ts +28 -0
- package/dist/commonjs/utils/docCache.d.ts.map +1 -0
- package/dist/commonjs/utils/docCache.js +129 -0
- package/dist/commonjs/utils/docCache.js.map +1 -0
- package/dist/commonjs/utils/httpPipeline.d.ts +39 -0
- package/dist/commonjs/utils/httpPipeline.d.ts.map +1 -0
- package/dist/commonjs/utils/httpPipeline.js +112 -0
- package/dist/commonjs/utils/httpPipeline.js.map +1 -0
- package/dist/commonjs/utils/index.d.ts +4 -0
- package/dist/commonjs/utils/index.d.ts.map +1 -0
- package/dist/commonjs/utils/index.js +12 -0
- package/dist/commonjs/utils/index.js.map +1 -0
- package/dist/commonjs/utils/types.d.ts +7 -0
- package/dist/commonjs/utils/types.d.ts.map +1 -0
- package/dist/commonjs/utils/types.js +5 -0
- package/dist/commonjs/utils/types.js.map +1 -0
- package/dist/commonjs/utils/versionUtils.d.ts +9 -0
- package/dist/commonjs/utils/versionUtils.d.ts.map +1 -0
- package/dist/commonjs/utils/versionUtils.js +34 -0
- package/dist/commonjs/utils/versionUtils.js.map +1 -0
- package/dist/commonjs/version.json +6 -0
- package/dist/esm/config/toolConfig.d.ts +8 -0
- package/dist/esm/config/toolConfig.d.ts.map +1 -0
- package/dist/esm/config/toolConfig.js +37 -0
- package/dist/esm/config/toolConfig.js.map +1 -0
- package/dist/esm/constants/mapboxStreetsV8Fields.trimmed.d.ts +306 -0
- package/dist/esm/constants/mapboxStreetsV8Fields.trimmed.d.ts.map +1 -0
- package/dist/esm/constants/mapboxStreetsV8Fields.trimmed.js +2066 -0
- package/dist/esm/constants/mapboxStreetsV8Fields.trimmed.js.map +1 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +80 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/resources/BaseResource.d.ts +21 -0
- package/dist/esm/resources/BaseResource.d.ts.map +1 -0
- package/dist/esm/resources/BaseResource.js +17 -0
- package/dist/esm/resources/BaseResource.js.map +1 -0
- package/dist/esm/resources/index.d.ts +3 -0
- package/dist/esm/resources/index.d.ts.map +1 -0
- package/dist/esm/resources/index.js +4 -0
- package/dist/esm/resources/index.js.map +1 -0
- package/dist/esm/resources/mapbox-api-reference-resource/MapboxApiReferenceResource.d.ts +19 -0
- package/dist/esm/resources/mapbox-api-reference-resource/MapboxApiReferenceResource.d.ts.map +1 -0
- package/dist/esm/resources/mapbox-api-reference-resource/MapboxApiReferenceResource.js +57 -0
- package/dist/esm/resources/mapbox-api-reference-resource/MapboxApiReferenceResource.js.map +1 -0
- package/dist/esm/resources/mapbox-documentation-resource/MapboxDocumentationResource.d.ts +29 -0
- package/dist/esm/resources/mapbox-documentation-resource/MapboxDocumentationResource.d.ts.map +1 -0
- package/dist/esm/resources/mapbox-documentation-resource/MapboxDocumentationResource.js +62 -0
- package/dist/esm/resources/mapbox-documentation-resource/MapboxDocumentationResource.js.map +1 -0
- package/dist/esm/resources/mapbox-examples-resource/MapboxExamplesResource.d.ts +19 -0
- package/dist/esm/resources/mapbox-examples-resource/MapboxExamplesResource.d.ts.map +1 -0
- package/dist/esm/resources/mapbox-examples-resource/MapboxExamplesResource.js +57 -0
- package/dist/esm/resources/mapbox-examples-resource/MapboxExamplesResource.js.map +1 -0
- package/dist/esm/resources/mapbox-guides-resource/MapboxGuidesResource.d.ts +19 -0
- package/dist/esm/resources/mapbox-guides-resource/MapboxGuidesResource.d.ts.map +1 -0
- package/dist/esm/resources/mapbox-guides-resource/MapboxGuidesResource.js +57 -0
- package/dist/esm/resources/mapbox-guides-resource/MapboxGuidesResource.js.map +1 -0
- package/dist/esm/resources/mapbox-layer-type-mapping-resource/MapboxLayerTypeMappingResource.d.ts +19 -0
- package/dist/esm/resources/mapbox-layer-type-mapping-resource/MapboxLayerTypeMappingResource.d.ts.map +1 -0
- package/dist/esm/resources/mapbox-layer-type-mapping-resource/MapboxLayerTypeMappingResource.js +166 -0
- package/dist/esm/resources/mapbox-layer-type-mapping-resource/MapboxLayerTypeMappingResource.js.map +1 -0
- package/dist/esm/resources/mapbox-reference-resource/MapboxReferenceResource.d.ts +19 -0
- package/dist/esm/resources/mapbox-reference-resource/MapboxReferenceResource.d.ts.map +1 -0
- package/dist/esm/resources/mapbox-reference-resource/MapboxReferenceResource.js +57 -0
- package/dist/esm/resources/mapbox-reference-resource/MapboxReferenceResource.js.map +1 -0
- package/dist/esm/resources/mapbox-sdk-docs-resource/MapboxSdkDocsResource.d.ts +19 -0
- package/dist/esm/resources/mapbox-sdk-docs-resource/MapboxSdkDocsResource.d.ts.map +1 -0
- package/dist/esm/resources/mapbox-sdk-docs-resource/MapboxSdkDocsResource.js +57 -0
- package/dist/esm/resources/mapbox-sdk-docs-resource/MapboxSdkDocsResource.js.map +1 -0
- package/dist/esm/resources/mapbox-streets-v8-fields-resource/MapboxStreetsV8FieldsResource.d.ts +19 -0
- package/dist/esm/resources/mapbox-streets-v8-fields-resource/MapboxStreetsV8FieldsResource.d.ts.map +1 -0
- package/dist/esm/resources/mapbox-streets-v8-fields-resource/MapboxStreetsV8FieldsResource.js +26 -0
- package/dist/esm/resources/mapbox-streets-v8-fields-resource/MapboxStreetsV8FieldsResource.js.map +1 -0
- package/dist/esm/resources/mapbox-style-layers-resource/MapboxStyleLayersResource.d.ts +20 -0
- package/dist/esm/resources/mapbox-style-layers-resource/MapboxStyleLayersResource.d.ts.map +1 -0
- package/dist/esm/resources/mapbox-style-layers-resource/MapboxStyleLayersResource.js +319 -0
- package/dist/esm/resources/mapbox-style-layers-resource/MapboxStyleLayersResource.js.map +1 -0
- package/dist/esm/resources/mapbox-token-scopes-resource/MapboxTokenScopesResource.d.ts +20 -0
- package/dist/esm/resources/mapbox-token-scopes-resource/MapboxTokenScopesResource.d.ts.map +1 -0
- package/dist/esm/resources/mapbox-token-scopes-resource/MapboxTokenScopesResource.js +104 -0
- package/dist/esm/resources/mapbox-token-scopes-resource/MapboxTokenScopesResource.js.map +1 -0
- package/dist/esm/resources/resourceRegistry.d.ts +15 -0
- package/dist/esm/resources/resourceRegistry.d.ts.map +1 -0
- package/dist/esm/resources/resourceRegistry.js +34 -0
- package/dist/esm/resources/resourceRegistry.js.map +1 -0
- package/dist/esm/resources/utils/docParser.d.ts +28 -0
- package/dist/esm/resources/utils/docParser.d.ts.map +1 -0
- package/dist/esm/resources/utils/docParser.js +88 -0
- package/dist/esm/resources/utils/docParser.js.map +1 -0
- package/dist/esm/tools/BaseTool.d.ts +30 -0
- package/dist/esm/tools/BaseTool.d.ts.map +1 -0
- package/dist/esm/tools/BaseTool.js +59 -0
- package/dist/esm/tools/BaseTool.js.map +1 -0
- package/dist/esm/tools/batch-get-documents-tool/BatchGetDocumentsTool.d.ts +21 -0
- package/dist/esm/tools/batch-get-documents-tool/BatchGetDocumentsTool.d.ts.map +1 -0
- package/dist/esm/tools/batch-get-documents-tool/BatchGetDocumentsTool.input.schema.d.ts +6 -0
- package/dist/esm/tools/batch-get-documents-tool/BatchGetDocumentsTool.input.schema.d.ts.map +1 -0
- package/dist/esm/tools/batch-get-documents-tool/BatchGetDocumentsTool.input.schema.js +11 -0
- package/dist/esm/tools/batch-get-documents-tool/BatchGetDocumentsTool.input.schema.js.map +1 -0
- package/dist/esm/tools/batch-get-documents-tool/BatchGetDocumentsTool.js +90 -0
- package/dist/esm/tools/batch-get-documents-tool/BatchGetDocumentsTool.js.map +1 -0
- package/dist/esm/tools/get-document-tool/GetDocumentTool.d.ts +21 -0
- package/dist/esm/tools/get-document-tool/GetDocumentTool.d.ts.map +1 -0
- package/dist/esm/tools/get-document-tool/GetDocumentTool.input.schema.d.ts +6 -0
- package/dist/esm/tools/get-document-tool/GetDocumentTool.input.schema.d.ts.map +1 -0
- package/dist/esm/tools/get-document-tool/GetDocumentTool.input.schema.js +10 -0
- package/dist/esm/tools/get-document-tool/GetDocumentTool.input.schema.js.map +1 -0
- package/dist/esm/tools/get-document-tool/GetDocumentTool.js +76 -0
- package/dist/esm/tools/get-document-tool/GetDocumentTool.js.map +1 -0
- package/dist/esm/tools/index.d.ts +3 -0
- package/dist/esm/tools/index.d.ts.map +1 -0
- package/dist/esm/tools/index.js +4 -0
- package/dist/esm/tools/index.js.map +1 -0
- package/dist/esm/tools/toolRegistry.d.ts +12 -0
- package/dist/esm/tools/toolRegistry.d.ts.map +1 -0
- package/dist/esm/tools/toolRegistry.js +23 -0
- package/dist/esm/tools/toolRegistry.js.map +1 -0
- package/dist/esm/utils/docCache.d.ts +28 -0
- package/dist/esm/utils/docCache.d.ts.map +1 -0
- package/dist/esm/utils/docCache.js +124 -0
- package/dist/esm/utils/docCache.js.map +1 -0
- package/dist/esm/utils/httpPipeline.d.ts +39 -0
- package/dist/esm/utils/httpPipeline.d.ts.map +1 -0
- package/dist/esm/utils/httpPipeline.js +106 -0
- package/dist/esm/utils/httpPipeline.js.map +1 -0
- package/dist/esm/utils/index.d.ts +4 -0
- package/dist/esm/utils/index.d.ts.map +1 -0
- package/dist/esm/utils/index.js +5 -0
- package/dist/esm/utils/index.js.map +1 -0
- package/dist/esm/utils/types.d.ts +7 -0
- package/dist/esm/utils/types.d.ts.map +1 -0
- package/dist/esm/utils/types.js +4 -0
- package/dist/esm/utils/types.js.map +1 -0
- package/dist/esm/utils/versionUtils.d.ts +9 -0
- package/dist/esm/utils/versionUtils.d.ts.map +1 -0
- package/dist/esm/utils/versionUtils.js +28 -0
- package/dist/esm/utils/versionUtils.js.map +1 -0
- package/dist/esm/version.json +6 -0
- package/package.json +132 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) Mapbox, Inc.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.parseDocSections = parseDocSections;
|
|
6
|
+
exports.categorizeSection = categorizeSection;
|
|
7
|
+
exports.filterSectionsByCategory = filterSectionsByCategory;
|
|
8
|
+
exports.sectionsToMarkdown = sectionsToMarkdown;
|
|
9
|
+
/**
|
|
10
|
+
* Parse Mapbox documentation into sections
|
|
11
|
+
*/
|
|
12
|
+
function parseDocSections(content) {
|
|
13
|
+
const sections = [];
|
|
14
|
+
const lines = content.split('\n');
|
|
15
|
+
let currentSection = null;
|
|
16
|
+
let currentContent = [];
|
|
17
|
+
for (const line of lines) {
|
|
18
|
+
// Detect section headers (lines starting with ##)
|
|
19
|
+
if (line.startsWith('##')) {
|
|
20
|
+
// Save previous section if exists
|
|
21
|
+
if (currentSection && currentContent.length > 0) {
|
|
22
|
+
currentSection.content = currentContent.join('\n').trim();
|
|
23
|
+
sections.push(currentSection);
|
|
24
|
+
}
|
|
25
|
+
// Start new section
|
|
26
|
+
const title = line.replace(/^##\s*/, '').trim();
|
|
27
|
+
currentSection = {
|
|
28
|
+
title,
|
|
29
|
+
content: ''
|
|
30
|
+
};
|
|
31
|
+
currentContent = [];
|
|
32
|
+
}
|
|
33
|
+
else if (currentSection) {
|
|
34
|
+
// Add content to current section
|
|
35
|
+
currentContent.push(line);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// Save last section
|
|
39
|
+
if (currentSection && currentContent.length > 0) {
|
|
40
|
+
currentSection.content = currentContent.join('\n').trim();
|
|
41
|
+
sections.push(currentSection);
|
|
42
|
+
}
|
|
43
|
+
return sections;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Categorize a section based on its title
|
|
47
|
+
*/
|
|
48
|
+
function categorizeSection(title) {
|
|
49
|
+
const lower = title.toLowerCase();
|
|
50
|
+
// APIs category
|
|
51
|
+
if (lower.includes('api') &&
|
|
52
|
+
!lower.includes('playground') &&
|
|
53
|
+
!lower.includes('sdk') &&
|
|
54
|
+
!lower.includes('libraries')) {
|
|
55
|
+
return 'apis';
|
|
56
|
+
}
|
|
57
|
+
// SDKs category
|
|
58
|
+
if (lower.includes('sdk') ||
|
|
59
|
+
lower.includes('library') ||
|
|
60
|
+
lower.includes('libraries') ||
|
|
61
|
+
lower.includes('client')) {
|
|
62
|
+
return 'sdks';
|
|
63
|
+
}
|
|
64
|
+
// Examples category
|
|
65
|
+
if (lower.includes('playground') ||
|
|
66
|
+
lower.includes('demo') ||
|
|
67
|
+
lower.includes('example')) {
|
|
68
|
+
return 'examples';
|
|
69
|
+
}
|
|
70
|
+
// Guides category
|
|
71
|
+
if (lower.includes('design') ||
|
|
72
|
+
lower.includes('studio') ||
|
|
73
|
+
lower.includes('manual') ||
|
|
74
|
+
lower.includes('guide')) {
|
|
75
|
+
return 'guides';
|
|
76
|
+
}
|
|
77
|
+
// Everything else is reference
|
|
78
|
+
return 'reference';
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Filter sections by category
|
|
82
|
+
*/
|
|
83
|
+
function filterSectionsByCategory(sections, category) {
|
|
84
|
+
return sections.filter((section) => categorizeSection(section.title) === category);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Convert sections back to markdown
|
|
88
|
+
*/
|
|
89
|
+
function sectionsToMarkdown(sections) {
|
|
90
|
+
return sections
|
|
91
|
+
.map((section) => `## ${section.title}\n\n${section.content}`)
|
|
92
|
+
.join('\n\n');
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=docParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docParser.js","sourceRoot":"","sources":["../../../../src/resources/utils/docParser.ts"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,kCAAkC;;AAkBlC,4CAoCC;AAKD,8CA4CC;AAKD,4DAOC;AAKD,gDAIC;AA7GD;;GAEG;AACH,SAAgB,gBAAgB,CAAC,OAAe;IAC9C,MAAM,QAAQ,GAAiB,EAAE,CAAC;IAClC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAElC,IAAI,cAAc,GAAsB,IAAI,CAAC;IAC7C,IAAI,cAAc,GAAa,EAAE,CAAC;IAElC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,kDAAkD;QAClD,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI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';
|
|
2
|
+
import { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';
|
|
3
|
+
import { CallToolResult, ToolAnnotations } from '@modelcontextprotocol/sdk/types.js';
|
|
4
|
+
import { z, ZodTypeAny } from 'zod';
|
|
5
|
+
export declare abstract class BaseTool<InputSchema extends ZodTypeAny, OutputSchema extends ZodTypeAny = ZodTypeAny> {
|
|
6
|
+
abstract readonly name: string;
|
|
7
|
+
abstract readonly description: string;
|
|
8
|
+
abstract readonly annotations: ToolAnnotations;
|
|
9
|
+
readonly inputSchema: InputSchema;
|
|
10
|
+
readonly outputSchema?: OutputSchema;
|
|
11
|
+
protected server: McpServer | null;
|
|
12
|
+
constructor(params: {
|
|
13
|
+
inputSchema: InputSchema;
|
|
14
|
+
outputSchema?: OutputSchema;
|
|
15
|
+
});
|
|
16
|
+
/**
|
|
17
|
+
* Tool logic to be implemented by subclasses.
|
|
18
|
+
*/
|
|
19
|
+
run(rawInput: unknown, _extra?: RequestHandlerExtra<any, any>): Promise<CallToolResult>;
|
|
20
|
+
protected abstract execute(inputSchema: z.infer<InputSchema>): Promise<CallToolResult>;
|
|
21
|
+
/**
|
|
22
|
+
* Installs the tool to the given MCP server.
|
|
23
|
+
*/
|
|
24
|
+
installTo(server: McpServer): RegisteredTool;
|
|
25
|
+
/**
|
|
26
|
+
* Helper method to send logging messages
|
|
27
|
+
*/
|
|
28
|
+
protected log(level: 'debug' | 'info' | 'warning' | 'error', data: string | Record<string, unknown>): void;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=BaseTool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseTool.d.ts","sourceRoot":"","sources":["../../../src/tools/BaseTool.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,SAAS,EACT,cAAc,EACf,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACnF,OAAO,EACL,cAAc,EACd,eA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ty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.BaseTool = void 0;
|
|
6
|
+
class BaseTool {
|
|
7
|
+
inputSchema;
|
|
8
|
+
outputSchema;
|
|
9
|
+
server = null;
|
|
10
|
+
constructor(params) {
|
|
11
|
+
this.inputSchema = params.inputSchema;
|
|
12
|
+
this.outputSchema = params.outputSchema;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Tool logic to be implemented by subclasses.
|
|
16
|
+
*/
|
|
17
|
+
async run(rawInput,
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
|
+
_extra) {
|
|
20
|
+
try {
|
|
21
|
+
const input = this.inputSchema.parse(rawInput);
|
|
22
|
+
return this.execute(input);
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
return {
|
|
26
|
+
isError: true,
|
|
27
|
+
content: [{ type: 'text', text: error.message }]
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Installs the tool to the given MCP server.
|
|
33
|
+
*/
|
|
34
|
+
installTo(server) {
|
|
35
|
+
this.server = server;
|
|
36
|
+
const config = {
|
|
37
|
+
title: this.annotations.title,
|
|
38
|
+
description: this.description,
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
|
+
inputSchema: this.inputSchema.shape,
|
|
41
|
+
annotations: this.annotations
|
|
42
|
+
};
|
|
43
|
+
// Add outputSchema if provided
|
|
44
|
+
if (this.outputSchema) {
|
|
45
|
+
config.outputSchema =
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
47
|
+
this.outputSchema.shape;
|
|
48
|
+
}
|
|
49
|
+
return server.registerTool(this.name, config,
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
51
|
+
(args, extra) => this.run(args, extra));
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Helper method to send logging messages
|
|
55
|
+
*/
|
|
56
|
+
log(level, data) {
|
|
57
|
+
if (this.server?.server) {
|
|
58
|
+
this.server.server.sendLoggingMessage({ level, data });
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.BaseTool = BaseTool;
|
|
63
|
+
//# sourceMappingURL=BaseTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseTool.js","sourceRoot":"","sources":["../../../src/tools/BaseTool.ts"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,kCAAkC;;;AAalC,MAAsB,QAAQ;IAQnB,WAAW,CAAc;IACzB,YAAY,CAAgB;IAC3B,MAAM,GAAqB,IAAI,CAAC;IAE1C,YAAY,MAGX;QACC,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;QACtC,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;IAC1C,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,GAAG,CACP,QAAiB;IACjB,8DAA8D;IAC9D,MAAsC;QAEtC,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YAC/C,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC7B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAG,KAAe,CAAC,OAAO,EAAE,CAAC;aAC5D,CAAC;QACJ,CAAC;IACH,CAAC;IAMD;;OAEG;IACH,SAAS,CAAC,MAAiB;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,MAAM,MAAM,GAQR;YACF,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK;YAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,8DAA8D;YAC9D,WAAW,EAAG,IAAI,CAAC,WAA2C,CAAC,KAAK;YACpE,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,CAAC;QAEF,+BAA+B;QAC/B,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,MAAM,CAAC,YAAY;gBACjB,8DAA8D;gBAC7D,IAAI,CAAC,YAA4C,CAAC,KAAK,CAAC;QAC7D,CAAC;QAED,OAAO,MAAM,CAAC,YAAY,CACxB,IAAI,CAAC,IAAI,EACT,MAAM;QACN,8DAA8D;QAC9D,CAAC,IAAS,EAAE,KAAU,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CACjD,CAAC;IACJ,CAAC;IAED;;OAEG;IACO,GAAG,CACX,KAA6C,EAC7C,IAAsC;QAEtC,IAAI,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;YACxB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;CACF;AA3FD,4BA2FC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import type { HttpRequest } from '../../utils/types.js';
|
|
3
|
+
import { BaseTool } from '../BaseTool.js';
|
|
4
|
+
import { BatchGetDocumentsSchema, BatchGetDocumentsInput } from './BatchGetDocumentsTool.input.schema.js';
|
|
5
|
+
export declare class BatchGetDocumentsTool extends BaseTool<typeof BatchGetDocumentsSchema> {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
readonly annotations: {
|
|
9
|
+
readOnlyHint: boolean;
|
|
10
|
+
destructiveHint: boolean;
|
|
11
|
+
idempotentHint: boolean;
|
|
12
|
+
openWorldHint: boolean;
|
|
13
|
+
title: string;
|
|
14
|
+
};
|
|
15
|
+
private httpRequest;
|
|
16
|
+
constructor(params: {
|
|
17
|
+
httpRequest: HttpRequest;
|
|
18
|
+
});
|
|
19
|
+
protected execute(input: BatchGetDocumentsInput): Promise<CallToolResult>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=BatchGetDocumentsTool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BatchGetDocumentsTool.d.ts","sourceRoot":"","sources":["../../../../src/tools/batch-get-documents-tool/BatchGetDocumentsTool.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAOpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,yCAAyC,CAAC;AAejD,qBAAa,qBAAsB,SAAQ,QAAQ,CACjD,OAAO,uBAAuB,CAC/B;IACC,IAAI,SAA8B;IAClC,WAAW,SACyP;IACpQ,QAAQ,CAAC,WAAW;;;;;;MAMlB;IAEF,OAAO,CAAC,WAAW,CAAc;gBAErB,MAAM,EAAE;QAAE,WAAW,EAAE,WAAW,CAAA;KAAE;cAKhC,OAAO,CACrB,KAAK,EAAE,sBAAsB,GAC5B,OAAO,CAAC,cAAc,CAAC;CAsE3B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const BatchGetDocumentsSchema: z.ZodObject<{
|
|
3
|
+
urls: z.ZodArray<z.ZodString>;
|
|
4
|
+
}, z.core.$strip>;
|
|
5
|
+
export type BatchGetDocumentsInput = z.infer<typeof BatchGetDocumentsSchema>;
|
|
6
|
+
//# sourceMappingURL=BatchGetDocumentsTool.input.schema.d.ts.map
|
package/dist/commonjs/tools/batch-get-documents-tool/BatchGetDocumentsTool.input.schema.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BatchGetDocumentsTool.input.schema.d.ts","sourceRoot":"","sources":["../../../../src/tools/batch-get-documents-tool/BatchGetDocumentsTool.input.schema.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,uBAAuB;;iBAQlC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) Mapbox, Inc.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.BatchGetDocumentsSchema = void 0;
|
|
6
|
+
const zod_1 = require("zod");
|
|
7
|
+
exports.BatchGetDocumentsSchema = zod_1.z.object({
|
|
8
|
+
urls: zod_1.z
|
|
9
|
+
.array(zod_1.z.string().url())
|
|
10
|
+
.min(1)
|
|
11
|
+
.max(20)
|
|
12
|
+
.describe('Array of Mapbox documentation page URLs to fetch (max 20). All must be mapbox.com URLs.')
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=BatchGetDocumentsTool.input.schema.js.map
|
package/dist/commonjs/tools/batch-get-documents-tool/BatchGetDocumentsTool.input.schema.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BatchGetDocumentsTool.input.schema.js","sourceRoot":"","sources":["../../../../src/tools/batch-get-documents-tool/BatchGetDocumentsTool.input.schema.ts"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,kCAAkC;;;AAElC,6BAAwB;AAEX,QAAA,uBAAuB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC9C,IAAI,EAAE,OAAC;SACJ,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC;SACvB,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,EAAE,CAAC;SACP,QAAQ,CACP,yFAAyF,CAC1F;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) Mapbox, Inc.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.BatchGetDocumentsTool = void 0;
|
|
6
|
+
const docCache_js_1 = require("../../utils/docCache.js");
|
|
7
|
+
const BaseTool_js_1 = require("../BaseTool.js");
|
|
8
|
+
const BatchGetDocumentsTool_input_schema_js_1 = require("./BatchGetDocumentsTool.input.schema.js");
|
|
9
|
+
function isMapboxUrl(url) {
|
|
10
|
+
try {
|
|
11
|
+
const { hostname } = new URL(url);
|
|
12
|
+
return hostname === 'mapbox.com' || hostname.endsWith('.mapbox.com');
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
class BatchGetDocumentsTool extends BaseTool_js_1.BaseTool {
|
|
19
|
+
name = 'batch_get_documents_tool';
|
|
20
|
+
description = 'Fetch the full content of multiple Mapbox documentation pages in a single call (max 20). More efficient than calling get_document_tool multiple times. Returns an array of results — failed pages include an error message rather than failing the whole batch.';
|
|
21
|
+
annotations = {
|
|
22
|
+
readOnlyHint: true,
|
|
23
|
+
destructiveHint: false,
|
|
24
|
+
idempotentHint: true,
|
|
25
|
+
openWorldHint: true,
|
|
26
|
+
title: 'Batch Get Mapbox Documents Tool'
|
|
27
|
+
};
|
|
28
|
+
httpRequest;
|
|
29
|
+
constructor(params) {
|
|
30
|
+
super({ inputSchema: BatchGetDocumentsTool_input_schema_js_1.BatchGetDocumentsSchema });
|
|
31
|
+
this.httpRequest = params.httpRequest;
|
|
32
|
+
}
|
|
33
|
+
async execute(input) {
|
|
34
|
+
const invalidUrls = input.urls.filter((url) => !isMapboxUrl(url));
|
|
35
|
+
if (invalidUrls.length > 0) {
|
|
36
|
+
return {
|
|
37
|
+
content: [
|
|
38
|
+
{
|
|
39
|
+
type: 'text',
|
|
40
|
+
text: `Invalid URLs: only mapbox.com URLs are supported. Invalid: ${invalidUrls.join(', ')}`
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
isError: true
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
// One in-flight fetch per unique normalized URL. Multiple input URLs that
|
|
47
|
+
// normalize to the same key (e.g. cache-busting query params) share a
|
|
48
|
+
// single HTTP request and a single buffered body.
|
|
49
|
+
const inflightByKey = new Map();
|
|
50
|
+
const fetchOne = (url) => {
|
|
51
|
+
const cached = docCache_js_1.docCache.get(url);
|
|
52
|
+
if (cached !== null)
|
|
53
|
+
return Promise.resolve(cached);
|
|
54
|
+
const key = (0, docCache_js_1.normalizeCacheKey)(url);
|
|
55
|
+
const existing = inflightByKey.get(key);
|
|
56
|
+
if (existing)
|
|
57
|
+
return existing;
|
|
58
|
+
const promise = (async () => {
|
|
59
|
+
const response = await this.httpRequest(url, {
|
|
60
|
+
headers: { Accept: 'text/markdown, text/plain;q=0.9, */*;q=0.8' }
|
|
61
|
+
});
|
|
62
|
+
if (!response.ok) {
|
|
63
|
+
throw new Error(`${response.status} ${response.statusText}`);
|
|
64
|
+
}
|
|
65
|
+
const content = await (0, docCache_js_1.readBodyWithLimit)(response, docCache_js_1.MAX_ENTRY_BYTES);
|
|
66
|
+
docCache_js_1.docCache.set(url, content);
|
|
67
|
+
return content;
|
|
68
|
+
})();
|
|
69
|
+
inflightByKey.set(key, promise);
|
|
70
|
+
return promise;
|
|
71
|
+
};
|
|
72
|
+
const results = await Promise.allSettled(input.urls.map(async (url) => {
|
|
73
|
+
const content = await fetchOne(url);
|
|
74
|
+
return { url, content };
|
|
75
|
+
}));
|
|
76
|
+
const output = results.map((result, i) => {
|
|
77
|
+
if (result.status === 'fulfilled') {
|
|
78
|
+
return result.value;
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
url: input.urls[i],
|
|
82
|
+
error: result.reason instanceof Error
|
|
83
|
+
? result.reason.message
|
|
84
|
+
: 'Unknown error'
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
return {
|
|
88
|
+
content: [{ type: 'text', text: JSON.stringify(output, null, 2) }],
|
|
89
|
+
isError: false
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
exports.BatchGetDocumentsTool = BatchGetDocumentsTool;
|
|
94
|
+
//# sourceMappingURL=BatchGetDocumentsTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BatchGetDocumentsTool.js","sourceRoot":"","sources":["../../../../src/tools/batch-get-documents-tool/BatchGetDocumentsTool.ts"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,kCAAkC;;;AAGlC,yDAKiC;AAEjC,gDAA0C;AAC1C,mGAGiD;AAEjD,SAAS,WAAW,CAAC,GAAW;IAC9B,IAAI,CAAC;QACH,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAClC,OAAO,QAAQ,KAAK,YAAY,IAAI,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;IACvE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAMD,MAAa,qBAAsB,SAAQ,sBAE1C;IACC,IAAI,GAAG,0BAA0B,CAAC;IAClC,WAAW,GACT,iQAAiQ,CAAC;IAC3P,WAAW,GAAG;QACrB,YAAY,EAAE,IAAI;QAClB,eAAe,EAAE,KAAK;QACtB,cAAc,EAAE,IAAI;QACpB,aAAa,EAAE,IAAI;QACnB,KAAK,EAAE,iCAAiC;KACzC,CAAC;IAEM,WAAW,CAAc;IAEjC,YAAY,MAAoC;QAC9C,KAAK,CAAC,EAAE,WAAW,EAAE,+DAAuB,EAAE,CAAC,CAAC;QAChD,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;IACxC,CAAC;IAES,KAAK,CAAC,OAAO,CACrB,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Result } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import type { HttpRequest } from '../../utils/types.js';
|
|
3
|
+
import { BaseTool } from '../BaseTool.js';
|
|
4
|
+
import { GetDocumentSchema, GetDocumentInput } from './GetDocumentTool.input.schema.js';
|
|
5
|
+
export declare class GetDocumentTool extends BaseTool<typeof GetDocumentSchema> {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
readonly annotations: {
|
|
9
|
+
readOnlyHint: boolean;
|
|
10
|
+
destructiveHint: boolean;
|
|
11
|
+
idempotentHint: boolean;
|
|
12
|
+
openWorldHint: boolean;
|
|
13
|
+
title: string;
|
|
14
|
+
};
|
|
15
|
+
private httpRequest;
|
|
16
|
+
constructor(params: {
|
|
17
|
+
httpRequest: HttpRequest;
|
|
18
|
+
});
|
|
19
|
+
protected execute(input: GetDocumentInput): Promise<CallToolResult>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=GetDocumentTool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetDocumentTool.d.ts","sourceRoot":"","sources":["../../../../src/tools/get-document-tool/GetDocumentTool.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAMpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,mCAAmC,CAAC;AAW3C,qBAAa,eAAgB,SAAQ,QAAQ,CAAC,OAAO,iBAAiB,CAAC;IACrE,IAAI,SAAuB;IAC3B,WAAW,SAC8P;IACzQ,QAAQ,CAAC,WAAW;;;;;;MAMlB;IAEF,OAAO,CAAC,WAAW,CAAc;gBAErB,MAAM,EAAE;QAAE,WAAW,EAAE,WAAW,CAAA;KAAE;cAKhC,OAAO,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC;CAkD1E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetDocumentTool.input.schema.d.ts","sourceRoot":"","sources":["../../../../src/tools/get-document-tool/GetDocumentTool.input.schema.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,iBAAiB;;iBAO5B,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) Mapbox, Inc.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.GetDocumentSchema = void 0;
|
|
6
|
+
const zod_1 = require("zod");
|
|
7
|
+
exports.GetDocumentSchema = zod_1.z.object({
|
|
8
|
+
url: zod_1.z
|
|
9
|
+
.string()
|
|
10
|
+
.url()
|
|
11
|
+
.describe('URL of a Mapbox documentation page to fetch. Must be a mapbox.com URL (e.g. https://docs.mapbox.com/api/search/geocoding/).')
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=GetDocumentTool.input.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetDocumentTool.input.schema.js","sourceRoot":"","sources":["../../../../src/tools/get-document-tool/GetDocumentTool.input.schema.ts"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,kCAAkC;;;AAElC,6BAAwB;AAEX,QAAA,iBAAiB,GAAG,OAAC,CAAC,MAAM,CAAC;IACxC,GAAG,EAAE,OAAC;SACH,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,CACP,6HAA6H,CAC9H;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) Mapbox, Inc.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.GetDocumentTool = void 0;
|
|
6
|
+
const docCache_js_1 = require("../../utils/docCache.js");
|
|
7
|
+
const BaseTool_js_1 = require("../BaseTool.js");
|
|
8
|
+
const GetDocumentTool_input_schema_js_1 = require("./GetDocumentTool.input.schema.js");
|
|
9
|
+
function isMapboxUrl(url) {
|
|
10
|
+
try {
|
|
11
|
+
const { hostname } = new URL(url);
|
|
12
|
+
return hostname === 'mapbox.com' || hostname.endsWith('.mapbox.com');
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
class GetDocumentTool extends BaseTool_js_1.BaseTool {
|
|
19
|
+
name = 'get_document_tool';
|
|
20
|
+
description = 'Fetch the full content of a specific Mapbox documentation page by URL. Use this after get_latest_mapbox_docs_tool to follow a link from the index and retrieve the complete page content. For fetching multiple pages at once, use batch_get_documents_tool instead.';
|
|
21
|
+
annotations = {
|
|
22
|
+
readOnlyHint: true,
|
|
23
|
+
destructiveHint: false,
|
|
24
|
+
idempotentHint: true,
|
|
25
|
+
openWorldHint: true,
|
|
26
|
+
title: 'Get Mapbox Document Tool'
|
|
27
|
+
};
|
|
28
|
+
httpRequest;
|
|
29
|
+
constructor(params) {
|
|
30
|
+
super({ inputSchema: GetDocumentTool_input_schema_js_1.GetDocumentSchema });
|
|
31
|
+
this.httpRequest = params.httpRequest;
|
|
32
|
+
}
|
|
33
|
+
async execute(input) {
|
|
34
|
+
if (!isMapboxUrl(input.url)) {
|
|
35
|
+
return {
|
|
36
|
+
content: [
|
|
37
|
+
{
|
|
38
|
+
type: 'text',
|
|
39
|
+
text: `Invalid URL: only mapbox.com URLs are supported. Received: ${input.url}`
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
isError: true
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
const cached = docCache_js_1.docCache.get(input.url);
|
|
46
|
+
if (cached !== null) {
|
|
47
|
+
return { content: [{ type: 'text', text: cached }], isError: false };
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
const response = await this.httpRequest(input.url, {
|
|
51
|
+
headers: { Accept: 'text/markdown, text/plain;q=0.9, */*;q=0.8' }
|
|
52
|
+
});
|
|
53
|
+
if (!response.ok) {
|
|
54
|
+
return {
|
|
55
|
+
content: [
|
|
56
|
+
{
|
|
57
|
+
type: 'text',
|
|
58
|
+
text: `Failed to fetch document: ${response.status} ${response.statusText}`
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
isError: true
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
const content = await (0, docCache_js_1.readBodyWithLimit)(response, docCache_js_1.MAX_ENTRY_BYTES);
|
|
65
|
+
docCache_js_1.docCache.set(input.url, content);
|
|
66
|
+
return { content: [{ type: 'text', text: content }], isError: false };
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
70
|
+
return {
|
|
71
|
+
content: [
|
|
72
|
+
{ type: 'text', text: `Failed to fetch document: ${errorMessage}` }
|
|
73
|
+
],
|
|
74
|
+
isError: true
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.GetDocumentTool = GetDocumentTool;
|
|
80
|
+
//# sourceMappingURL=GetDocumentTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetDocumentTool.js","sourceRoot":"","sources":["../../../../src/tools/get-document-tool/GetDocumentTool.ts"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,kCAAkC;;;AAGlC,yDAIiC;AAEjC,gDAA0C;AAC1C,uFAG2C;AAE3C,SAAS,WAAW,CAAC,GAAW;IAC9B,IAAI,CAAC;QACH,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,GAAG,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"use strict";
|
|
2
|
+
// Copyright (c) Mapbox, Inc.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.getToolByName = exports.getCoreTools = exports.getAllTools = void 0;
|
|
6
|
+
var toolRegistry_js_1 = require("./toolRegistry.js");
|
|
7
|
+
Object.defineProperty(exports, "getAllTools", { enumerable: true, get: function () { return toolRegistry_js_1.getAllTools; } });
|
|
8
|
+
Object.defineProperty(exports, "getCoreTools", { enumerable: true, get: function () { return toolRegistry_js_1.getCoreTools; } });
|
|
9
|
+
Object.defineProperty(exports, "getToolByName", { enumerable: true, get: function () { return toolRegistry_js_1.getToolByName; } });
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/index.ts"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,kCAAkC;;;AAElC,qDAA6E;AAApE,8GAAA,WAAW,OAAA;AAAE,+GAAA,YAAY,OAAA;AAAE,gHAAA,aAAa,OAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ZodTypeAny } from 'zod';
|
|
2
|
+
import { BaseTool } from './BaseTool.js';
|
|
3
|
+
export type ToolInstance = BaseTool<ZodTypeAny>;
|
|
4
|
+
/**
|
|
5
|
+
* Core tools registered for all MCP clients
|
|
6
|
+
*/
|
|
7
|
+
export declare const CORE_TOOLS: ToolInstance[];
|
|
8
|
+
export declare const ALL_TOOLS: ToolInstance[];
|
|
9
|
+
export declare function getCoreTools(): readonly ToolInstance[];
|
|
10
|
+
export declare function getAllTools(): readonly ToolInstance[];
|
|
11
|
+
export declare function getToolByName(name: string): ToolInstance | undefined;
|
|
12
|
+
//# sourceMappingURL=toolRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolRegistry.d.ts","sourceRoot":"","sources":["../../../src/tools/toolRegistry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAKzC,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,YAAY,EAGpC,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,YAAY,EAAoB,CAAC;AAEzD,wBAAgB,YAAY,IAAI,SAAS,YAAY,EAAE,CAEtD;AAED,wBAAgB,WAAW,IAAI,SAAS,YAAY,EAAE,CAErD;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAEpE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) Mapbox, Inc.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.ALL_TOOLS = exports.CORE_TOOLS = void 0;
|
|
6
|
+
exports.getCoreTools = getCoreTools;
|
|
7
|
+
exports.getAllTools = getAllTools;
|
|
8
|
+
exports.getToolByName = getToolByName;
|
|
9
|
+
const BatchGetDocumentsTool_js_1 = require("./batch-get-documents-tool/BatchGetDocumentsTool.js");
|
|
10
|
+
const GetDocumentTool_js_1 = require("./get-document-tool/GetDocumentTool.js");
|
|
11
|
+
const httpPipeline_js_1 = require("../utils/httpPipeline.js");
|
|
12
|
+
/**
|
|
13
|
+
* Core tools registered for all MCP clients
|
|
14
|
+
*/
|
|
15
|
+
exports.CORE_TOOLS = [
|
|
16
|
+
new GetDocumentTool_js_1.GetDocumentTool({ httpRequest: httpPipeline_js_1.httpRequest }),
|
|
17
|
+
new BatchGetDocumentsTool_js_1.BatchGetDocumentsTool({ httpRequest: httpPipeline_js_1.httpRequest })
|
|
18
|
+
];
|
|
19
|
+
exports.ALL_TOOLS = [...exports.CORE_TOOLS];
|
|
20
|
+
function getCoreTools() {
|
|
21
|
+
return exports.CORE_TOOLS;
|
|
22
|
+
}
|
|
23
|
+
function getAllTools() {
|
|
24
|
+
return exports.ALL_TOOLS;
|
|
25
|
+
}
|
|
26
|
+
function getToolByName(name) {
|
|
27
|
+
return exports.ALL_TOOLS.find((tool) => tool.name === name);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=toolRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolRegistry.js","sourceRoot":"","sources":["../../../src/tools/toolRegistry.ts"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,kCAAkC;;;AAoBlC,oCAEC;AAED,kCAEC;AAED,sCAEC;AA1BD,kGAA4F;AAC5F,+EAAyE;AACzE,8DAAuD;AAIvD;;GAEG;AACU,QAAA,UAAU,GAAmB;IACxC,IAAI,oCAAe,CAAC,EAAE,WAAW,EAAX,6BAAW,EAAE,CAAC;IACpC,IAAI,gDAAqB,CAAC,EAAE,WAAW,EAAX,6BAAW,EAAE,CAAC;CAC3C,CAAC;AAEW,QAAA,SAAS,GAAmB,CAAC,GAAG,kBAAU,CAAC,CAAC;AAEzD,SAAgB,YAAY;IAC1B,OAAO,kBAAU,CAAC;AACpB,CAAC;AAED,SAAgB,WAAW;IACzB,OAAO,iBAAS,CAAC;AACnB,CAAC;AAED,SAAgB,aAAa,CAAC,IAAY;IACxC,OAAO,iBAAS,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const MAX_ENTRY_BYTES: number;
|
|
2
|
+
/**
|
|
3
|
+
* Normalize a URL for use as a cache key by stripping query parameters
|
|
4
|
+
* and hash fragments. This prevents cache-busting via unique query strings
|
|
5
|
+
* from creating unbounded cache entries.
|
|
6
|
+
*/
|
|
7
|
+
export declare function normalizeCacheKey(url: string): string;
|
|
8
|
+
declare class DocCache {
|
|
9
|
+
private cache;
|
|
10
|
+
private totalBytes;
|
|
11
|
+
get(url: string): string | null;
|
|
12
|
+
set(url: string, content: string, ttlMs?: number): void;
|
|
13
|
+
has(url: string): boolean;
|
|
14
|
+
clear(): void;
|
|
15
|
+
/** Exposed for testing only. */
|
|
16
|
+
get size(): number;
|
|
17
|
+
/** Exposed for testing only. */
|
|
18
|
+
get currentTotalBytes(): number;
|
|
19
|
+
}
|
|
20
|
+
export declare const docCache: DocCache;
|
|
21
|
+
/**
|
|
22
|
+
* Read a Response body up to `maxBytes`, aborting early if the limit is
|
|
23
|
+
* exceeded. Checks Content-Length first when present so no bytes are
|
|
24
|
+
* buffered for obviously-oversized responses.
|
|
25
|
+
*/
|
|
26
|
+
export declare function readBodyWithLimit(response: Response, maxBytes: number): Promise<string>;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=docCache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docCache.d.ts","sourceRoot":"","sources":["../../../src/utils/docCache.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,eAAe,QAAkB,CAAC;AAS/C;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CASrD;AAED,cAAM,QAAQ;IACZ,OAAO,CAAC,KAAK,CAAiC;IAC9C,OAAO,CAAC,UAAU,CAAK;IAEvB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAe/B,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,MAAuB,GAAG,IAAI;IA+BvE,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIzB,KAAK,IAAI,IAAI;IAKb,gCAAgC;IAChC,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,gCAAgC;IAChC,IAAI,iBAAiB,IAAI,MAAM,CAE9B;CACF;AAED,eAAO,MAAM,QAAQ,UAAiB,CAAC;AAEvC;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,CAsCjB"}
|