feat!: migrate place_details_tool to the Places API - #243
Open
mattpodwysocki wants to merge 1 commit into
Open
Conversation
Switches from the older Details API (search/details/v1/retrieve) to the newer Places API's Details endpoint (places/v1/details/retrieve). Not a compatible swap: the new endpoint takes only mapbox_id (no attribute_sets/language/worldview), and returns a flat object instead of a GeoJSON Feature, so both the input and output schemas changed. Not supporting both APIs since we're not at 1.0 yet. The Places API is Public Preview (1,000 records/month per account, 100/sec, contract may change without notice), so the output schema is deliberately permissive rather than risk another output-validation failure like the one fixed in 0.14.0. Co-Authored-By: Claude Sonnet 5 <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.
What changed
Swaps
place_details_toolfrom the older Details API (search/details/v1/retrieve, docs.mapbox.com/api/search/details/) to the Places API's Details endpoint (places/v1/details/retrieve, docs.mapbox.com/api/search/places/). These are two separate, currently-coexisting Mapbox products, not two versions of the same one. We're not supporting both, since the server isn't at 1.0 yet.This is a breaking change to
place_details_tool's input and output:attribute_sets,language, andworldvieware gone. The Places API's Details endpoint only takesmapbox_id, no equivalent parameters exist.Feature. The new response is a flat object (name,full_address,phone,website,categories,opening_hoursas a plain OSM-format string instead of the old periods/weekday_text structure,coordinates: { latitude, longitude },score: { popularity, reality, closed },address,attributes,photos,building). SeePlaceDetailsTool.output.schema.ts.rating/review_count/pricehave no equivalent in the new API.score.popularity/score.realityare data-quality confidence signals, not user ratings — preserved in the formatted text as "Popularity: N%", but reviews/price/rating lines are gone since there's no data to show.Why the output schema is so permissive
The Places API is Public Preview: 1,000 records/month per account, 100/sec rate limit, and the docs explicitly say the response contract may change without notice. Live testing during development showed real variance in which optional fields are present (
buildingandopening_hoursonly show up on some places;photos/telemetrynever appeared in any live response tested despite being documented). The new output schema uses.passthrough()throughout and makes nearly everything butmapbox_id/nameoptional, specifically to avoid a repeat of the output-validation failure fixed for the old API in 0.14.0 (#240).Verification
mapbox_ids viasearch_and_geocode_toolfor several different POIs (Eiffel Tower, Golden Gate Bridge, Empire State Building, Central Park, a hotel, a media company) and called the new endpoint directly viacurland through the built server via a real MCP stdio client, to ground the schema in actual observed responses rather than just the doc summary.npx tsc --noEmit,npx eslint: clean.urlSafety.test.tsissue already onmain).PlaceDetailsTool.test.tsfixtures to match the real response shape (verified against live data, not just the docs).🤖 Generated with Claude Code