Fix schema validation: add missing country property #81
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.
Problem
The Mapbox Search Box API returns
countryas a top-level property infeature.properties, but the output schema didn't include it.This causes validation warnings when using the MCP server:
Real API Response Example
Testing
search_and_geocode_tool(q="Paris")returns:{ "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": { "type": "Point", "coordinates": [2.348392, 48.853495] }, "properties": { "name": "Paris", "place_formatted": "France", "feature_type": "place", "coordinates": { "longitude": 2.348392, "latitude": 48.853495 }, "maki": "marker", "country": "France" // ← This property was missing from schema } } ] }Note that
countryappears at the top level ofproperties, not just nested incontext.country.name.Solution
country: z.string().optional()toSearchBoxFeaturePropertiesSchema.passthrough()to allow future API additions without breakingThe API returns country in both places:
properties.country: "France" (top-level, for convenience)properties.context.country.name: "France" (nested, full context)Now the schema accepts both structures without validation warnings.
Testing
✅ All 31 existing tests pass
✅ Validated against real API responses
✅ No breaking changes