Skip to content

feat!: render style comparison locally and drop share from preview tools - #152

Open
mattpodwysocki wants to merge 3 commits into
mainfrom
style-comparison-local-app
Open

mattpodwysocki wants to merge 3 commits into
mainfrom
style-comparison-local-app

Conversation

@mattpodwysocki

@mattpodwysocki mattpodwysocki commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Why

We're retiring the old Mapbox Location Agent. style_comparison_tool was the only part of this server that used it: it linked to and framed agent.mapbox.com/tools/style-compare. Searching the repo turns up no other uses.

What changed

style_comparison_tool

  • The tool now returns structuredContent (before, after, accessToken, beforePreviewUrl, afterPreviewUrl, and optional center/zoom) with a new output schema. The ui://mapbox/style-comparison/index.html panel reads that payload directly instead of parsing a hosted URL.
  • Removed the agent.mapbox.com link, the legacy MCP-UI externalUrl resource, frameDomains, and the panel's "Open in browser" button.
  • Sharing: in place of the hosted comparison link, the result includes a Styles API preview link (api.mapbox.com/styles/v1/{user}/{id}.html) for each style, with the map position if one was given. You can open or share them on their own, and clients without MCP Apps support get these links in the text. They work with the token you pass as accessToken. With the auto-generated token they stop after an hour, and the result text says so.
  • When no accessToken is passed, the tool creates a 1-hour tk.* token. Before, it created a permanent pk.* token on every call, because the hosted page rejected tk.*.
  • The panel now has what the hosted page did well: styles load with ?fresh=true, and a style that fails to load shows which side failed and why (404, 401 or 403). It also checks style IDs before using them and says so if GL JS fails to load. Errors after a style has loaded, such as a missing tile, no longer replace the map.
  • Renamed StyleComparisonTool.schema.ts to StyleComparisonTool.input.schema.ts to match the repo's naming rule.

preview_style_tool

  • Removed share. It only checked that accessToken was set, so passing your own pk.* token does the same thing. A call that still sends share won't fail; the option is ignored.

Breaking changes

  • share is removed from both tools.
  • style_comparison_tool no longer returns a comparison URL or an MCP-UI resource. It returns a preview link per style instead.

Both are in the CHANGELOG under Unreleased.

Testing

  • Rewrote the tool tests, and added panel tests that run the panel's script against a fake mapboxgl. They cover map setup, waiting for both styles to load before adding the slider, which side failed, errors after a style has loaded, rejecting a bad style ID, and GL JS failing to load.
  • npm test: 53 files, 660 tests pass. npm run build, lint and Prettier are clean. In the naming snapshot, only the two tool descriptions changed.
  • Not yet tried in Claude Desktop or Goose.

🤖 Generated with Claude Code

style_comparison_tool no longer links to or frames
agent.mapbox.com/tools/style-compare, as part of retiring the old
Mapbox Location Agent. It returns structuredContent (before, after,
accessToken, center/zoom) that the ui:// comparison panel reads
directly, and auto-mints a 1-hour tk.* token instead of a permanent
pk.* one. The panel picks up the hosted page's fresh=true loading and
per-side style error messages.

Both style_comparison_tool and preview_style_tool drop the share
input; passing your own pk.* accessToken does the same thing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mattpodwysocki
mattpodwysocki requested a review from a team as a code owner November 10, 2026 19:33
mattpodwysocki and others added 2 commits November 10, 2026 14:33
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replaces the hosted comparison link for sharing: each side gets a
Styles API preview page URL (with the map position, if given) in both
the result text and structuredContent. The text notes when the links
use the 1-hour auto-generated token.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant