Fetch URLs
Fetch web content via a Python script. Three modes: full page, single anchor section, or anchor discovery.
Commands
Full page as markdown:
bash
uv run "$SKILLS_DIR/scripts/fetch_anchor.py" "<url>"
Single anchor section (URL must contain #fragment):
bash
uv run "$SKILLS_DIR/scripts/fetch_anchor.py" "<url>#<anchor>" --only-current-anchor
List all anchors (shows heading hierarchy):
bash
uv run "$SKILLS_DIR/scripts/fetch_anchor.py" "<url>" --list-anchors
Pagination (for large pages or sections):
bash
uv run "$SKILLS_DIR/scripts/fetch_anchor.py" "<url>" --max-length 5000 --start-index 5000
Raw HTML (combine with any mode above):
bash
uv run "$SKILLS_DIR/scripts/fetch_anchor.py" "<url>" --raw
Flags
| Flag | Description |
|---|---|
--only-current-anchor | Return only the section matching the URL's #fragment |
--raw | Output raw HTML instead of markdown |
--max-length N | Limit output to N characters (enables pagination) |
--start-index N | Start at character N (use with --max-length for next page) |
--list-anchors | List all anchors, grouped by heading hierarchy |
Workflow
- •Full page: pass the URL. HTML is simplified via readability, then converted to markdown. Non-HTML (JSON, plain text) is returned as-is.
- •Anchor mode: if the user provides a URL with
#fragment, pass it with--only-current-anchor. The fragment is extracted from the URL automatically. Captures the full section including all sub-headings at lower levels. - •Discovery: if the user asks for a section but the anchor ID is unknown, use
--list-anchorsfirst. Output shows heading hierarchy with indentation and levels (h1-h6) so you can pick the right anchor. - •Pagination: for large content, use
--max-length. The script appends a truncation notice with the next--start-indexvalue.
Requirements
Requires uv on the system. The script uses PEP 723 inline metadata — uv run resolves and caches dependencies automatically (no venv needed).