feat: prefer .md variant when fetching docs.mapbox.com pages#17
Merged
2 commits merged intomainfrom Mar 31, 2026
Merged
Conversation
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>
ctufts
reviewed
Mar 27, 2026
| * https://docs.mapbox.com/accounts/guides → https://docs.mapbox.com/accounts/guides.md | ||
| * https://docs.mapbox.com/accounts/guides/ → https://docs.mapbox.com/accounts/guides.md | ||
| * | ||
| * Example (MAPBOX_DOCS_HOST_OVERRIDE=docs.tilestream.net): |
There was a problem hiding this comment.
Is there any issue with leaving info about our staging url in a public repo? I assume not, but just calling it out.
ctufts
approved these changes
Mar 27, 2026
ctufts
left a comment
There was a problem hiding this comment.
Left a comment on the inclusion of the staging url, if its not a concern it lgtm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
src/utils/docFetcher.tswithtoMarkdownUrl()andfetchDocContent()helpersget_document_toolandbatch_get_documents_toolnow request the.mdvariant ofdocs.mapbox.compages first, falling back to the original URL if the.mdendpoint returns non-2xxMAPBOX_DOCS_HOST_OVERRIDEenv var to redirect alldocs.mapbox.comfetches to a staging host (e.g.docs.tilestream.net) for testing before production rollouttoMarkdownUrl,fetchDocContent, fallback behavior, and host overrideWhy
docs.mapbox.comis adding.mdsuffix support on all pages (already live on staging atdocs.tilestream.net). By requesting the markdown variant, LLMs get clean, structured content instead of HTML, improving the quality of responses grounded in Mapbox documentation.Test plan
npm test)npm run lint && npm run format)MAPBOX_DOCS_HOST_OVERRIDE=docs.tilestream.netand callget_document_toolwith adocs.mapbox.comURL — verify.mdcontent is returnedGet URL
Get URL contents in Markdown