Skip to content

Feature request: use MCP tasks extension to stream ground_location_tool results #197

Description

@mattpodwysocki

Summary

Convert ground_location_tool to use the MCP tasks extension (SEP-1686, official extension in the 2026-07-28 RC) so the agent gets the cheap, deterministic pieces (place name) immediately while the slower pieces (sampling-classified POI search, isochrone) stream in as they resolve.

Why

ground_location_tool today does roughly:

  1. (Optional) MCP sampling to classify the grounding strategy as routing / neighborhood / poi / region — round-trip to the client's model, variable latency, can take several hundred ms
  2. Parallel fan-out of three Mapbox API calls: reverse geocode, category search (if query), isochrone
  3. Block until all three return
  4. Format + return as one text payload

Steps 2 and 3 are individually quick (each <1s typically) but the sampling step in 1 makes the whole call feel sluggish, and the user sees nothing until everything is done — even though the reverse-geocoded place name is usually available in ~100ms.

A task-based shape lets the server:

  • Return a task handle from tools/call immediately
  • Resolve the reverse-geocode and surface it as the first task update (the agent now has the place name + coords)
  • Resolve the sampling classification in parallel
  • Surface POI and isochrone results as additional updates as they complete
  • Final task state has the formatted summary

For an agent that just needs "what place is this?", it can read the first update and move on — no need to wait for the isochrone. For a user that wants the full grounded context, they get it incrementally rather than as one delayed blob.

Less obvious benefit

The current PR #173 implementation has a fallback path when the client doesn't support sampling: it defaults to neighborhood strategy. A task-based version makes this fallback more graceful — the task can declare immediately what strategies it ran with and what's pending, instead of either blocking on sampling or silently downgrading.

Compatibility

Like the MTS proposal in #196, clients that don't advertise the tasks extension would just get the current behavior: synchronous call, full result at the end. The task path is purely additive.

Implementation notes

  • MapboxApiBasedTool.execute() would need a sibling like executeTask() that returns an in-progress task with hooks to update state — exact shape depends on the final task extension spec (still experimental)
  • Progress updates carry the same structuredContent shape we already return, just incrementally — UI surfaces (Claude Desktop, etc.) that want to render the streaming state can do so without us defining a custom progress contract
  • This would be a good pilot for the tasks extension before tackling the longer-running MTS workflows in Feature request: Mapbox Tiling Service (MTS) tools, leveraging the new MCP tasks extension #196, since the failure mode here is gentle (worst case: same behavior as today)

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions