read_chunk_neighbors
Expands a document search hit by returning the chunks immediately before and after it, providing surrounding context for definitions, conclusions, or other snippets.
Instructions
Expand a query_documents result by reading the chunks immediately before and after it in the same document. Use when the hit needs more surrounding context — for example, a definition without its example, or a conclusion without its reasoning. Pass chunkIndex from the query_documents result, along with the document's filePath (from ingest_file) or source (from ingest_data). Returns the target chunk (isTarget: true) plus neighbors, sorted ascending by chunkIndex. Out-of-range indices are silently clamped to existing chunks. Defaults: before=2, after=2 (max 50 each). Provide exactly one of filePath or source.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | No | Absolute path to the file (for documents ingested via ingest_file). Example: "/Users/user/documents/manual.pdf". Provide either filePath or source, not both. | |
| source | No | 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. | |
| chunkIndex | Yes | Zero-based target chunk index (non-negative integer). | |
| before | No | Number of chunks to retrieve before the target (0–50, default 2). | |
| after | No | Number of chunks to retrieve after the target (0–50, default 2). |