Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
## Unreleased

### Resources — use sublevel `llms.txt` per product

docs.mapbox.com restructured its documentation so that `llms.txt` files now exist at every product level (e.g. `docs.mapbox.com/api/llms.txt`, `docs.mapbox.com/help/llms.txt`, `docs.mapbox.com/mapbox-gl-js/llms.txt`) alongside `llms-full.txt` files containing full page content. The root `docs.mapbox.com/llms.txt` is now a pure index of links to these sublevel files rather than a monolithic content file. The previous resources all filtered the root file by category keyword — now that the root contains only link lists, they were effectively returning empty or useless content.

Updated resources to use the appropriate sublevel `llms.txt` files:

- **`resource://mapbox-api-reference`** now fetches `docs.mapbox.com/api/llms.txt` — a clean, structured index of every Mapbox REST API grouped by service (Maps, Navigation, Search, Accounts) with links to full API reference pages
- **`resource://mapbox-guides`** now fetches `docs.mapbox.com/help/llms.txt` (39KB) — the full Mapbox Help Center index with troubleshooting guides, how-to tutorials, and walkthroughs
- **`resource://mapbox-sdk-docs`** now fetches `docs.mapbox.com/mapbox-gl-js/llms.txt` (34KB) — the GL JS documentation index listing all guides, API reference pages, and examples for the primary web mapping SDK
- **`resource://mapbox-reference`** now fetches the root `llms.txt` without filtering and returns the complete product catalog — useful for discovering what documentation exists and finding `llms.txt` URLs for any product
- **`resource://mapbox-examples`** continues to extract playground/demo/example sections from the root index (API Playgrounds, Demos & Projects)

**`docFetcher.fetchCachedText`** — new shared helper that fetches a URL and stores it in `docCache`, used by all five resources to avoid duplicating the fetch+cache pattern.

**`docFetcher.toMarkdownUrl`** — no longer rewrites URLs already ending in `.txt`, `.md`, or `.json`. Previously `get_document_tool` would try to fetch `llms.txt.md` before falling back; now it fetches `llms.txt` directly on the first attempt.

### Replace Algolia search with self-contained llms.txt search

`search_mapbox_docs_tool` no longer depends on the Algolia third-party service. The hosted server shares a single Algolia free-tier quota across all users, making it prone to throttling as usage grows. The new implementation searches directly against the `llms.txt` index files that now exist at every product level on docs.mapbox.com.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class MapboxApiReferenceResource extends BaseResource {
'Mapbox REST API reference index organized by service (Maps, Navigation, Search, Accounts). ' +
'Lists all API endpoints with links to detailed reference pages covering parameters, ' +
'rate limits, authentication, and response formats (Geocoding, Directions, Static Images, ' +
'Tilequery, Matrix, isochrone, Optimization, Styles, Uploads, Datasets, and more).';
'Tilequery, Matrix, Isochrone, Optimization, Styles, Uploads, Datasets, and more).';
readonly mimeType = 'text/markdown';

private httpRequest: HttpRequest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class MapboxExamplesResource extends BaseResource {
readonly description =
'Mapbox interactive API playgrounds, demo applications, and code examples. ' +
'Includes playground URLs for Directions, Search Box, Static Images, ' +
'isochrone, Matrix APIs, and demo apps for real estate, store locator, etc.';
'Isochrone, Matrix APIs, and demo apps for real estate, store locator, etc.';
readonly mimeType = 'text/markdown';

private httpRequest: HttpRequest;
Expand Down
4 changes: 1 addition & 3 deletions src/utils/docFetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ export async function fetchCachedText(
const cached = docCache.get(url);
if (cached !== null) return cached;

const response = await httpRequest(url, {
headers: { Accept: 'text/markdown, text/plain;q=0.9, */*;q=0.8' }
});
const response = await httpRequest(url, {});

if (!response.ok) {
throw new Error(`Failed to fetch ${url}: ${response.statusText}`);
Expand Down
Loading