From 439f5e83ed0148b501682275678ab0cdfc39c032 Mon Sep 17 00:00:00 2001 From: Matthew Podwysocki Date: Fri, 21 Aug 2026 09:46:33 -0400 Subject: [PATCH] fix: create-and-preview-style prompt now defaults to Standard, not streets-v12 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit StyleBuilderTool has defaulted base_style to "standard" for a while now ("ALWAYS use 'standard' as the default for all new styles"), but this prompt's own fallback and instructions were never updated to match: it hardcoded streets-v12 and hand-authored a bare Classic-style JSON skeleton directly in the prompt text, disconnected from the base_style argument entirely (it never referenced it, and would have been structurally wrong for a Standard-based style anyway, since Standard requires the imports/ config structure StyleBuilderTool already knows how to build). Now defaults to "standard" and delegates style construction to style_builder_tool, matching the pattern build-custom-map and other prompts in this repo already use, instead of hand-rolling a Classic-only skeleton in the prompt text. Surfaced while reviewing whether mapbox/mcp-server#248/#250 (switching render_map_tool to Standard, adding base-map restyling) implied any follow-up here — they didn't (this repo's StyleBuilderTool/GeojsonPreview were already Standard-first), but the check surfaced this pre-existing, unrelated inconsistency. Co-Authored-By: Claude Sonnet 5 --- CHANGELOG.md | 4 ++ src/prompts/CreateAndPreviewStylePrompt.ts | 55 ++++++++----------- .../CreateAndPreviewStylePrompt.test.ts | 19 +++++++ 3 files changed, 45 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 044072b..3b75936 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Unreleased +### Fixed + +- **`create-and-preview-style` prompt now defaults to the Standard base style, not Classic `streets-v12`.** `StyleBuilderTool` (used by every other style-related prompt in this repo) has defaulted `base_style` to `"standard"` for a while — "ALWAYS use 'standard' as the default for all new styles" — but this prompt's own `base_style` fallback and its "Create the map style" step were never updated to match: it hardcoded `streets-v12` and hand-authored a bare Classic-style JSON skeleton (`sources`/`layers` background fill) directly in the prompt text, disconnected from the `base_style` argument entirely. Now defaults to `"standard"` and, like `build-custom-map` and other prompts in this repo, delegates style construction to `style_builder_tool` (which knows how to build either Standard or Classic structures correctly) instead of hand-rolling a Classic-only skeleton that would have been wrong for any base style other than the one it hardcoded. + ### Dependencies - Bumped `@modelcontextprotocol/sdk` to `1.30.0`. Not adopting the `2026-07-28` spec revision this release covers (stateless request/response model, elicitation replaced by Multi Round-Trip Requests, Sampling deprecated) — that's a separate migration, tracked in #130, given this repo's own elicitation-based features depend on the mechanism being replaced. Regenerated `patches/@modelcontextprotocol+sdk+1.30.0.patch` (previously pinned to `1.29.0`) — same patch content, applies cleanly to the new version, verified live against the built server. diff --git a/src/prompts/CreateAndPreviewStylePrompt.ts b/src/prompts/CreateAndPreviewStylePrompt.ts index bb7d9ba..4a45eac 100644 --- a/src/prompts/CreateAndPreviewStylePrompt.ts +++ b/src/prompts/CreateAndPreviewStylePrompt.ts @@ -10,8 +10,9 @@ import { BasePrompt, type PromptArgument } from './BasePrompt.js'; * This prompt orchestrates multiple tools to: * 1. Check for an existing public token with styles:read scope * 2. Create a new public token if needed - * 3. Create the map style - * 4. Generate a preview link using the public token + * 3. Build the style specification (style_builder_tool, defaulting to the Standard base style) + * 4. Create the map style (create_style_tool) + * 5. Generate a preview link using the public token */ export class CreateAndPreviewStylePrompt extends BasePrompt { readonly name = 'create-and-preview-style'; @@ -32,7 +33,7 @@ export class CreateAndPreviewStylePrompt extends BasePrompt { { name: 'base_style', description: - 'Optional base style to start from (e.g., "streets-v12", "outdoors-v12", "light-v11", "dark-v11")', + 'Optional base style to start from. Defaults to "standard" (Mapbox\'s modern default). Only use a Classic style (e.g., "streets-v12", "outdoors-v12", "light-v11", "dark-v11") if explicitly requested.', required: false }, { @@ -51,7 +52,7 @@ export class CreateAndPreviewStylePrompt extends BasePrompt { getMessages(args: Record): PromptMessage[] { const styleName = args['style_name']; const styleDescription = args['style_description']; - const baseStyle = args['base_style'] || 'streets-v12'; + const baseStyle = args['base_style'] || 'standard'; const previewLocation = args['preview_location']; const previewZoom = args['preview_zoom'] || '12'; @@ -71,38 +72,26 @@ Follow these steps carefully: * scopes: ["styles:read"] - Save the token value from the response -3. **Create the map style** - - Use the create_style_tool to create the new style - - Style name: "${styleName}"`; +3. **Build the map style** + - Use the style_builder_tool to generate the style specification + - style_name: "${styleName}" + - base_style: "${baseStyle}"`; if (styleDescription) { - instructionText += `\n - Description: "${styleDescription}"`; + instructionText += `\n - Interpret this description into appropriate \`layers\`/\`global_settings\` entries: "${styleDescription}". If there's nothing specific to customize, pass an empty \`layers\` array to use ${baseStyle} as-is.`; + } else { + instructionText += `\n - No specific customizations requested — pass an empty \`layers\` array to use ${baseStyle} as-is.`; } - instructionText += `\n - Base the style on Mapbox ${baseStyle} - - You can start with a basic style like: - \`\`\`json - { - "version": 8, - "name": "${styleName}", - "sources": { - "mapbox": { - "type": "vector", - "url": "mapbox://mapbox.mapbox-streets-v8" - } - }, - "layers": [ - { - "id": "background", - "type": "background", - "paint": { "background-color": "#f0f0f0" } - } - ] - } - \`\`\` + instructionText += `\n - The tool returns a complete Mapbox GL JS style specification + +4. **Create the map style** + - Use the create_style_tool to save the generated style to the Mapbox account + - Style name: "${styleName}" + - Include the complete style specification from step 3 - Save the style ID from the response -4. **Generate preview link** +5. **Generate preview link** - Use the preview_style_tool with the style ID you just created`; if (previewLocation) { @@ -112,16 +101,16 @@ Follow these steps carefully: instructionText += `\n - Set zoom level to: ${previewZoom} - The tool will automatically use the public token you created/found earlier -5. **Validate the style** +6. **Validate the style** - Automatically run validation using the prepare-style-for-production prompt - - Pass the style ID from step 3 as the style_id_or_json parameter + - Pass the style ID from step 4 as the style_id_or_json parameter - This checks: * Expression syntax and correctness * Color contrast for accessibility (WCAG AA) * Style optimization opportunities - Validation is fast (offline processing only) -6. **Present complete results** +7. **Present complete results** - Show the user: * The created style ID * The preview URL (they can click to open in browser) diff --git a/test/prompts/CreateAndPreviewStylePrompt.test.ts b/test/prompts/CreateAndPreviewStylePrompt.test.ts index 900c72c..924a7d6 100644 --- a/test/prompts/CreateAndPreviewStylePrompt.test.ts +++ b/test/prompts/CreateAndPreviewStylePrompt.test.ts @@ -51,6 +51,25 @@ describe('CreateAndPreviewStylePrompt', () => { expect(text).toContain('preview_style_tool'); }); + it('defaults base_style to "standard", not the Classic "streets-v12"', () => { + const result = prompt.execute({ style_name: 'Test Style' }); + const text = result.messages[0].content.text; + + expect(text).toContain('base_style: "standard"'); + expect(text).not.toContain('streets-v12'); + expect(text).toContain('style_builder_tool'); + }); + + it('respects an explicit Classic base_style override', () => { + const result = prompt.execute({ + style_name: 'Test Style', + base_style: 'streets-v12' + }); + const text = result.messages[0].content.text; + + expect(text).toContain('base_style: "streets-v12"'); + }); + it('should include optional arguments in messages', () => { const result = prompt.execute({ style_name: 'Test Style',