Skip to main content
Glama

Get Document Excerpt

get_doc_excerpt
Read-onlyIdempotent

Retrieve targeted excerpts from large documents based on a query. Uses BM25 relevance to return relevant sections with surrounding context.

Instructions

Get relevant excerpts from a large document matching a query.

Use this instead of get_doc for large documents. Returns targeted excerpts based on BM25 relevance to your query.

Args: url: The URL of the document. query: Query to find relevant sections within the document. max_chunks: Maximum number of chunks to return (default: 5). context_chars: Extra context characters around each chunk (default: 500).

Returns: Document metadata with list of relevant excerpts, each containing content, position, and relevance score.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesThe URL of the document
queryYesQuery to find relevant sections within the document
max_chunksNoMaximum chunks to return
context_charsNoExtra context chars around each chunk

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes
titleYes
sourceYes
excerptsYes
source_urlYes
total_lengthYes
Behavior4/5

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

Annotations already indicate readOnlyHint and idempotentHint, so the safety profile is covered. The description adds behavioral context beyond annotations by mentioning the BM25 relevance algorithm and the return structure (list of excerpts with content, position, and relevance score). It does not discuss edge cases like no relevant sections, but the added context is meaningful.

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 well-structured: purpose, usage, args, and returns are clearly separated. The purpose and usage sentences are front-loaded and efficient. However, the Args and Returns sections largely duplicate schema information, making the description slightly longer than necessary for an AI agent that already has structured data.

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?

Given the output schema exists, the description doesn't need to detail return values, but it does anyway. It provides purpose, usage guidance, parameter defaults, and a clear return summary. The tool is simple and read-only, and the description is complete enough for an agent to select and invoke it correctly.

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

Parameters3/5

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

Schema description coverage is 100% and includes descriptions and defaults for all four parameters. The description's Args section repeats the schema information without adding new semantic meaning, so it does not compensate beyond the baseline for high schema coverage.

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 states a specific verb ('Get'), resource ('relevant excerpts from a large document'), and scope ('matching a query'). It also clearly distinguishes itself from get_doc by explicitly recommending 'Use this instead of get_doc for large documents'.

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?

The description gives explicit when-to-use guidance: 'Use this instead of get_doc for large documents.' This names an alternative tool and the condition for using it. It implies when not to use it (when the document is not large, use get_doc).

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bigbag/llmdoc'

If you have feedback or need assistance with the MCP directory API, please join our Discord server