feat: union/intersect/difference app tools — polygon ops on a map#195
Open
mattpodwysocki wants to merge 3 commits into
Open
feat: union/intersect/difference app tools — polygon ops on a map#195mattpodwysocki wants to merge 3 commits into
mattpodwysocki wants to merge 3 commits into
Conversation
Seventh-through-ninth tools in the MCP Apps series. Three Turf.js-based offline polygon-operation tools share a single PolygonOpsAppUIResource that renders the input polygons in muted blue and overlays the result in an operation-keyed color (green=union, purple=intersect, orange=difference). When intersect/difference produces no overlapping geometry, the tool still succeeds (isError=false) and the UI shows just the inputs with a "no overlapping geometry" summary. Also adds the three new offline tools to the annotations test's offlineTools list so the open-world-hint test continues to pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Final resource in the series. Same pattern: send size-changed first, delay 60ms, then map.resize() + fitBounds so polygons fill the viewport instead of appearing as tiny dots. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Final tools in the MCP Apps pattern series. Three offline Turf.js-based polygon-operation tools — `union_app_tool`, `intersect_app_tool`, `difference_app_tool` — share a single `PolygonOpsAppUIResource` (`ui://mapbox/polygon-ops-app/index.html`) that renders the input polygons in muted blue and overlays the result in an operation-keyed color.
Color key
A small bottom-left legend swaps in the right swatch + label per operation.
Graceful no-result
When `intersect` or `difference` produces no overlapping geometry, the tool still returns `isError: false` — the agent gets a "no overlapping geometry" summary, and the UI just shows the input polygons (which makes the empty-result case visually obvious).
Stacked on #194
Final PR in the stack. After everything upstream merges, this will retarget to main.
Test plan
🤖 Generated with Claude Code