Skip to main content
Glama
xiuxiansk

mcp-local-rag

by xiuxiansk

read_chunk_neighbors

Retrieve preceding and following chunks around a specified chunk index in the same document to supply richer context for a search hit.

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 []. Defaults: before=2, after=2 (max 50 each).

Input Schema

TableJSON 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).
Behavior5/5

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

With no annotations, the description fully carries the behavioral burden. It discloses the return shape (target chunk with isTarget: true, neighbors ascending), out-of-range behavior (returns []), defaults (before=2, after=2), maximums (50 each), and the constraint to provide exactly one of filePath or source. This is comprehensive for a read-only operation.

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

Conciseness5/5

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

The description is three sentences, front-loaded with the main purpose, and every sentence carries essential information: what the tool does, how to use it, what it returns, edge-case behavior, and defaults. No filler or redundancy.

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?

Despite having 5 parameters and no output schema, the description covers all critical operational aspects: parameter selection, return semantics, ordering, error handling, and defaults. It's sufficient for an agent to invoke the tool correctly in context, and no additional information seems necessary.

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 baseline is 3. The description adds value by explaining how to obtain chunkIndex ('from the result'), reinforcing the 'exactly one of filePath or source' constraint, and restating defaults and max limits. This goes a bit beyond the schema's per-parameter descriptions, earning a 4.

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 clearly states a specific verb ('Read') and resource ('the chunks immediately before and after a query_documents result'), and it distinguishes itself from siblings by being explicitly tied to query_documents results. It's not a search or ingestion tool, but a context-expansion read operation.

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?

The description gives clear context for use: after a query_documents result, pass chunkIndex plus exactly one of filePath or source. It doesn't explicitly mention alternatives or exclusions, but the purpose is distinct enough that usage is unambiguous. A minor gap is not stating when NOT to use it (e.g., when query_documents already provides enough context), but the instructions are practical.

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/xiuxiansk/mcp-local-rag'

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