MCPcopy Create free account
hub / github.com/Open-Quant/openquant / _chunk_with_neighbors

Function _chunk_with_neighbors

scripts/afml_mcp_server.py:143–157  ·  view source on GitHub ↗
(chunk_id: str, window: int)

Source from the content-addressed store, hash-verified

141
142
143def _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
160mcp = FastMCP(

Callers 2

afml_get_chunkFunction · 0.85
afml_get_contextFunction · 0.85

Calls 2

_load_storeFunction · 0.85
maxFunction · 0.85

Tested by

no test coverage detected