⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@mattpodwysocki
Copy link
Contributor

Summary

Fixes a schema validation error that occurs when the Mapbox Directions API returns duration_typical or weight_typical as null.

Problem

The API can return these fields as null in certain cases, but our Zod schema was defined as z.number().optional() which only allows the field to be omitted entirely, not set to null. This caused validation errors:

✗ Validation Error: data.routes[0].duration_typical should be number

Solution

Updated the schema to use .nullable().optional() for these fields in:

  • RouteSchema
  • RouteLegSchema
  • RouteStepSchema

Also updated the TypeScript RawRoute interface to allow null values.

Testing

  • ✅ All existing DirectionsTool tests pass (33 tests)
  • ✅ Build succeeds
  • ✅ Can now handle API responses with null values

Files Changed

  • src/tools/directions-tool/DirectionsTool.output.schema.ts - Updated Zod schemas
  • src/tools/directions-tool/cleanResponseData.ts - Updated TypeScript interface

🤖 Generated with Claude Code

mattpodwysocki and others added 4 commits January 12, 2026 16:18
Implements MCP server icons at the correct architectural level (server
initialization) instead of at the tool level. Adds both light and dark
theme variants of the Mapbox logo using base64-encoded SVG data URIs.

- Add mapbox-logo-black.svg for light theme backgrounds
- Add mapbox-logo-white.svg for dark theme backgrounds
- Update server initialization to include icons array with theme property
- Use 800x180 SVG logos embedded as base64 data URIs

This replaces the previous incorrect approach of adding icons to
individual tools, which was not aligned with the MCP specification.

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Updates the MCP SDK from 1.25.1 to 1.25.2 and recreates the output
validation patch for the new version. The patch continues to convert
strict output schema validation errors to warnings, allowing tools
to gracefully handle schema mismatches.

Changes:
- Update @modelcontextprotocol/sdk from ^1.25.1 to ^1.25.2
- Recreate SDK patch for version 1.25.2
- Remove obsolete 1.25.1 patch file
- All 397 tests pass with new SDK version

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
…lues

The Mapbox Directions API can return duration_typical and weight_typical
as null in some cases, but our schema validation was incorrectly defined
as z.number().optional() which only allows the field to be omitted, not
null.

This caused validation errors when the API returned these fields as null:
"data.routes[0].duration_typical should be number"

Changes:
- Updated DirectionsTool.output.schema.ts to use .nullable().optional()
  for duration_typical and weight_typical in RouteSchema, RouteLegSchema,
  and RouteStepSchema
- Updated cleanResponseData.ts RawRoute interface to allow null values
  for duration_typical and weight_typical

This fix allows the tool to correctly handle API responses where these
fields are null.

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
@mattpodwysocki mattpodwysocki requested a review from a team as a code owner January 15, 2026 20:43
mattpodwysocki added a commit that referenced this pull request Jan 15, 2026
Same fix as PR #100 - allows duration_typical and weight_typical to be null.
This fixes the validation error when declining elicitations and getting
routes with null duration_typical values from the API.
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