@mapbox/mcp-server 0.6.1 → 0.8.1-dev.1

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.
Files changed (226) hide show
  1. package/README.md +147 -23
  2. package/dist/commonjs/config/toolConfig.d.ts +10 -0
  3. package/dist/commonjs/config/toolConfig.d.ts.map +1 -1
  4. package/dist/commonjs/config/toolConfig.js +36 -0
  5. package/dist/commonjs/config/toolConfig.js.map +1 -1
  6. package/dist/commonjs/index.d.ts +1 -1
  7. package/dist/commonjs/index.d.ts.map +1 -1
  8. package/dist/commonjs/index.js +167 -13
  9. package/dist/commonjs/index.js.map +1 -1
  10. package/dist/commonjs/prompts/BasePrompt.d.ts +40 -0
  11. package/dist/commonjs/prompts/BasePrompt.d.ts.map +1 -0
  12. package/dist/commonjs/prompts/BasePrompt.js +38 -0
  13. package/dist/commonjs/prompts/BasePrompt.js.map +1 -0
  14. package/dist/commonjs/prompts/FindPlacesNearbyPrompt.d.ts +22 -0
  15. package/dist/commonjs/prompts/FindPlacesNearbyPrompt.d.ts.map +1 -0
  16. package/dist/commonjs/prompts/FindPlacesNearbyPrompt.js +65 -0
  17. package/dist/commonjs/prompts/FindPlacesNearbyPrompt.js.map +1 -0
  18. package/dist/commonjs/prompts/GetDirectionsPrompt.d.ts +23 -0
  19. package/dist/commonjs/prompts/GetDirectionsPrompt.d.ts.map +1 -0
  20. package/dist/commonjs/prompts/GetDirectionsPrompt.js +67 -0
  21. package/dist/commonjs/prompts/GetDirectionsPrompt.js.map +1 -0
  22. package/dist/commonjs/prompts/ShowReachableAreasPrompt.d.ts +23 -0
  23. package/dist/commonjs/prompts/ShowReachableAreasPrompt.d.ts.map +1 -0
  24. package/dist/commonjs/prompts/ShowReachableAreasPrompt.js +70 -0
  25. package/dist/commonjs/prompts/ShowReachableAreasPrompt.js.map +1 -0
  26. package/dist/commonjs/prompts/promptRegistry.d.ts +29 -0
  27. package/dist/commonjs/prompts/promptRegistry.d.ts.map +1 -0
  28. package/dist/commonjs/prompts/promptRegistry.js +39 -0
  29. package/dist/commonjs/prompts/promptRegistry.js.map +1 -0
  30. package/dist/commonjs/resources/BaseResource.d.ts +28 -0
  31. package/dist/commonjs/resources/BaseResource.d.ts.map +1 -0
  32. package/dist/commonjs/resources/BaseResource.js +32 -0
  33. package/dist/commonjs/resources/BaseResource.js.map +1 -0
  34. package/dist/commonjs/resources/MapboxApiBasedResource.d.ts +35 -0
  35. package/dist/commonjs/resources/MapboxApiBasedResource.d.ts.map +1 -0
  36. package/dist/commonjs/resources/MapboxApiBasedResource.js +88 -0
  37. package/dist/commonjs/resources/MapboxApiBasedResource.js.map +1 -0
  38. package/dist/commonjs/resources/category-list/CategoryListResource.d.ts +27 -0
  39. package/dist/commonjs/resources/category-list/CategoryListResource.d.ts.map +1 -0
  40. package/dist/commonjs/resources/category-list/CategoryListResource.js +71 -0
  41. package/dist/commonjs/resources/category-list/CategoryListResource.js.map +1 -0
  42. package/dist/commonjs/resources/resourceRegistry.d.ts +6 -0
  43. package/dist/commonjs/resources/resourceRegistry.d.ts.map +1 -0
  44. package/dist/commonjs/resources/resourceRegistry.js +32 -0
  45. package/dist/commonjs/resources/resourceRegistry.js.map +1 -0
  46. package/dist/commonjs/tools/BaseTool.d.ts +7 -0
  47. package/dist/commonjs/tools/BaseTool.d.ts.map +1 -1
  48. package/dist/commonjs/tools/BaseTool.js +19 -0
  49. package/dist/commonjs/tools/BaseTool.js.map +1 -1
  50. package/dist/commonjs/tools/MapboxApiBasedTool.d.ts.map +1 -1
  51. package/dist/commonjs/tools/MapboxApiBasedTool.js +1 -1
  52. package/dist/commonjs/tools/MapboxApiBasedTool.js.map +1 -1
  53. package/dist/commonjs/tools/category-list-tool/CategoryListTool.d.ts.map +1 -1
  54. package/dist/commonjs/tools/category-list-tool/CategoryListTool.js +2 -2
  55. package/dist/commonjs/tools/category-list-tool/CategoryListTool.js.map +1 -1
  56. package/dist/commonjs/tools/category-search-tool/CategorySearchTool.d.ts.map +1 -1
  57. package/dist/commonjs/tools/category-search-tool/CategorySearchTool.input.schema.d.ts +4 -10
  58. package/dist/commonjs/tools/category-search-tool/CategorySearchTool.input.schema.d.ts.map +1 -1
  59. package/dist/commonjs/tools/category-search-tool/CategorySearchTool.input.schema.js +5 -43
  60. package/dist/commonjs/tools/category-search-tool/CategorySearchTool.input.schema.js.map +1 -1
  61. package/dist/commonjs/tools/category-search-tool/CategorySearchTool.js +2 -7
  62. package/dist/commonjs/tools/category-search-tool/CategorySearchTool.js.map +1 -1
  63. package/dist/commonjs/tools/category-search-tool/CategorySearchTool.output.schema.d.ts +204 -204
  64. package/dist/commonjs/tools/category-search-tool/CategorySearchTool.output.schema.d.ts.map +1 -1
  65. package/dist/commonjs/tools/category-search-tool/CategorySearchTool.output.schema.js +2 -1
  66. package/dist/commonjs/tools/category-search-tool/CategorySearchTool.output.schema.js.map +1 -1
  67. package/dist/commonjs/tools/directions-tool/DirectionsTool.output.schema.d.ts +66 -66
  68. package/dist/commonjs/tools/isochrone-tool/IsochroneTool.output.schema.d.ts +28 -28
  69. package/dist/commonjs/tools/resource-reader-tool/ResourceReaderTool.d.ts +28 -0
  70. package/dist/commonjs/tools/resource-reader-tool/ResourceReaderTool.d.ts.map +1 -0
  71. package/dist/commonjs/tools/resource-reader-tool/ResourceReaderTool.input.schema.d.ts +10 -0
  72. package/dist/commonjs/tools/resource-reader-tool/ResourceReaderTool.input.schema.d.ts.map +1 -0
  73. package/dist/commonjs/tools/resource-reader-tool/ResourceReaderTool.input.schema.js +13 -0
  74. package/dist/commonjs/tools/resource-reader-tool/ResourceReaderTool.input.schema.js.map +1 -0
  75. package/dist/commonjs/tools/resource-reader-tool/ResourceReaderTool.js +141 -0
  76. package/dist/commonjs/tools/resource-reader-tool/ResourceReaderTool.js.map +1 -0
  77. package/dist/commonjs/tools/resource-reader-tool/ResourceReaderTool.output.schema.d.ts +19 -0
  78. package/dist/commonjs/tools/resource-reader-tool/ResourceReaderTool.output.schema.d.ts.map +1 -0
  79. package/dist/commonjs/tools/resource-reader-tool/ResourceReaderTool.output.schema.js +13 -0
  80. package/dist/commonjs/tools/resource-reader-tool/ResourceReaderTool.output.schema.js.map +1 -0
  81. package/dist/commonjs/tools/reverse-geocode-tool/ReverseGeocodeTool.input.schema.d.ts +1 -1
  82. package/dist/commonjs/tools/reverse-geocode-tool/ReverseGeocodeTool.output.schema.d.ts +538 -538
  83. package/dist/commonjs/tools/search-and-geocode-tool/SearchAndGeocodeTool.d.ts.map +1 -1
  84. package/dist/commonjs/tools/search-and-geocode-tool/SearchAndGeocodeTool.input.schema.d.ts +17 -17
  85. package/dist/commonjs/tools/search-and-geocode-tool/SearchAndGeocodeTool.input.schema.d.ts.map +1 -1
  86. package/dist/commonjs/tools/search-and-geocode-tool/SearchAndGeocodeTool.input.schema.js +6 -30
  87. package/dist/commonjs/tools/search-and-geocode-tool/SearchAndGeocodeTool.input.schema.js.map +1 -1
  88. package/dist/commonjs/tools/search-and-geocode-tool/SearchAndGeocodeTool.js +2 -11
  89. package/dist/commonjs/tools/search-and-geocode-tool/SearchAndGeocodeTool.js.map +1 -1
  90. package/dist/commonjs/tools/search-and-geocode-tool/SearchAndGeocodeTool.output.schema.d.ts +1514 -623
  91. package/dist/commonjs/tools/search-and-geocode-tool/SearchAndGeocodeTool.output.schema.d.ts.map +1 -1
  92. package/dist/commonjs/tools/search-and-geocode-tool/SearchAndGeocodeTool.output.schema.js +9 -4
  93. package/dist/commonjs/tools/search-and-geocode-tool/SearchAndGeocodeTool.output.schema.js.map +1 -1
  94. package/dist/commonjs/tools/static-map-image-tool/StaticMapImageTool.d.ts.map +1 -1
  95. package/dist/commonjs/tools/static-map-image-tool/StaticMapImageTool.input.schema.d.ts +8 -8
  96. package/dist/commonjs/tools/static-map-image-tool/StaticMapImageTool.js +26 -7
  97. package/dist/commonjs/tools/static-map-image-tool/StaticMapImageTool.js.map +1 -1
  98. package/dist/commonjs/tools/toolRegistry.d.ts +2 -1
  99. package/dist/commonjs/tools/toolRegistry.d.ts.map +1 -1
  100. package/dist/commonjs/tools/toolRegistry.js +2 -0
  101. package/dist/commonjs/tools/toolRegistry.js.map +1 -1
  102. package/dist/commonjs/tools/version-tool/VersionTool.d.ts.map +1 -1
  103. package/dist/commonjs/tools/version-tool/VersionTool.js +7 -7
  104. package/dist/commonjs/tools/version-tool/VersionTool.js.map +1 -1
  105. package/dist/commonjs/utils/httpPipeline.d.ts +5 -0
  106. package/dist/commonjs/utils/httpPipeline.d.ts.map +1 -1
  107. package/dist/commonjs/utils/httpPipeline.js +46 -1
  108. package/dist/commonjs/utils/httpPipeline.js.map +1 -1
  109. package/dist/commonjs/utils/tracing.d.ts.map +1 -1
  110. package/dist/commonjs/utils/tracing.js +17 -0
  111. package/dist/commonjs/utils/tracing.js.map +1 -1
  112. package/dist/commonjs/version.json +4 -4
  113. package/dist/esm/config/toolConfig.d.ts +10 -0
  114. package/dist/esm/config/toolConfig.d.ts.map +1 -1
  115. package/dist/esm/config/toolConfig.js +35 -0
  116. package/dist/esm/config/toolConfig.js.map +1 -1
  117. package/dist/esm/index.d.ts +1 -1
  118. package/dist/esm/index.d.ts.map +1 -1
  119. package/dist/esm/index.js +168 -14
  120. package/dist/esm/index.js.map +1 -1
  121. package/dist/esm/prompts/BasePrompt.d.ts +40 -0
  122. package/dist/esm/prompts/BasePrompt.d.ts.map +1 -0
  123. package/dist/esm/prompts/BasePrompt.js +34 -0
  124. package/dist/esm/prompts/BasePrompt.js.map +1 -0
  125. package/dist/esm/prompts/FindPlacesNearbyPrompt.d.ts +22 -0
  126. package/dist/esm/prompts/FindPlacesNearbyPrompt.d.ts.map +1 -0
  127. package/dist/esm/prompts/FindPlacesNearbyPrompt.js +61 -0
  128. package/dist/esm/prompts/FindPlacesNearbyPrompt.js.map +1 -0
  129. package/dist/esm/prompts/GetDirectionsPrompt.d.ts +23 -0
  130. package/dist/esm/prompts/GetDirectionsPrompt.d.ts.map +1 -0
  131. package/dist/esm/prompts/GetDirectionsPrompt.js +63 -0
  132. package/dist/esm/prompts/GetDirectionsPrompt.js.map +1 -0
  133. package/dist/esm/prompts/ShowReachableAreasPrompt.d.ts +23 -0
  134. package/dist/esm/prompts/ShowReachableAreasPrompt.d.ts.map +1 -0
  135. package/dist/esm/prompts/ShowReachableAreasPrompt.js +66 -0
  136. package/dist/esm/prompts/ShowReachableAreasPrompt.js.map +1 -0
  137. package/dist/esm/prompts/promptRegistry.d.ts +29 -0
  138. package/dist/esm/prompts/promptRegistry.d.ts.map +1 -0
  139. package/dist/esm/prompts/promptRegistry.js +35 -0
  140. package/dist/esm/prompts/promptRegistry.js.map +1 -0
  141. package/dist/esm/resources/BaseResource.d.ts +28 -0
  142. package/dist/esm/resources/BaseResource.d.ts.map +1 -0
  143. package/dist/esm/resources/BaseResource.js +28 -0
  144. package/dist/esm/resources/BaseResource.js.map +1 -0
  145. package/dist/esm/resources/MapboxApiBasedResource.d.ts +35 -0
  146. package/dist/esm/resources/MapboxApiBasedResource.d.ts.map +1 -0
  147. package/dist/esm/resources/MapboxApiBasedResource.js +84 -0
  148. package/dist/esm/resources/MapboxApiBasedResource.js.map +1 -0
  149. package/dist/esm/resources/category-list/CategoryListResource.d.ts +27 -0
  150. package/dist/esm/resources/category-list/CategoryListResource.d.ts.map +1 -0
  151. package/dist/esm/resources/category-list/CategoryListResource.js +67 -0
  152. package/dist/esm/resources/category-list/CategoryListResource.js.map +1 -0
  153. package/dist/esm/resources/resourceRegistry.d.ts +6 -0
  154. package/dist/esm/resources/resourceRegistry.d.ts.map +1 -0
  155. package/dist/esm/resources/resourceRegistry.js +27 -0
  156. package/dist/esm/resources/resourceRegistry.js.map +1 -0
  157. package/dist/esm/tools/BaseTool.d.ts +7 -0
  158. package/dist/esm/tools/BaseTool.d.ts.map +1 -1
  159. package/dist/esm/tools/BaseTool.js +19 -0
  160. package/dist/esm/tools/BaseTool.js.map +1 -1
  161. package/dist/esm/tools/MapboxApiBasedTool.d.ts.map +1 -1
  162. package/dist/esm/tools/MapboxApiBasedTool.js +1 -1
  163. package/dist/esm/tools/MapboxApiBasedTool.js.map +1 -1
  164. package/dist/esm/tools/category-list-tool/CategoryListTool.d.ts.map +1 -1
  165. package/dist/esm/tools/category-list-tool/CategoryListTool.js +2 -2
  166. package/dist/esm/tools/category-list-tool/CategoryListTool.js.map +1 -1
  167. package/dist/esm/tools/category-search-tool/CategorySearchTool.d.ts.map +1 -1
  168. package/dist/esm/tools/category-search-tool/CategorySearchTool.input.schema.d.ts +4 -10
  169. package/dist/esm/tools/category-search-tool/CategorySearchTool.input.schema.d.ts.map +1 -1
  170. package/dist/esm/tools/category-search-tool/CategorySearchTool.input.schema.js +5 -43
  171. package/dist/esm/tools/category-search-tool/CategorySearchTool.input.schema.js.map +1 -1
  172. package/dist/esm/tools/category-search-tool/CategorySearchTool.js +2 -7
  173. package/dist/esm/tools/category-search-tool/CategorySearchTool.js.map +1 -1
  174. package/dist/esm/tools/category-search-tool/CategorySearchTool.output.schema.d.ts +204 -204
  175. package/dist/esm/tools/category-search-tool/CategorySearchTool.output.schema.d.ts.map +1 -1
  176. package/dist/esm/tools/category-search-tool/CategorySearchTool.output.schema.js +2 -1
  177. package/dist/esm/tools/category-search-tool/CategorySearchTool.output.schema.js.map +1 -1
  178. package/dist/esm/tools/directions-tool/DirectionsTool.output.schema.d.ts +66 -66
  179. package/dist/esm/tools/isochrone-tool/IsochroneTool.output.schema.d.ts +28 -28
  180. package/dist/esm/tools/resource-reader-tool/ResourceReaderTool.d.ts +28 -0
  181. package/dist/esm/tools/resource-reader-tool/ResourceReaderTool.d.ts.map +1 -0
  182. package/dist/esm/tools/resource-reader-tool/ResourceReaderTool.input.schema.d.ts +10 -0
  183. package/dist/esm/tools/resource-reader-tool/ResourceReaderTool.input.schema.d.ts.map +1 -0
  184. package/dist/esm/tools/resource-reader-tool/ResourceReaderTool.input.schema.js +10 -0
  185. package/dist/esm/tools/resource-reader-tool/ResourceReaderTool.input.schema.js.map +1 -0
  186. package/dist/esm/tools/resource-reader-tool/ResourceReaderTool.js +137 -0
  187. package/dist/esm/tools/resource-reader-tool/ResourceReaderTool.js.map +1 -0
  188. package/dist/esm/tools/resource-reader-tool/ResourceReaderTool.output.schema.d.ts +19 -0
  189. package/dist/esm/tools/resource-reader-tool/ResourceReaderTool.output.schema.d.ts.map +1 -0
  190. package/dist/esm/tools/resource-reader-tool/ResourceReaderTool.output.schema.js +10 -0
  191. package/dist/esm/tools/resource-reader-tool/ResourceReaderTool.output.schema.js.map +1 -0
  192. package/dist/esm/tools/reverse-geocode-tool/ReverseGeocodeTool.input.schema.d.ts +1 -1
  193. package/dist/esm/tools/reverse-geocode-tool/ReverseGeocodeTool.output.schema.d.ts +538 -538
  194. package/dist/esm/tools/search-and-geocode-tool/SearchAndGeocodeTool.d.ts.map +1 -1
  195. package/dist/esm/tools/search-and-geocode-tool/SearchAndGeocodeTool.input.schema.d.ts +17 -17
  196. package/dist/esm/tools/search-and-geocode-tool/SearchAndGeocodeTool.input.schema.d.ts.map +1 -1
  197. package/dist/esm/tools/search-and-geocode-tool/SearchAndGeocodeTool.input.schema.js +6 -30
  198. package/dist/esm/tools/search-and-geocode-tool/SearchAndGeocodeTool.input.schema.js.map +1 -1
  199. package/dist/esm/tools/search-and-geocode-tool/SearchAndGeocodeTool.js +2 -11
  200. package/dist/esm/tools/search-and-geocode-tool/SearchAndGeocodeTool.js.map +1 -1
  201. package/dist/esm/tools/search-and-geocode-tool/SearchAndGeocodeTool.output.schema.d.ts +1514 -623
  202. package/dist/esm/tools/search-and-geocode-tool/SearchAndGeocodeTool.output.schema.d.ts.map +1 -1
  203. package/dist/esm/tools/search-and-geocode-tool/SearchAndGeocodeTool.output.schema.js +9 -4
  204. package/dist/esm/tools/search-and-geocode-tool/SearchAndGeocodeTool.output.schema.js.map +1 -1
  205. package/dist/esm/tools/static-map-image-tool/StaticMapImageTool.d.ts.map +1 -1
  206. package/dist/esm/tools/static-map-image-tool/StaticMapImageTool.input.schema.d.ts +8 -8
  207. package/dist/esm/tools/static-map-image-tool/StaticMapImageTool.js +26 -7
  208. package/dist/esm/tools/static-map-image-tool/StaticMapImageTool.js.map +1 -1
  209. package/dist/esm/tools/toolRegistry.d.ts +2 -1
  210. package/dist/esm/tools/toolRegistry.d.ts.map +1 -1
  211. package/dist/esm/tools/toolRegistry.js +2 -0
  212. package/dist/esm/tools/toolRegistry.js.map +1 -1
  213. package/dist/esm/tools/version-tool/VersionTool.d.ts.map +1 -1
  214. package/dist/esm/tools/version-tool/VersionTool.js +7 -7
  215. package/dist/esm/tools/version-tool/VersionTool.js.map +1 -1
  216. package/dist/esm/utils/httpPipeline.d.ts +5 -0
  217. package/dist/esm/utils/httpPipeline.d.ts.map +1 -1
  218. package/dist/esm/utils/httpPipeline.js +44 -0
  219. package/dist/esm/utils/httpPipeline.js.map +1 -1
  220. package/dist/esm/utils/tracing.d.ts.map +1 -1
  221. package/dist/esm/utils/tracing.js +18 -1
  222. package/dist/esm/utils/tracing.js.map +1 -1
  223. package/dist/esm/version.json +4 -4
  224. package/package.json +10 -12
  225. package/patches/@modelcontextprotocol+sdk+1.21.1.patch +54 -0
  226. package/patches/README.md +41 -0
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ // Copyright (c) Mapbox, Inc.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.BasePrompt = void 0;
6
+ /**
7
+ * Base class for all MCP prompts.
8
+ *
9
+ * Prompts are pre-built, parameterized workflows that guide multi-step geospatial tasks.
10
+ * They capture domain expertise and best practices for common use cases.
11
+ */
12
+ class BasePrompt {
13
+ /**
14
+ * Get the prompt metadata for listing
15
+ */
16
+ getMetadata() {
17
+ return {
18
+ name: this.name,
19
+ description: this.description,
20
+ arguments: this.arguments
21
+ };
22
+ }
23
+ /**
24
+ * Validate that all required arguments are provided
25
+ *
26
+ * @param args - The argument values to validate
27
+ * @throws Error if required arguments are missing
28
+ */
29
+ validateArguments(args) {
30
+ for (const arg of this.arguments) {
31
+ if (arg.required && !args[arg.name]) {
32
+ throw new Error(`Missing required argument: ${arg.name}`);
33
+ }
34
+ }
35
+ }
36
+ }
37
+ exports.BasePrompt = BasePrompt;
38
+ //# sourceMappingURL=BasePrompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BasePrompt.js","sourceRoot":"","sources":["../../../src/prompts/BasePrompt.ts"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,kCAAkC;;;AAQlC;;;;;GAKG;AACH,MAAsB,UAAU;IAgB9B;;OAEG;IACH,WAAW;QACT,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAC;IACJ,CAAC;IAUD;;;;;OAKG;IACO,iBAAiB,CAAC,IAA4B;QACtD,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACjC,IAAI,GAAG,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;gBACpC,MAAM,IAAI,KAAK,CAAC,8BAA8B,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;YAC5D,CAAC;QACH,CAAC;IACH,CAAC;CACF;AAhDD,gCAgDC"}
@@ -0,0 +1,22 @@
1
+ import { BasePrompt } from './BasePrompt.js';
2
+ import type { PromptArgument, PromptMessage } from '@modelcontextprotocol/sdk/types.js';
3
+ /**
4
+ * Prompt for finding places near a location with optional map visualization.
5
+ *
6
+ * This prompt guides the agent through:
7
+ * 1. Geocoding the location (if needed)
8
+ * 2. Searching for places by category
9
+ * 3. Formatting results with map visualization
10
+ *
11
+ * Example queries:
12
+ * - "Find coffee shops near downtown Seattle"
13
+ * - "Show me restaurants near 123 Main St"
14
+ * - "What museums are near the Eiffel Tower?"
15
+ */
16
+ export declare class FindPlacesNearbyPrompt extends BasePrompt {
17
+ readonly name = "find-places-nearby";
18
+ readonly description = "Helps you search for specific types of places near a location with optional map visualization";
19
+ readonly arguments: PromptArgument[];
20
+ getMessages(args: Record<string, string>): PromptMessage[];
21
+ }
22
+ //# sourceMappingURL=FindPlacesNearbyPrompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FindPlacesNearbyPrompt.d.ts","sourceRoot":"","sources":["../../../src/prompts/FindPlacesNearbyPrompt.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACd,MAAM,oCAAoC,CAAC;AAE5C;;;;;;;;;;;;GAYG;AACH,qBAAa,sBAAuB,SAAQ,UAAU;IACpD,QAAQ,CAAC,IAAI,wBAAwB;IACrC,QAAQ,CAAC,WAAW,mGAC8E;IAElG,QAAQ,CAAC,SAAS,EAAE,cAAc,EAAE,CAkBlC;IAEF,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,aAAa,EAAE;CAyB3D"}
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ // Copyright (c) Mapbox, Inc.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.FindPlacesNearbyPrompt = void 0;
6
+ const BasePrompt_js_1 = require("./BasePrompt.js");
7
+ /**
8
+ * Prompt for finding places near a location with optional map visualization.
9
+ *
10
+ * This prompt guides the agent through:
11
+ * 1. Geocoding the location (if needed)
12
+ * 2. Searching for places by category
13
+ * 3. Formatting results with map visualization
14
+ *
15
+ * Example queries:
16
+ * - "Find coffee shops near downtown Seattle"
17
+ * - "Show me restaurants near 123 Main St"
18
+ * - "What museums are near the Eiffel Tower?"
19
+ */
20
+ class FindPlacesNearbyPrompt extends BasePrompt_js_1.BasePrompt {
21
+ name = 'find-places-nearby';
22
+ description = 'Helps you search for specific types of places near a location with optional map visualization';
23
+ arguments = [
24
+ {
25
+ name: 'location',
26
+ description: 'The location to search near (address, place name, or coordinates)',
27
+ required: true
28
+ },
29
+ {
30
+ name: 'category',
31
+ description: 'Type of place to search for (e.g., "coffee shops", "restaurants", "museums")',
32
+ required: false
33
+ },
34
+ {
35
+ name: 'radius',
36
+ description: 'Search radius in meters (default: 1000)',
37
+ required: false
38
+ }
39
+ ];
40
+ getMessages(args) {
41
+ this.validateArguments(args);
42
+ const { location, category, radius } = args;
43
+ const radiusText = radius ? ` within ${radius} meters` : '';
44
+ const categoryText = category || 'places';
45
+ return [
46
+ {
47
+ role: 'user',
48
+ content: {
49
+ type: 'text',
50
+ text: `Find ${categoryText} near ${location}${radiusText}.
51
+
52
+ Please follow these steps:
53
+ 1. If the location is not in coordinate format, geocode it first using search_and_geocode_tool
54
+ 2. Use category_search_tool or search_tool to find ${categoryText} near the location
55
+ 3. Display the results on a map showing the location and the found places
56
+ 4. Provide a summary of the top results with key details (name, address, distance)
57
+
58
+ Make the output clear and actionable.`
59
+ }
60
+ }
61
+ ];
62
+ }
63
+ }
64
+ exports.FindPlacesNearbyPrompt = FindPlacesNearbyPrompt;
65
+ //# sourceMappingURL=FindPlacesNearbyPrompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FindPlacesNearbyPrompt.js","sourceRoot":"","sources":["../../../src/prompts/FindPlacesNearbyPrompt.ts"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,kCAAkC;;;AAElC,mDAA6C;AAM7C;;;;;;;;;;;;GAYG;AACH,MAAa,sBAAuB,SAAQ,0BAAU;IAC3C,IAAI,GAAG,oBAAoB,CAAC;IAC5B,WAAW,GAClB,+FAA+F,CAAC;IAEzF,SAAS,GAAqB;QACrC;YACE,IAAI,EAAE,UAAU;YAChB,WAAW,EACT,mEAAmE;YACrE,QAAQ,EAAE,IAAI;SACf;QACD;YACE,IAAI,EAAE,UAAU;YAChB,WAAW,EACT,8EAA8E;YAChF,QAAQ,EAAE,KAAK;SAChB;QACD;YACE,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,yCAAyC;YACtD,QAAQ,EAAE,KAAK;SAChB;KACF,CAAC;IAEF,WAAW,CAAC,IAA4B;QACtC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QAE7B,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAC5C,MAAM,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC,WAAW,MAAM,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5D,MAAM,YAAY,GAAG,QAAQ,IAAI,QAAQ,CAAC;QAE1C,OAAO;YACL;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,QAAQ,YAAY,SAAS,QAAQ,GAAG,UAAU;;;;qDAIb,YAAY;;;;sCAI3B;iBAC7B;aACF;SACF,CAAC;IACJ,CAAC;CACF;AAlDD,wDAkDC"}
@@ -0,0 +1,23 @@
1
+ import { BasePrompt } from './BasePrompt.js';
2
+ import type { PromptArgument, PromptMessage } from '@modelcontextprotocol/sdk/types.js';
3
+ /**
4
+ * Prompt for getting turn-by-turn directions between two locations.
5
+ *
6
+ * This prompt guides the agent through:
7
+ * 1. Geocoding start and end locations (if needed)
8
+ * 2. Getting directions via the appropriate routing profile
9
+ * 3. Visualizing the route on a map
10
+ * 4. Providing clear turn-by-turn instructions
11
+ *
12
+ * Example queries:
13
+ * - "Get directions from my office to the airport"
14
+ * - "How do I drive from Seattle to Portland?"
15
+ * - "Walking directions from here to the museum"
16
+ */
17
+ export declare class GetDirectionsPrompt extends BasePrompt {
18
+ readonly name = "get-directions";
19
+ readonly description = "Provides turn-by-turn directions between two locations with options for different travel modes";
20
+ readonly arguments: PromptArgument[];
21
+ getMessages(args: Record<string, string>): PromptMessage[];
22
+ }
23
+ //# sourceMappingURL=GetDirectionsPrompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GetDirectionsPrompt.d.ts","sourceRoot":"","sources":["../../../src/prompts/GetDirectionsPrompt.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACd,MAAM,oCAAoC,CAAC;AAE5C;;;;;;;;;;;;;GAaG;AACH,qBAAa,mBAAoB,SAAQ,UAAU;IACjD,QAAQ,CAAC,IAAI,oBAAoB;IACjC,QAAQ,CAAC,WAAW,oGAC+E;IAEnG,QAAQ,CAAC,SAAS,EAAE,cAAc,EAAE,CAiBlC;IAEF,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,aAAa,EAAE;CA0B3D"}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ // Copyright (c) Mapbox, Inc.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.GetDirectionsPrompt = void 0;
6
+ const BasePrompt_js_1 = require("./BasePrompt.js");
7
+ /**
8
+ * Prompt for getting turn-by-turn directions between two locations.
9
+ *
10
+ * This prompt guides the agent through:
11
+ * 1. Geocoding start and end locations (if needed)
12
+ * 2. Getting directions via the appropriate routing profile
13
+ * 3. Visualizing the route on a map
14
+ * 4. Providing clear turn-by-turn instructions
15
+ *
16
+ * Example queries:
17
+ * - "Get directions from my office to the airport"
18
+ * - "How do I drive from Seattle to Portland?"
19
+ * - "Walking directions from here to the museum"
20
+ */
21
+ class GetDirectionsPrompt extends BasePrompt_js_1.BasePrompt {
22
+ name = 'get-directions';
23
+ description = 'Provides turn-by-turn directions between two locations with options for different travel modes';
24
+ arguments = [
25
+ {
26
+ name: 'from',
27
+ description: 'Starting location (address, place name, or coordinates)',
28
+ required: true
29
+ },
30
+ {
31
+ name: 'to',
32
+ description: 'Destination location (address, place name, or coordinates)',
33
+ required: true
34
+ },
35
+ {
36
+ name: 'mode',
37
+ description: 'Travel mode: driving, walking, or cycling (default: driving)',
38
+ required: false
39
+ }
40
+ ];
41
+ getMessages(args) {
42
+ this.validateArguments(args);
43
+ const { from, to, mode = 'driving' } = args;
44
+ return [
45
+ {
46
+ role: 'user',
47
+ content: {
48
+ type: 'text',
49
+ text: `Get ${mode} directions from ${from} to ${to}.
50
+
51
+ Please follow these steps:
52
+ 1. Geocode both the starting point and destination if they're not in coordinate format
53
+ 2. Use directions_tool to get the route with profile set to ${mode}
54
+ 3. Display the route on a map with clear start and end markers
55
+ 4. Provide:
56
+ - Total distance and estimated travel time
57
+ - Turn-by-turn directions (summarized if very long)
58
+ - Any notable features along the route (tolls, ferries, etc.)
59
+
60
+ Format the output to be clear and easy to follow.`
61
+ }
62
+ }
63
+ ];
64
+ }
65
+ }
66
+ exports.GetDirectionsPrompt = GetDirectionsPrompt;
67
+ //# sourceMappingURL=GetDirectionsPrompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GetDirectionsPrompt.js","sourceRoot":"","sources":["../../../src/prompts/GetDirectionsPrompt.ts"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,kCAAkC;;;AAElC,mDAA6C;AAM7C;;;;;;;;;;;;;GAaG;AACH,MAAa,mBAAoB,SAAQ,0BAAU;IACxC,IAAI,GAAG,gBAAgB,CAAC;IACxB,WAAW,GAClB,gGAAgG,CAAC;IAE1F,SAAS,GAAqB;QACrC;YACE,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,yDAAyD;YACtE,QAAQ,EAAE,IAAI;SACf;QACD;YACE,IAAI,EAAE,IAAI;YACV,WAAW,EAAE,4DAA4D;YACzE,QAAQ,EAAE,IAAI;SACf;QACD;YACE,IAAI,EAAE,MAAM;YACZ,WAAW,EACT,8DAA8D;YAChE,QAAQ,EAAE,KAAK;SAChB;KACF,CAAC;IAEF,WAAW,CAAC,IAA4B;QACtC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QAE7B,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,GAAG,SAAS,EAAE,GAAG,IAAI,CAAC;QAE5C,OAAO;YACL;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,OAAO,IAAI,oBAAoB,IAAI,OAAO,EAAE;;;;8DAIE,IAAI;;;;;;;kDAOhB;iBACzC;aACF;SACF,CAAC;IACJ,CAAC;CACF;AAlDD,kDAkDC"}
@@ -0,0 +1,23 @@
1
+ import { BasePrompt } from './BasePrompt.js';
2
+ import type { PromptArgument, PromptMessage } from '@modelcontextprotocol/sdk/types.js';
3
+ /**
4
+ * Prompt for visualizing areas reachable within a specified time from a location.
5
+ *
6
+ * This prompt guides the agent through:
7
+ * 1. Geocoding the starting location (if needed)
8
+ * 2. Calculating isochrones for the specified travel time
9
+ * 3. Visualizing the reachable areas on a map
10
+ * 4. Providing context about what the isochrone represents
11
+ *
12
+ * Example queries:
13
+ * - "Show me areas I can reach in 15 minutes from downtown"
14
+ * - "What's the 30-minute driving range from our warehouse?"
15
+ * - "Display my 10-minute walk radius from home"
16
+ */
17
+ export declare class ShowReachableAreasPrompt extends BasePrompt {
18
+ readonly name = "show-reachable-areas";
19
+ readonly description = "Visualizes areas that can be reached from a location within a specified time using isochrones";
20
+ readonly arguments: PromptArgument[];
21
+ getMessages(args: Record<string, string>): PromptMessage[];
22
+ }
23
+ //# sourceMappingURL=ShowReachableAreasPrompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShowReachableAreasPrompt.d.ts","sourceRoot":"","sources":["../../../src/prompts/ShowReachableAreasPrompt.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACd,MAAM,oCAAoC,CAAC;AAE5C;;;;;;;;;;;;;GAaG;AACH,qBAAa,wBAAyB,SAAQ,UAAU;IACtD,QAAQ,CAAC,IAAI,0BAA0B;IACvC,QAAQ,CAAC,WAAW,mGAC8E;IAElG,QAAQ,CAAC,SAAS,EAAE,cAAc,EAAE,CAiBlC;IAEF,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,aAAa,EAAE;CA6B3D"}
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ // Copyright (c) Mapbox, Inc.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.ShowReachableAreasPrompt = void 0;
6
+ const BasePrompt_js_1 = require("./BasePrompt.js");
7
+ /**
8
+ * Prompt for visualizing areas reachable within a specified time from a location.
9
+ *
10
+ * This prompt guides the agent through:
11
+ * 1. Geocoding the starting location (if needed)
12
+ * 2. Calculating isochrones for the specified travel time
13
+ * 3. Visualizing the reachable areas on a map
14
+ * 4. Providing context about what the isochrone represents
15
+ *
16
+ * Example queries:
17
+ * - "Show me areas I can reach in 15 minutes from downtown"
18
+ * - "What's the 30-minute driving range from our warehouse?"
19
+ * - "Display my 10-minute walk radius from home"
20
+ */
21
+ class ShowReachableAreasPrompt extends BasePrompt_js_1.BasePrompt {
22
+ name = 'show-reachable-areas';
23
+ description = 'Visualizes areas that can be reached from a location within a specified time using isochrones';
24
+ arguments = [
25
+ {
26
+ name: 'location',
27
+ description: 'Starting location (address, place name, or coordinates)',
28
+ required: true
29
+ },
30
+ {
31
+ name: 'time_minutes',
32
+ description: 'Travel time in minutes (default: 15)',
33
+ required: false
34
+ },
35
+ {
36
+ name: 'mode',
37
+ description: 'Travel mode: driving, walking, or cycling (default: driving)',
38
+ required: false
39
+ }
40
+ ];
41
+ getMessages(args) {
42
+ this.validateArguments(args);
43
+ const { location, time_minutes = '15', mode = 'driving' } = args;
44
+ return [
45
+ {
46
+ role: 'user',
47
+ content: {
48
+ type: 'text',
49
+ text: `Show areas reachable within ${time_minutes} minutes of ${mode} from ${location}.
50
+
51
+ Please follow these steps:
52
+ 1. Geocode the location if it's not in coordinate format
53
+ 2. Use isochrone_tool to calculate the ${time_minutes}-minute ${mode} isochrone
54
+ 3. Visualize the reachable area on a map with:
55
+ - The starting location clearly marked
56
+ - The isochrone polygon showing the reachable area
57
+ - Appropriate styling to make it easy to understand
58
+ 4. Provide context explaining:
59
+ - What area is covered (approximate square miles/km)
60
+ - What this means practically (e.g., "You can reach X locations within ${time_minutes} minutes")
61
+ - Any limitations or caveats (traffic conditions, time of day, etc.)
62
+
63
+ Make the visualization clear and the explanation actionable.`
64
+ }
65
+ }
66
+ ];
67
+ }
68
+ }
69
+ exports.ShowReachableAreasPrompt = ShowReachableAreasPrompt;
70
+ //# sourceMappingURL=ShowReachableAreasPrompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShowReachableAreasPrompt.js","sourceRoot":"","sources":["../../../src/prompts/ShowReachableAreasPrompt.ts"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,kCAAkC;;;AAElC,mDAA6C;AAM7C;;;;;;;;;;;;;GAaG;AACH,MAAa,wBAAyB,SAAQ,0BAAU;IAC7C,IAAI,GAAG,sBAAsB,CAAC;IAC9B,WAAW,GAClB,+FAA+F,CAAC;IAEzF,SAAS,GAAqB;QACrC;YACE,IAAI,EAAE,UAAU;YAChB,WAAW,EAAE,yDAAyD;YACtE,QAAQ,EAAE,IAAI;SACf;QACD;YACE,IAAI,EAAE,cAAc;YACpB,WAAW,EAAE,sCAAsC;YACnD,QAAQ,EAAE,KAAK;SAChB;QACD;YACE,IAAI,EAAE,MAAM;YACZ,WAAW,EACT,8DAA8D;YAChE,QAAQ,EAAE,KAAK;SAChB;KACF,CAAC;IAEF,WAAW,CAAC,IAA4B;QACtC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QAE7B,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,IAAI,EAAE,IAAI,GAAG,SAAS,EAAE,GAAG,IAAI,CAAC;QAEjE,OAAO;YACL;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,+BAA+B,YAAY,eAAe,IAAI,SAAS,QAAQ;;;;yCAItD,YAAY,WAAW,IAAI;;;;;;;4EAOQ,YAAY;;;6DAG3B;iBACpD;aACF;SACF,CAAC;IACJ,CAAC;CACF;AArDD,4DAqDC"}
@@ -0,0 +1,29 @@
1
+ import { FindPlacesNearbyPrompt } from './FindPlacesNearbyPrompt.js';
2
+ import { GetDirectionsPrompt } from './GetDirectionsPrompt.js';
3
+ import { ShowReachableAreasPrompt } from './ShowReachableAreasPrompt.js';
4
+ /**
5
+ * Central registry of all available prompts.
6
+ *
7
+ * This module maintains a readonly collection of prompt instances and provides
8
+ * type-safe access methods.
9
+ */
10
+ declare const ALL_PROMPTS: readonly [FindPlacesNearbyPrompt, GetDirectionsPrompt, ShowReachableAreasPrompt];
11
+ /**
12
+ * Type representing any prompt instance
13
+ */
14
+ export type PromptInstance = (typeof ALL_PROMPTS)[number];
15
+ /**
16
+ * Get all registered prompts
17
+ *
18
+ * @returns Readonly array of all prompt instances
19
+ */
20
+ export declare function getAllPrompts(): readonly PromptInstance[];
21
+ /**
22
+ * Get a prompt by name
23
+ *
24
+ * @param name - The prompt name to look up
25
+ * @returns The prompt instance, or undefined if not found
26
+ */
27
+ export declare function getPromptByName(name: string): PromptInstance | undefined;
28
+ export {};
29
+ //# sourceMappingURL=promptRegistry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promptRegistry.d.ts","sourceRoot":"","sources":["../../../src/prompts/promptRegistry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE;;;;;GAKG;AAGH,QAAA,MAAM,WAAW,kFAIP,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,SAAS,cAAc,EAAE,CAEzD;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAExE"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ // Copyright (c) Mapbox, Inc.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.getAllPrompts = getAllPrompts;
6
+ exports.getPromptByName = getPromptByName;
7
+ const FindPlacesNearbyPrompt_js_1 = require("./FindPlacesNearbyPrompt.js");
8
+ const GetDirectionsPrompt_js_1 = require("./GetDirectionsPrompt.js");
9
+ const ShowReachableAreasPrompt_js_1 = require("./ShowReachableAreasPrompt.js");
10
+ /**
11
+ * Central registry of all available prompts.
12
+ *
13
+ * This module maintains a readonly collection of prompt instances and provides
14
+ * type-safe access methods.
15
+ */
16
+ // Instantiate all prompts
17
+ const ALL_PROMPTS = [
18
+ new FindPlacesNearbyPrompt_js_1.FindPlacesNearbyPrompt(),
19
+ new GetDirectionsPrompt_js_1.GetDirectionsPrompt(),
20
+ new ShowReachableAreasPrompt_js_1.ShowReachableAreasPrompt()
21
+ ];
22
+ /**
23
+ * Get all registered prompts
24
+ *
25
+ * @returns Readonly array of all prompt instances
26
+ */
27
+ function getAllPrompts() {
28
+ return ALL_PROMPTS;
29
+ }
30
+ /**
31
+ * Get a prompt by name
32
+ *
33
+ * @param name - The prompt name to look up
34
+ * @returns The prompt instance, or undefined if not found
35
+ */
36
+ function getPromptByName(name) {
37
+ return ALL_PROMPTS.find((prompt) => prompt.name === name);
38
+ }
39
+ //# sourceMappingURL=promptRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promptRegistry.js","sourceRoot":"","sources":["../../../src/prompts/promptRegistry.ts"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,kCAAkC;;AA8BlC,sCAEC;AAQD,0CAEC;AAxCD,2EAAqE;AACrE,qEAA+D;AAC/D,+EAAyE;AAEzE;;;;;GAKG;AAEH,0BAA0B;AAC1B,MAAM,WAAW,GAAG;IAClB,IAAI,kDAAsB,EAAE;IAC5B,IAAI,4CAAmB,EAAE;IACzB,IAAI,sDAAwB,EAAE;CACtB,CAAC;AAOX;;;;GAIG;AACH,SAAgB,aAAa;IAC3B,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,IAAY;IAC1C,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAC5D,CAAC"}
@@ -0,0 +1,28 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import type { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';
3
+ import type { ServerRequest, ServerNotification, ReadResourceResult } from '@modelcontextprotocol/sdk/types.js';
4
+ /**
5
+ * Base class for all MCP resources
6
+ */
7
+ export declare abstract class BaseResource {
8
+ abstract readonly uri: string;
9
+ abstract readonly name: string;
10
+ abstract readonly description?: string;
11
+ abstract readonly mimeType?: string;
12
+ protected server: McpServer | null;
13
+ /**
14
+ * Installs the resource to the given MCP server.
15
+ */
16
+ installTo(server: McpServer): void;
17
+ /**
18
+ * Resource read logic to be implemented by subclasses.
19
+ * @param uri The resource URI as a string
20
+ * @param extra Additional request context
21
+ */
22
+ abstract read(uri: string, extra?: RequestHandlerExtra<ServerRequest, ServerNotification>): Promise<ReadResourceResult>;
23
+ /**
24
+ * Helper method to send logging messages
25
+ */
26
+ protected log(level: 'debug' | 'info' | 'warning' | 'error', data: unknown): void;
27
+ }
28
+ //# sourceMappingURL=BaseResource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseResource.d.ts","sourceRoot":"","sources":["../../../src/resources/BaseResource.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,KAAK,EACV,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,oCAAoC,CAAC;AAE5C;;GAEG;AACH,8BAAsB,YAAY;IAChC,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IACvC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAEpC,SAAS,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAAQ;IAE1C;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI;IAmBlC;;;;OAIG;IACH,QAAQ,CAAC,IAAI,CACX,GAAG,EAAE,MAAM,EACX,KAAK,CAAC,EAAE,mBAAmB,CAAC,aAAa,EAAE,kBAAkB,CAAC,GAC7D,OAAO,CAAC,kBAAkB,CAAC;IAE9B;;OAEG;IACH,SAAS,CAAC,GAAG,CACX,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,EAC7C,IAAI,EAAE,OAAO,GACZ,IAAI;CAKR"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ // Copyright (c) Mapbox, Inc.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.BaseResource = void 0;
6
+ /**
7
+ * Base class for all MCP resources
8
+ */
9
+ class BaseResource {
10
+ server = null;
11
+ /**
12
+ * Installs the resource to the given MCP server.
13
+ */
14
+ installTo(server) {
15
+ this.server = server;
16
+ server.registerResource(this.name, this.uri, {
17
+ title: this.name,
18
+ description: this.description,
19
+ mimeType: this.mimeType
20
+ }, (uri, extra) => this.read(uri.toString(), extra));
21
+ }
22
+ /**
23
+ * Helper method to send logging messages
24
+ */
25
+ log(level, data) {
26
+ if (this.server?.server) {
27
+ void this.server.server.sendLoggingMessage({ level, data });
28
+ }
29
+ }
30
+ }
31
+ exports.BaseResource = BaseResource;
32
+ //# sourceMappingURL=BaseResource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseResource.js","sourceRoot":"","sources":["../../../src/resources/BaseResource.ts"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,kCAAkC;;;AAUlC;;GAEG;AACH,MAAsB,YAAY;IAMtB,MAAM,GAAqB,IAAI,CAAC;IAE1C;;OAEG;IACH,SAAS,CAAC,MAAiB;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,MAAM,CAAC,gBAAgB,CACrB,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,GAAG,EACR;YACE,KAAK,EAAE,IAAI,CAAC,IAAI;YAChB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,EAED,CACE,GAAQ,EACR,KAA6D,EAC7D,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,CACtC,CAAC;IACJ,CAAC;IAYD;;OAEG;IACO,GAAG,CACX,KAA6C,EAC7C,IAAa;QAEb,IAAI,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;YACxB,KAAK,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;CACF;AAnDD,oCAmDC"}
@@ -0,0 +1,35 @@
1
+ import type { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';
2
+ import type { ServerRequest, ServerNotification, ReadResourceResult } from '@modelcontextprotocol/sdk/types.js';
3
+ import { BaseResource } from './BaseResource.js';
4
+ import type { HttpRequest } from '../utils/types.js';
5
+ /**
6
+ * Base class for Mapbox API-based resources
7
+ */
8
+ export declare abstract class MapboxApiBasedResource extends BaseResource {
9
+ abstract readonly uri: string;
10
+ abstract readonly name: string;
11
+ abstract readonly description?: string;
12
+ abstract readonly mimeType?: string;
13
+ static get mapboxAccessToken(): string | undefined;
14
+ static get mapboxApiEndpoint(): string;
15
+ protected httpRequest: HttpRequest;
16
+ constructor(params: {
17
+ httpRequest: HttpRequest;
18
+ });
19
+ /**
20
+ * Validates if a string has the format of a JWT token (header.payload.signature)
21
+ * Docs: https://docs.mapbox.com/api/accounts/tokens/#token-format
22
+ * @param token The token string to validate
23
+ * @returns boolean indicating if the token has valid JWT format
24
+ */
25
+ private isValidJwtFormat;
26
+ /**
27
+ * Validates and reads the resource.
28
+ */
29
+ read(uri: string, extra?: RequestHandlerExtra<ServerRequest, ServerNotification>): Promise<ReadResourceResult>;
30
+ /**
31
+ * Resource-specific logic to be implemented by subclasses.
32
+ */
33
+ protected abstract execute(uri: string, accessToken: string): Promise<ReadResourceResult>;
34
+ }
35
+ //# sourceMappingURL=MapboxApiBasedResource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MapboxApiBasedResource.d.ts","sourceRoot":"","sources":["../../../src/resources/MapboxApiBasedResource.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,KAAK,EACV,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;GAEG;AACH,8BAAsB,sBAAuB,SAAQ,YAAY;IAC/D,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IACvC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAEpC,MAAM,KAAK,iBAAiB,uBAE3B;IAED,MAAM,KAAK,iBAAiB,WAE3B;IAED,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC;gBAEvB,MAAM,EAAE;QAAE,WAAW,EAAE,WAAW,CAAA;KAAE;IAKhD;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IASxB;;OAEG;IACG,IAAI,CACR,GAAG,EAAE,MAAM,EACX,KAAK,CAAC,EAAE,mBAAmB,CAAC,aAAa,EAAE,kBAAkB,CAAC,GAC7D,OAAO,CAAC,kBAAkB,CAAC;IA4D9B;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,CACxB,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,kBAAkB,CAAC;CAC/B"}
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ // Copyright (c) Mapbox, Inc.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.MapboxApiBasedResource = void 0;
6
+ const BaseResource_js_1 = require("./BaseResource.js");
7
+ const api_1 = require("@opentelemetry/api");
8
+ const tracing_js_1 = require("../utils/tracing.js");
9
+ /**
10
+ * Base class for Mapbox API-based resources
11
+ */
12
+ class MapboxApiBasedResource extends BaseResource_js_1.BaseResource {
13
+ static get mapboxAccessToken() {
14
+ return process.env.MAPBOX_ACCESS_TOKEN;
15
+ }
16
+ static get mapboxApiEndpoint() {
17
+ return process.env.MAPBOX_API_ENDPOINT || 'https://api.mapbox.com/';
18
+ }
19
+ httpRequest;
20
+ constructor(params) {
21
+ super();
22
+ this.httpRequest = params.httpRequest;
23
+ }
24
+ /**
25
+ * Validates if a string has the format of a JWT token (header.payload.signature)
26
+ * Docs: https://docs.mapbox.com/api/accounts/tokens/#token-format
27
+ * @param token The token string to validate
28
+ * @returns boolean indicating if the token has valid JWT format
29
+ */
30
+ isValidJwtFormat(token) {
31
+ // JWT consists of three parts separated by dots: header.payload.signature
32
+ const parts = token.split('.');
33
+ if (parts.length !== 3)
34
+ return false;
35
+ // Check that all parts are non-empty
36
+ return parts.every((part) => part.length > 0);
37
+ }
38
+ /**
39
+ * Validates and reads the resource.
40
+ */
41
+ async read(uri, extra) {
42
+ // First check if token is provided via authentication context
43
+ const authToken = extra?.authInfo?.token;
44
+ const accessToken = authToken || MapboxApiBasedResource.mapboxAccessToken;
45
+ if (!accessToken) {
46
+ const errorMessage = 'No access token available. Please provide via Bearer auth or MAPBOX_ACCESS_TOKEN env var';
47
+ this.log('error', `${this.name}: ${errorMessage}`);
48
+ throw new Error(errorMessage);
49
+ }
50
+ // Validate that the token has the correct JWT format
51
+ if (!this.isValidJwtFormat(accessToken)) {
52
+ const errorMessage = 'Access token is not in valid JWT format';
53
+ this.log('error', `${this.name}: ${errorMessage}`);
54
+ throw new Error(errorMessage);
55
+ }
56
+ const tracer = (0, tracing_js_1.getTracer)();
57
+ const span = tracer.startSpan(`resource.read.${this.name}`, {
58
+ attributes: {
59
+ 'resource.uri': uri,
60
+ 'resource.name': this.name,
61
+ 'operation.type': 'resource_read'
62
+ }
63
+ });
64
+ try {
65
+ // Execute within the span context
66
+ const result = await api_1.context.with(api_1.trace.setSpan(api_1.context.active(), span), async () => {
67
+ return await this.execute(uri, accessToken);
68
+ });
69
+ // Mark span as successful and end it
70
+ span.setStatus({ code: api_1.SpanStatusCode.OK });
71
+ span.end();
72
+ return result;
73
+ }
74
+ catch (error) {
75
+ const errorMessage = error instanceof Error ? error.message : String(error);
76
+ this.log('error', `${this.name}: Error during execution: ${errorMessage}`);
77
+ // Mark span as failed and end it
78
+ span.setStatus({
79
+ code: api_1.SpanStatusCode.ERROR,
80
+ message: errorMessage
81
+ });
82
+ span.end();
83
+ throw error;
84
+ }
85
+ }
86
+ }
87
+ exports.MapboxApiBasedResource = MapboxApiBasedResource;
88
+ //# sourceMappingURL=MapboxApiBasedResource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MapboxApiBasedResource.js","sourceRoot":"","sources":["../../../src/resources/MapboxApiBasedResource.ts"],"names":[],"mappings":"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"}