Skip to content

Fix MCP review findings: sort arrivals, template forwarding, cache keys, schemas#72

Merged
vbhjckfd merged 1 commit into
masterfrom
mcp-review-fixes
Jun 18, 2026
Merged

Fix MCP review findings: sort arrivals, template forwarding, cache keys, schemas#72
vbhjckfd merged 1 commit into
masterfrom
mcp-review-fixes

Conversation

@vbhjckfd

Copy link
Copy Markdown
Owner

Summary

  • Bug fix: get_stop_realtime now sorts arrivals in data.arrivals before building the payload, so the NL text summary reports the correct next arrival (previously it read from unsorted insertion order)
  • stdio proxy: forwards ListResourceTemplatesRequestSchema so timetable://stop/{code} and timetable://route/{name} templates are discoverable by local MCP clients (Claude Desktop, Cursor, etc.)
  • Cache key stability: get_stops_around_location and get_nearby_vehicles normalize float coordinates to 5dp in cache key args, preventing cache fragmentation from GPS precision variation across clients
  • plan_trip output schema: changed ui_blocks type from a misleading z.array(z.object({ type: "map", ... })) to z.tuple([]), accurately reflecting that this tool never emits UI blocks
  • buildTextSummary default: replaced JSON.stringify(structured, null, 2) fallback with "${toolName}: data retrieved." — prevents a large JSON blob from ending up in LLM text content if a new tool is added without a matching case
  • get_stop_geometry shape selection: picks the longest non-empty shape per route instead of just the first, returning the most representative direction polyline

Test plan

  • All 143 existing tests pass (npm test)
  • No new tests needed — all changed behaviour is covered by existing test suite

…ys, schemas

- get_stop_realtime: sort arrivals in payload so data.arrivals[0] is the
  nearest arrival and the NL text summary reports the correct next vehicle
- stdio.js: forward resource templates (ListResourceTemplatesRequestSchema)
  so stop/{code} and route/{name} templates are discoverable via stdio proxy
- get_stops_around_location / get_nearby_vehicles: normalize float coords in
  cache key args to 5dp, preventing cache fragmentation from GPS precision
- plan_trip output schema: z.tuple([]) to reflect that ui_blocks is always
  empty rather than implying a map block may appear
- buildTextSummary default: safe "data retrieved" fallback instead of
  JSON.stringify which could dump large payloads into LLM text content
- get_stop_geometry: pick longest non-empty shape instead of first, ensuring
  the most representative direction polyline is returned per route
@vbhjckfd vbhjckfd merged commit a841da1 into master Jun 18, 2026
4 checks passed
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