Skip to main content

notes_tools/
tools.rs

1//! Agent tool adapters for listing, reading, and creating accessible notes.
2
3mod add_note;
4mod get_note;
5mod list_notes;
6
7use std::{error::Error, path::Path, sync::Arc};
8
9use agent_runtime::ToolRegistry;
10use agent_storage::FamilyStore;
11
12use crate::NotesStore;
13
14pub fn register_tools(
15    registry: &mut ToolRegistry,
16    families: Arc<dyn FamilyStore>,
17    database: impl AsRef<Path>,
18) -> Result<NotesStore, Box<dyn Error + Send + Sync>> {
19    let store = NotesStore::open(database, families)?;
20    registry.register(
21        add_note::definition(),
22        add_note::AddNote::new(store.clone()),
23    )?;
24    registry.register(
25        get_note::definition(),
26        get_note::GetNote::new(store.clone()),
27    )?;
28    registry.register(
29        list_notes::definition(),
30        list_notes::ListNotes::new(store.clone()),
31    )?;
32    Ok(store)
33}