(chunk_id: str, window: int)
| 141 | |
| 142 | |
| 143 | def _chunk_with_neighbors(chunk_id: str, window: int) -> dict[str, Any]: |
| 144 | store = _load_store() |
| 145 | idx = store.chunk_id_to_idx.get(chunk_id) |
| 146 | if idx is None: |
| 147 | raise ValueError(f"Unknown chunk_id: {chunk_id}") |
| 148 | |
| 149 | start = max(0, idx - window) |
| 150 | end = min(len(store.chunks), idx + window + 1) |
| 151 | |
| 152 | center = store.chunks[idx] |
| 153 | neighbors = store.chunks[start:end] |
| 154 | return { |
| 155 | "center": center, |
| 156 | "neighbors": neighbors, |
| 157 | } |
| 158 | |
| 159 | |
| 160 | mcp = FastMCP( |
no test coverage detected