Skip to content

chore(tools): Add section discovery and targeted fetch to web_fetch#552

Merged
JeanMertz merged 1 commit intomainfrom
prr119
Apr 14, 2026
Merged

chore(tools): Add section discovery and targeted fetch to web_fetch#552
JeanMertz merged 1 commit intomainfrom
prr119

Conversation

@JeanMertz
Copy link
Copy Markdown
Collaborator

Two new optional parameters extend the web_fetch tool to support navigating large documentation pages without fetching everything at once.

list_sections returns a compact XML listing of every headed section on the page. Each entry includes the section's anchor ID, heading level, title, and a short content preview. Five heading-ID resolution patterns are supported: id on the heading itself, id on a parent element, a permalink child anchor, a child element with id, and a preceding sibling anchor.

sections accepts a list of anchor IDs returned by list_sections and returns only the HTML content under those headings, converted to Markdown. This significantly reduces output size when only specific parts of a page are needed.

Typical workflow:

{"url": "https://docs.rs/tokio/latest/tokio/", "list_sections": true}
{"url": "https://docs.rs/tokio/latest/tokio/", "sections": ["modules", "macros"]}

The tool definition in .jp/mcp/tools/web/fetch.toml is updated to expose both parameters with descriptions and examples.

@JeanMertz JeanMertz marked this pull request as ready for review April 14, 2026 10:12
Two new optional parameters extend the `web_fetch` tool to support
navigating large documentation pages without fetching everything at
once.

`list_sections` returns a compact XML listing of every headed section on
the page. Each entry includes the section's anchor ID, heading level,
title, and a short content preview. Five heading-ID resolution patterns
are supported: `id` on the heading itself, `id` on a parent element, a
permalink child anchor, a child element with `id`, and a preceding
sibling anchor.

`sections` accepts a list of anchor IDs returned by `list_sections` and
returns only the HTML content under those headings, converted to
Markdown. This significantly reduces output size when only specific
parts of a page are needed.

Typical workflow:

```json
{"url": "https://docs.rs/tokio/latest/tokio/", "list_sections": true}
{"url": "https://docs.rs/tokio/latest/tokio/", "sections": ["modules", "macros"]}
```

The tool definition in `.jp/mcp/tools/web/fetch.toml` is updated to
expose both parameters with descriptions and examples.

Signed-off-by: Jean Mertz <git@jeanmertz.com>
@JeanMertz JeanMertz merged commit 0977c95 into main Apr 14, 2026
13 checks passed
@JeanMertz JeanMertz deleted the prr119 branch April 14, 2026 10:23
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