Skip to content

Add geocoding disambiguation with elicitations#98

Open
mattpodwysocki wants to merge 5 commits intomainfrom
add-geocoding-disambiguation
Open

Add geocoding disambiguation with elicitations#98
mattpodwysocki wants to merge 5 commits intomainfrom
add-geocoding-disambiguation

Conversation

@mattpodwysocki
Copy link
Contributor

@mattpodwysocki mattpodwysocki commented Jan 13, 2026

Add Geocoding Disambiguation with Elicitations

Overview

Implements elicitation support in the search_and_geocode_tool to improve accuracy when searching for ambiguous location names. When the Mapbox Search API returns multiple results (2-10), the tool presents an interactive selection form to let users choose the correct location instead of returning all results.

What are Elicitations?

Elicitations are part of the MCP specification that allow servers to request additional information from users through the client during tool execution. They support two modes:

  • Form mode (used here): Structured data collection with JSON Schema validation
  • URL mode: Out-of-band interactions for sensitive operations (auth, payments, etc.)

Changes

  • Enhanced SearchAndGeocodeTool to use server.elicitInput() when 2-10 results are returned
  • Presents interactive dropdown with human-readable location labels
  • Uses enum with enumNames for better UX
  • Gracefully falls back to returning all results if:
    • Elicitation fails
    • User declines to select
    • Client doesn't support elicitations
    • Only 1 result returned (no elicitation needed)
    • More than 10 results (too many options)
  • Added 8 unit tests covering all elicitation scenarios

User Experience

Before:

User: "Search for Springfield"
Tool: Returns all 10 Springfield locations
User: Has to manually identify which one they meant

After:

User: "Search for Springfield"
Tool: "Found 10 results. Please select the correct location:"
      [Interactive dropdown with options like:]
      - Springfield - Springfield, Illinois, United States
      - Springfield - Springfield, Massachusetts, United States
      - Springfield - Springfield, Missouri, United States
      ...
User: Selects "Springfield, Massachusetts"
Tool: Returns only the selected location

Client Support

Client Elicitations Support
MCP Inspector ✅ Full support
VS Code ✅ Full support
Cursor ✅ Full support
Claude Desktop ✅ Now supported
Claude Code ✅ Now supported

Test plan

  • All tests pass (620 tests)
  • Test with {"q": "Springfield"} — should trigger elicitation
  • Test with {"q": "Paris"} — single result, no elicitation
  • Test decline/cancel behavior falls back to returning all results

🤖 Generated with Claude Code

@mattpodwysocki mattpodwysocki requested a review from a team as a code owner January 13, 2026 19:19
mattpodwysocki added a commit that referenced this pull request Jan 15, 2026
…servers

Technical deep-dive comparing Mapbox MCP Server against competitors:

Key Findings:
- Mapbox: 24 tools (most comprehensive)
- TomTom: 11 tools
- Google Grounding Lite: 3 tools
- Google Community: 7 tools

Mapbox Unique Strengths:
- 9 offline geospatial tools (only server with offline capabilities)
- Most sophisticated routing (multi-waypoint, exclusions, constraints)
- Only server with map matching for GPS trace cleanup
- Only server with travel time matrices
- Production-ready monitoring (OpenTelemetry)
- MCP protocol leadership (Resources, MCP-UI, Elicitations in progress)

Competitor Strengths:
- TomTom: Real-time traffic incidents (unique)
- Google Grounding: Weather data (unique)
- Google Community: Reviews/ratings, elevation data

Document includes:
- Complete tool inventory for all servers
- Feature comparison matrices
- Use case fit analysis
- Deployment options
- Pricing comparison
- Roadmap (mentions elicitations in progress - PRs #98, #99)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
mattpodwysocki and others added 4 commits March 17, 2026 19:02
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>
- Implement elicitation support for SearchAndGeocodeTool
- When 2-10 results are returned, present user with selection form
- User can select specific result or decline to see all results
- Falls back gracefully if elicitation fails or is unsupported
- Uses enum with enumNames for better UX in supporting clients

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Test elicitation triggers when 2-10 results returned
- Test no elicitation with 1 result or >10 results
- Test user accepts elicitation (returns selected result)
- Test user declines elicitation (returns all results)
- Test graceful fallback when elicitation fails
- Test graceful fallback when server not installed
- Test enumNames are correctly formatted with location labels
- Mock server.elicitInput and sendLoggingMessage for testing

All 25 SearchAndGeocodeTool tests passing.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mattpodwysocki mattpodwysocki force-pushed the add-geocoding-disambiguation branch from 7d8cab3 to 2e0a0fe Compare March 17, 2026 23:03
Copy link

@prisma-cloud-devsecops prisma-cloud-devsecops bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prisma Cloud has found errors in this PR ⬇️

package.json Outdated
"@mcp-ui/server": "^6.1.0",
"@modelcontextprotocol/ext-apps": "^1.1.1",
"@modelcontextprotocol/sdk": "^1.27.1",
"@mcp-ui/server": "^5.13.1",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mcp-ui/server 5.16.3 / package.json

Total vulnerabilities: 3

Critical: 1 High: 2 Medium: 0 Low: 0
Vulnerability IDSeverityCVSSFixed inStatus
CVE-2026-29045 CRITICAL CRITICAL 9.8 - Open
CVE-2026-2391 HIGH HIGH 7.5 - Open
CVE-2026-29087 HIGH HIGH - - Open

package.json Outdated
"@modelcontextprotocol/ext-apps": "^1.1.1",
"@modelcontextprotocol/sdk": "^1.27.1",
"@mcp-ui/server": "^5.13.1",
"@modelcontextprotocol/sdk": "^1.25.2",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@modelcontextprotocol/sdk 1.25.2 / package.json

Total vulnerabilities: 4

Critical: 1 High: 3 Medium: 0 Low: 0
Vulnerability IDSeverityCVSSFixed inStatus
CVE-2026-29045 CRITICAL CRITICAL 9.8 - Open
CVE-2026-2391 HIGH HIGH 7.5 - Open
CVE-2026-29087 HIGH HIGH - - Open
CVE-2026-25536 HIGH HIGH - 1.26.0 Open

Runs npm audit fix to address 3 high severity vulnerabilities:
- @hono/node-server < 1.19.10 (authorization bypass)
- @modelcontextprotocol/sdk 1.10.0–1.25.3 (cross-client data leak)
- hono <= 4.12.6 (JWT algorithm confusion, XSS)

Also restores package.json from main to include @turf/turf and
correct @mcp-ui/server version lost during rebase.

Co-Authored-By: Claude Sonnet 4.6 <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.

1 participant