Skip to content

feat: add search_mapbox_docs_tool powered by Algolia#18

Merged
mattpodwysocki merged 4 commits intomainfrom
feat-search-tool
Mar 31, 2026
Merged

feat: add search_mapbox_docs_tool powered by Algolia#18
mattpodwysocki merged 4 commits intomainfrom
feat-search-tool

Conversation

@mattpodwysocki
Copy link
Copy Markdown
Contributor

Summary

  • Adds search_mapbox_docs_tool — searches all Mapbox documentation via the Algolia index that powers the search box on docs.mapbox.com
  • Returns ranked results with titles (breadcrumb hierarchy), anchor URLs, and content excerpts
  • Strips Algolia HTML highlight tags before returning to keep output clean
  • 8 unit tests covering happy path, empty results, error handling, HTML stripping, null content, and default limit

How it works

The Algolia app ID, search-only API key, and index name are public credentials embedded in every docs.mapbox.com browser session. We POST a query to the Algolia search API and format the ranked hits as markdown.

Typical workflow for an LLM:

  1. search_mapbox_docs_tool("add a marker to a map") → get ranked results with URLs
  2. get_document_tool(url) → fetch the full page content for the best match

Example output

1. **Mapbox GL JS > Examples > Add a marker to the map**
   URL: https://docs.mapbox.com/mapbox-gl-js/example/add-a-marker/
   > Use a Marker to add a visual indicator to the map.

2. **Maps SDK for iOS > Markers > Adding a basic marker**
   URL: https://docs.mapbox.com/ios/maps/guides/add-your-data/markers/#basic-marker
   > The simplest way to add a marker is to specify a coordinate.

🤖 Generated with Claude Code

mattpodwysocki and others added 3 commits March 23, 2026 10:44
docs.mapbox.com will support a .md suffix on all pages, returning clean
markdown instead of HTML. This makes fetched content significantly easier
for LLMs to parse.

- Add docFetcher.ts with toMarkdownUrl() and fetchDocContent()
- Both get_document_tool and batch_get_documents_tool now try the .md URL
  first and fall back to the original URL if unavailable
- Set MAPBOX_DOCS_HOST_OVERRIDE=docs.tilestream.net to test against
  the staging environment where .md is already live

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a new search_mapbox_docs_tool that queries the Algolia index
behind docs.mapbox.com search. Returns ranked results with titles,
anchor URLs, and content excerpts. LLMs can use this to find the
right page before calling get_document_tool to fetch full content.

The Algolia app ID, search-only API key, and index name are public
credentials embedded in every docs.mapbox.com browser session.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mattpodwysocki mattpodwysocki requested a review from a team as a code owner March 24, 2026 21:36
@mattpodwysocki mattpodwysocki merged commit d69bdce into main Mar 31, 2026
2 checks passed
@mattpodwysocki mattpodwysocki deleted the feat-search-tool branch March 31, 2026 14:52
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.

2 participants