Skip to content

feat(ground-location-tool): stream results via MCP tasks extension#210

Draft
mattpodwysocki wants to merge 23 commits into
mainfrom
feat/ground-location-task-streaming
Draft

feat(ground-location-tool): stream results via MCP tasks extension#210
mattpodwysocki wants to merge 23 commits into
mainfrom
feat/ground-location-task-streaming

Conversation

@mattpodwysocki

Copy link
Copy Markdown
Contributor

Summary

Converts ground_location_tool to use server.experimental.tasks.registerToolTask (available in @modelcontextprotocol/sdk ^1.29.0) so the tool call returns a task handle immediately rather than blocking until all API calls complete.

Before: tools/call blocks for sampling round-trip + geocode + POI + isochrone (~1-3s total), then returns one payload.

After: tools/call returns a task handle immediately. In the background:

  1. Reverse geocode + sampling classification run in parallel (place name available ~100ms)
  2. POI search + isochrone kick off once strategy is known
  3. Final result stored via storeTaskResult; client polls or listens for notifications/tasks/status

Changes

  • src/tools/MapboxApiBasedTool.ts — make isValidJwtFormat protected so subclasses can use it
  • src/tools/ground-location-tool/GroundLocationTool.ts — override installTo to use registerToolTask; add runTaskBackground for the async fan-out
  • src/index.ts — configure McpServer with InMemoryTaskStore so task lifecycle is managed
  • test/tools/ground-location-tool/GroundLocationTool.test.ts — two new task-flow tests

Known limitations (follow-up work)

  • taskSupport: 'required' — clients without task support cannot call this tool. A 'supported' fallback path that runs inline for non-task clients is needed before this can ship.
  • InMemoryTaskStore — task state is lost on server restart. A persistent store or at least a TTL-based eviction review is needed for production.
  • The 2026-07-28 RC will likely change some experimental API surface; this PR should be rebased once the RC ships.

Closes #197.

Test plan

  • npm test passes (729 tests)
  • Task creates immediately and resolves with place name
  • Task stores failed result when API errors out
  • All existing ground_location_tool tests still pass (run() path unchanged)

🤖 Generated with Claude Code

mattpodwysocki and others added 22 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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Converts ground_location_tool to registerToolTask so tool/call returns
a task handle immediately rather than blocking on sampling + API fan-out.
Reverse geocode and sampling classification now run in parallel in the
background; POI search and isochrone kick off once the strategy resolves.

Requires taskSupport:'required' — only task-capable clients can invoke
this path. The server is configured with InMemoryTaskStore. Fallback for
non-task clients and persistent task storage are left for a follow-up.

Closes #197.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…ptional

Changes taskSupport from 'required' to 'optional' so clients without task
support get the same synchronous result as before. The SDK automatic polling
path handles the fallback: it creates the task internally, waits for the
background work to finish, and returns the result directly without exposing
the task handle to the caller.

pollInterval is set to 50ms so the polling overhead for non-task clients
is negligible.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
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.

Feature request: use MCP tasks extension to stream ground_location_tool results

1 participant