Skip to main content
Glama

Fetch Doc

fetch_doc
Read-only

Fetches documentation pages as clean Markdown for LLM consumption from Ansible docs, Red Hat docs, or CoP README URLs found by search_docs, with optional token limits.

Instructions

Fetch a docs page as clean Markdown.

Returns documentation content ready for LLM consumption. Use search_docs to discover relevant page URLs. Accepts docs.ansible.com, docs.redhat.com, or CoP good-practices raw GitHub README.adoc URLs from search_docs hits (not arbitrary raw.githubusercontent.com hosts).

docs.redhat.com URLs are fetched over unauthenticated public HTTP (HTML → markdown, soft-404 detection, /html/ rewriting). When public retrieval fails (bot protection, HTTP errors, not-found pages), the error explains how to connect the GA Red Hat Documentation MCP server (https://docs-mcp.api.redhat.com/mcp) directly in your AI client. search_docs with the aap-2.5/aap-2.6/aap-2.7 sources uses shipped local manifests and is unaffected.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "url": "<url>"
    },
    "name": "fetch_doc"
  }
}

Input Schema

NameRequiredDescriptionDefault
urlYesA docs.ansible.com, docs.redhat.com, or CoP raw GitHub README.adoc URL from search_docs hits, to fetch as markdown
max_tokensNoIf set, return error instead of content when the page exceeds this token count. docs.ansible.com uses the x-markdown-tokens response header; CoP and Embed estimate tokens from the fetched body.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.10.0
    • changedInput schema / properties / max_tokens / description
      Previous value: -"If set, return error instead of content when the page exceeds this token count. Checked after fetching via the x-markdown-tokens response header."New value: +"If set, return error instead of content when the page exceeds this token count. docs.ansible.com uses the x-markdown-tokens response header; CoP and Embed estimate tokens from the fetched body."
    • changedInput schema / properties / url / description
      Previous value: -"A docs.ansible.com or docs.redhat.com URL to fetch as markdown"New value: +"A docs.ansible.com, docs.redhat.com, or CoP raw GitHub README.adoc URL from search_docs hits, to fetch as markdown"
  2. Changed1 schema field changedv0.8.0
    • changedInput schema / properties / url / description
      Previous value: -"A docs.ansible.com URL to fetch as markdown"New value: +"A docs.ansible.com or docs.redhat.com URL to fetch as markdown"
  3. First observedv0.7.0

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The annotations already mark this as a read-only, open-world operation, but the description adds substantial operational detail: HTML-to-Markdown conversion, soft-404 detection, /html/ rewriting for docs.redhat.com, and the fallback advice when bot protection or HTTP errors occur. It also notes that search_docs with aap-2.5/2.6/2.7 sources is unaffected, which is useful context an agent would not get from annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core action and then layers constraints, though the docs.redhat.com paragraph is somewhat dense and includes an external URL that adds length. Every sentence still carries relevant information, so the sprawl is justified.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With an output schema present, return-value explanation is not required, and the description already covers host restrictions, retrieval mechanics, failure behavior, and the search_docs relationship. An agent has everything needed to call this correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description adds real meaning by clarifying where the url value should come from ('search_docs hits') and which hosts are valid. The max_tokens behavior is left entirely to the schema, but the schema explains it clearly.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb and resource ('Fetch a docs page as clean Markdown') and immediately clarifies the output form ('Returns documentation content ready for LLM consumption'). It also implicitly separates itself from search_docs, which is named as the discovery step rather than the fetch step.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It states explicitly to use search_docs to discover relevant page URLs, restricts the accepted URL hosts, and excludes arbitrary raw.githubusercontent.com hosts. The docs.redhat.com fallback path is also spelled out, including what to do when public retrieval fails.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.