Skip to content

Conversation

@mattpodwysocki
Copy link
Contributor

Summary

Implements search_mapbox_docs_tool following the Google Developer Knowledge API approach for enhanced documentation discovery.

Changes

New Tool: search_mapbox_docs_tool

Features:

  • 🔍 Search Mapbox documentation for specific topics
  • 📊 Returns ranked, relevant sections (not entire corpus)
  • 🏷️ Filter by category (apis, sdks, guides, examples)
  • ⚙️ Configurable result limit (1-20, default 5)
  • ⚡ 1-hour caching for performance
  • 🎯 Relevance scoring and ranking algorithm
  • 📝 Context-aware excerpt extraction

Input:

{
  "query": "geocoding rate limits",
  "category": "apis",  // optional
  "limit": 5  // optional, default 5
}

Output:

{
  "results": [
    {
      "title": "Forward Geocoding",
      "excerpt": "...Rate limit: 600 requests per minute...",
      "category": "apis",
      "url": "https://docs.mapbox.com/...",
      "relevanceScore": 0.95
    }
  ],
  "query": "geocoding rate limits",
  "totalResults": 3,
  "category": "apis"
}

Implementation Details

  • Fetches and parses docs.mapbox.com/llms.txt
  • Categorizes sections automatically
  • Calculates relevance scores based on query match
  • Returns structured output with excerpts and URLs
  • In-memory caching with 1-hour TTL

Testing

✅ Comprehensive test suite with 12 tests:

  • Basic search functionality
  • Category filtering
  • Relevance ranking
  • Caching behavior
  • Error handling
  • Edge cases

✅ All 548 tests passing

Related

Closes #68

Part of enhanced documentation discovery initiative inspired by:

Next Steps

This is the first of 5 planned improvements:

Implement search_mapbox_docs_tool following Google Developer Knowledge API
approach for better AI assistance with Mapbox documentation.

Features:
- Search Mapbox documentation for specific topics
- Return ranked, relevant sections (not entire corpus)
- Filter by category (apis, sdks, guides, examples)
- Configurable result limit (1-20, default 5)
- 1-hour caching for performance
- Relevance scoring and ranking algorithm
- Context-aware excerpt extraction

Implementation:
- Fetches and parses docs.mapbox.com/llms.txt
- Categorizes sections automatically
- Calculates relevance scores based on query match
- Returns structured output with excerpts and URLs
- Comprehensive test suite with 12 tests covering:
  - Basic search functionality
  - Category filtering
  - Relevance ranking
  - Caching behavior
  - Error handling
  - Edge cases

Technical details:
- Input schema: query (required), category (optional), limit (optional)
- Output schema: results array with title, excerpt, category, url, relevanceScore
- Caching: In-memory with 1-hour TTL
- All 548 tests passing

Closes #68

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@mattpodwysocki mattpodwysocki requested a review from a team as a code owner February 12, 2026 05:39
@mattpodwysocki mattpodwysocki added documentation Improvements or additions to documentation enhancement New feature or request labels Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Documentation Search Tool for AI-powered doc discovery

1 participant