Expand description
In-process helper functions for memory-oriented operations.
These helpers are convenient for Rust callers embedding rust-memex
directly. The authoritative MCP tool contract exposed over stdio and
HTTP/SSE comes from tool_definitions(), which mirrors the shared runtime
surface instead of maintaining a second, drifting schema list here.
§Example
ⓘ
use rust_memex::{MemexEngine, MemexConfig};
use rust_memex::tools::{store_document, search_documents, tool_definitions, ToolResult};
use serde_json::json;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let engine = MemexEngine::for_app("my-app", "documents").await?;
// Store a document using the local helper API
let result = store_document(
&engine,
"doc-1".to_string(),
"Important patient notes about feline diabetes".to_string(),
json!({"patient_id": "P-123", "doc_type": "notes"}),
).await?;
assert!(result.success);
// Search for documents
let results = search_documents(&engine, "diabetes".to_string(), 5, None).await?;
println!("Found {} documents", results.len());
// Get the canonical MCP tool definitions exposed by rust-memex
let tools = tool_definitions();
println!("Available tools: {:?}", tools.iter().map(|t| &t.name).collect::<Vec<_>>());
Ok(())
}Structs§
- Tool
Definition - MCP tool definition schema.
- Tool
Result - Result type for tool operations.
Functions§
- delete_
document - Delete a document by ID.
- delete_
documents_ by_ filter - Delete all documents matching a metadata filter.
- get_
document - Get a document by ID.
- search_
documents - Search memory semantically using vector similarity.
- store_
document - Store text in memory with automatic embedding generation.
- store_
documents_ batch - Batch store multiple documents efficiently.
- tool_
definitions - Get the canonical MCP tool definitions exposed by rust-memex transports.