Skip to main content
Glama

get_document

Retrieve the full text of a ranked search hit by its result number, using the same query, corpus, and page size to preserve ranking; page through long documents with offset and max_chars.

Instructions

Fetch the full text of one search hit, identified by its position in the result set.

result_number is the global 1-based rank of the document for this query — the n field of a search_documents hit. Pass the same db, query, corpus and page_size that produced it, or the ranking will not line up.

Long documents are returned in slices: raise offset by max_chars to page through the body.

Args: db: Database title. result_number: 1-based rank of the document within the query's results. query: The same query string used in search_documents. corpus: The same corpus used in search_documents. target: "OPEN" or "USER". page_size: The same page_size used in search_documents. offset: Character offset into the document body. max_chars: Maximum characters of body text to return. include_raw_xml: Also return the untouched DocuXML content. owner_username: Owner of a friend-shared database, when applicable.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dbYes
queryNo.all
corpusNo[ALL]
offsetNo
targetNoOPEN
max_charsNo
page_sizeNo
result_numberYes
owner_usernameNo
include_raw_xmlNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.3/5.0
Behavior4/5

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

No annotations exist, so the description carries the full burden, and it does disclose the key traits: results are a single hit, long bodies come back in slices, and paging is done by raising offset by max_chars. It also notes include_raw_xml returns the untouched DocuXML. It leaves auth/permission behavior (e.g. what OPEN vs USER target implies) implicit.

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?

Front-loaded with the essential constraint (matching search parameters) before the parameter list, and the pagination mechanic is given its own compact sentence. The Args block duplicates some parameter names already visible in the schema, but overall it is tight and earns its length.

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

Completeness4/5

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

An output schema exists, so return-value documentation is not needed, and the description correctly focuses on the coupling to search_documents and on slice-based paging. The one gap is that permission/access semantics for target and owner_username are left unstated.

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 description coverage is 0% across 10 params, yet the Args block explains every one, with real added meaning for result_number ('global 1-based rank…the n field of a search_documents hit'), offset ('character offset into the document body'), max_chars, include_raw_xml and target ('OPEN' or 'USER'). Some entries are thin restatements (db = 'Database title', page_size = 'the same one'), which keeps this short of a 5.

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?

States a specific verb and resource ('Fetch the full text of one search hit') and immediately delimits the retrieval mode to a single ranked result, which cleanly separates it from the sibling search_documents. The identifying key (position in the result set) is named in the first sentence.

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

Usage Guidelines4/5

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

Explicitly states the precondition that db, query, corpus and page_size must match those that produced the hit, 'or the ranking will not line up', and names search_documents as the producing tool. It does not positively state when not to use this tool, but the prerequisite guidance is strong.

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