Expand description
Resource caps (DoS limits) shared by every adapter — the single source of
truth for fact size, recall limit, and why hop depth.
Resource caps shared by every adapter (the MCP server and the language
bindings).
These are security-relevant DoS limits. They live here — not inside any one
adapter — so every transport enforces the same numbers without a manual
“keep in sync” comment, and so a build without the mcp feature still sees
them. Each adapter formats its own transport-native error; only the values
and the clamping policy are shared.
Constants§
- DEFAULT_
WHY_ HOPS - Default hop budget for
whytraversal when the caller supplies none. - MAX_
FACT_ BYTES - Maximum accepted fact size (1 MiB) — prevents allocating huge embeddings.
- MAX_
RECALL_ LIMIT - Cap on a
recalllimit — prevents unbounded vector scans (core does not capk, so the adapters do). - MAX_
WHY_ HOPS - Cap on
whyhop depth — prevents exponential graph fan-out.
Functions§
- clamp_
hops - Clamp a caller-supplied
whyhop budget toMAX_WHY_HOPS. - clamp_
recall_ limit - Clamp a caller-supplied recall limit to
MAX_RECALL_LIMIT.