Skip to main content

tool_context

Function tool_context 

Source
pub fn tool_context(
    store: &Store,
    key: &str,
) -> Result<Option<ToolContext>, StoreError>
Expand description

A node’s context bundle for a model-facing tool surface: read-only and bounded. Returns None if no node has that key.

§Read-only, deliberately

This builds on build_context and not on context. context is the cached read, and the cache is not free of side effects: a hit writes nothing but a miss calls context_cache_put, and a key whose node has been deleted calls context_cache_delete — a prune. Pruning is the maintenance half of roteiro context --refresh, which exists so that ordinary reads never mutate the store (ADR-0013), and a tool surface is the last place it should reappear. build_context assembles the identical bundle from the live graph and touches nothing, which is the whole difference and the reason for the choice.

§Bounded, and it says so

Each direction is capped at TOOL_CONTEXT_EDGE_CAP and the result carries truncated, each direction’s total, and per-kind omitted counts. A shortened bundle that did not say it was shortened would be the same defect as a limit that silently returns nothing (issue #393): an answer a caller cannot tell from a complete one.

§Errors

Returns StoreError on query failure.