pub struct PruningCache { /* private fields */ }Expand description
Per-message cache for MCP tool pruning results.
Stores at most one entry keyed on (message_content_hash, tool_list_hash).
A cache miss triggers an LLM call; a hit returns the stored result
immediately. Negative entries (Failed) prevent retry storms when the
pruning LLM is transiently unavailable.
§Cache contract
PruningCache returns previously-computed pruning results keyed on
(message_content_hash, tool_list_hash).
tool_list_hash includes: server_id, name, description, and
input_schema for every tool. Any change to tool metadata (not just the
name set) produces a different hash and causes a cache miss.
PruningCache::reset() is additionally called on:
- New user message (top of
process_user_message_inner) tools/list_changednotification (incheck_tool_refresh)- Manual
/mcp addor/mcp removecommands
PruningParams is not part of the cache key. Callers must not change
PruningParams within a single user turn; this invariant holds because
params are derived from ToolPruningConfig, which is stable within a turn
(config changes trigger a full agent rebuild, not a mid-turn param swap).
Designed for single-owner use (&mut on Agent). Not thread-safe.
Implementations§
Trait Implementations§
Source§impl Clone for PruningCache
impl Clone for PruningCache
Source§fn clone(&self) -> PruningCache
fn clone(&self) -> PruningCache
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PruningCache
impl Debug for PruningCache
Source§impl Default for PruningCache
impl Default for PruningCache
Source§fn default() -> PruningCache
fn default() -> PruningCache
Auto Trait Implementations§
impl Freeze for PruningCache
impl RefUnwindSafe for PruningCache
impl Send for PruningCache
impl Sync for PruningCache
impl Unpin for PruningCache
impl UnsafeUnpin for PruningCache
impl UnwindSafe for PruningCache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request