Skip to main content
Glama

read_chunk_neighbors

Retrieve chunks immediately before and after a query_documents result to provide more surrounding context. Pass chunkIndex and either filePath or source.

Instructions

Read the chunks immediately before and after a query_documents result, in the same document, for more surrounding context. Pass chunkIndex from the result plus exactly one of filePath (ingest_file) or source (ingest_data). Returns the target chunk (isTarget: true) and its neighbors, ascending by chunkIndex; an out-of-range chunkIndex returns []. Optional sourceContext provides heading paths and original line or physical PDF page ranges; multiple heading paths mean the chunk crosses sections. Defaults: before=2, after=2 (max 50 each).

Input Schema

NameRequiredDescriptionDefault
afterNoNumber of chunks to retrieve after the target (0–50, default 2).
beforeNoNumber of chunks to retrieve before the target (0–50, default 2).
sourceNoSource identifier (for ingest_data documents). Provide exactly one of filePath or source. Examples: "https://example.com/page", "clipboard://2024-12-30".
filePathNoAbsolute path to the file (for ingest_file documents). Provide exactly one of filePath or source. Example: "/Users/user/documents/manual.pdf".
chunkIndexYesZero-based target chunk index (non-negative integer).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.15.3
    • changedInput schema / properties / filePath / description
      Previous value: -"Absolute path to the file (for documents ingested via ingest_file). Example: \"/Users/user/documents/manual.pdf\". Provide either filePath or source, not both."New value: +"Absolute path to the file (for ingest_file documents). Provide exactly one of filePath or source. Example: \"/Users/user/documents/manual.pdf\"."
    • changedInput schema / properties / source / description
      Previous value: -"Source identifier used in ingest_data (for data ingested via ingest_data). Examples: \"https://example.com/page\", \"clipboard://2024-12-30\". Provide either filePath or source, not both."New value: +"Source identifier (for ingest_data documents). Provide exactly one of filePath or source. Examples: \"https://example.com/page\", \"clipboard://2024-12-30\"."
  2. Addedv0.13.0

TDQS

A4.6/5.0
Behavior5/5

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

With no annotations present, the description carries the full behavioral burden and does so: it discloses the return shape (target chunk flagged isTarget: true plus neighbors, ascending by chunkIndex), the edge case (out-of-range chunkIndex returns []), and the defaults/limits (before=2, after=2, max 50 each). Optional sourceContext is explained, including that multiple heading paths signal a section-crossing chunk.

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 purpose, then how to call it, then return behavior, then the optional sourceContext detail, then defaults. Every sentence contributes, though it is a dense single block rather than cleanly separated clauses.

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?

No output schema exists, so the description must explain returns, and it does (target + neighbors, ordering, empty result). Combined with the documented defaults, limits, and input constraints, an agent has everything needed to call this correctly against a 5-parameter schema.

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 already 100%, so the baseline is 3. The description adds genuine meaning beyond the schema by stating that chunkIndex originates from a query_documents result and by restating the mutual-exclusion rule for filePath/source, plus the semantics of sourceContext's heading paths.

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 (read the chunks immediately before/after a query_documents result) and ties itself directly to the sibling query_documents, so an agent can distinguish it from a plain search. The scope constraint 'in the same document' further narrows what it returns.

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?

Explains the triggering context clearly: use it after a query_documents result when you need more surrounding context, and it names the exact input to carry over (chunkIndex plus one of filePath/source). It gives no explicit 'when not to use it' or alternative (e.g., re-running query_documents with a wider window), so it stops short of a 5.

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