Skip to main content

walrus_core/memory/
tools.rs

1//! Memory tool schema constructors.
2//!
3//! Returns [`Tool`] schema definitions for `remember` and `recall`.
4//! No handlers — dispatch is handled statically by the daemon event loop.
5
6use crate::model::Tool;
7use schemars::JsonSchema;
8use serde::Deserialize;
9
10#[derive(Deserialize, JsonSchema)]
11pub struct RememberInput {
12    /// Memory key
13    pub key: String,
14    /// Value to remember
15    pub value: String,
16}
17
18#[derive(Deserialize, JsonSchema)]
19pub struct RecallInput {
20    /// Search query for relevant memories
21    pub query: String,
22    /// Maximum number of results (default: 10)
23    pub limit: Option<u32>,
24}
25
26/// Build the `remember` tool schema.
27pub fn remember_schema() -> Tool {
28    Tool {
29        name: "remember".into(),
30        description: "Store a key-value pair in memory.".into(),
31        parameters: schemars::schema_for!(RememberInput),
32        strict: false,
33    }
34}
35
36/// Build the `recall` tool schema.
37pub fn recall_schema() -> Tool {
38    Tool {
39        name: "recall".into(),
40        description: "Search memory for entries relevant to a query.".into(),
41        parameters: schemars::schema_for!(RecallInput),
42        strict: false,
43    }
44}