Fix MCP review findings: sort arrivals, template forwarding, cache keys, schemas#72
Merged
Conversation
…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
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
get_stop_realtimenow sorts arrivals indata.arrivalsbefore building the payload, so the NL text summary reports the correct next arrival (previously it read from unsorted insertion order)ListResourceTemplatesRequestSchemasotimetable://stop/{code}andtimetable://route/{name}templates are discoverable by local MCP clients (Claude Desktop, Cursor, etc.)get_stops_around_locationandget_nearby_vehiclesnormalize float coordinates to 5dp in cache key args, preventing cache fragmentation from GPS precision variation across clientsplan_tripoutput schema: changedui_blockstype from a misleadingz.array(z.object({ type: "map", ... }))toz.tuple([]), accurately reflecting that this tool never emits UI blocksbuildTextSummarydefault: replacedJSON.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 caseget_stop_geometryshape selection: picks the longest non-empty shape per route instead of just the first, returning the most representative direction polylineTest plan
npm test)