pub struct PostToolUseHandler {
recall: Option<RecallService>,
max_memories: usize,
min_relevance: f32,
}Expand description
Handles PostToolUse hook events.
Surfaces related memories after tool usage.
Fields§
§recall: Option<RecallService>Recall service for searching memories.
max_memories: usizeMaximum number of memories to surface.
min_relevance: f32Minimum relevance score to surface.
Implementations§
Source§impl PostToolUseHandler
impl PostToolUseHandler
Sourcepub fn with_recall(self, recall: RecallService) -> Self
pub fn with_recall(self, recall: RecallService) -> Self
Sets the recall service.
Sourcepub const fn with_max_memories(self, max: usize) -> Self
pub const fn with_max_memories(self, max: usize) -> Self
Sets the maximum number of memories to surface.
Sourcepub const fn with_min_relevance(self, min: f32) -> Self
pub const fn with_min_relevance(self, min: f32) -> Self
Sets the minimum relevance score.
Sourcefn should_lookup(&self, tool_name: &str) -> bool
fn should_lookup(&self, tool_name: &str) -> bool
Determines if a tool use warrants memory lookup. Kept as method for API consistency.
Sourcefn is_prompt_save_tool(tool_name: &str) -> bool
fn is_prompt_save_tool(tool_name: &str) -> bool
Checks if a tool is a prompt save tool.
Sourcefn validate_prompt(&self, tool_input: &Value) -> Option<String>
fn validate_prompt(&self, tool_input: &Value) -> Option<String>
Validates prompt content and returns any issues.
Returns a guidance message if validation issues are found.
Sourcefn extract_query(&self, tool_name: &str, tool_input: &Value) -> Option<String>
fn extract_query(&self, tool_name: &str, tool_input: &Value) -> Option<String>
Extracts a search query from tool input. Kept as method for API consistency.
Searches for related memories.
fn empty_response() -> Result<String>
fn serialize_response(response: &Value) -> Result<String>
fn build_memories_response( tool_name: &str, query: &str, memories: &[RelatedMemory], ) -> Value
fn handle_inner( &self, input: &str, lookup_performed: &mut bool, memories_found: &mut usize, ) -> Result<String>
Trait Implementations§
Source§impl Default for PostToolUseHandler
impl Default for PostToolUseHandler
Source§impl HookHandler for PostToolUseHandler
impl HookHandler for PostToolUseHandler
Auto Trait Implementations§
impl !Freeze for PostToolUseHandler
impl !RefUnwindSafe for PostToolUseHandler
impl Send for PostToolUseHandler
impl Sync for PostToolUseHandler
impl Unpin for PostToolUseHandler
impl !UnwindSafe for PostToolUseHandler
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
Mutably borrows from an owned value. Read more
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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 more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].