Package com.tnsai.tools.memory
Class MemoryTools
java.lang.Object
com.tnsai.tools.memory.MemoryTools
Function-shape Reever memory tools — persistent agent memory via the
Reever HTTP API. Replaces the legacy
ReeverTool (single dispatched
tool). Splits the most-useful subset (store / recall / search) into typed- Since:
- 0.5.7 (Phase 2 batch 17b — built-in tool migration to function shape, see #188)
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor — picks REEVER_API_URL from env (fallback to public endpoint).MemoryTools(String apiUrl) Explicit-URL constructor (useful for self-hosted Reever).MemoryTools(String apiUrl, okhttp3.OkHttpClient http, com.fasterxml.jackson.databind.ObjectMapper mapper) Full constructor for tests / shared HTTP. -
Method Summary
Modifier and TypeMethodDescriptionreeverRecall(String key) reeverSearch(String query, String category, int limit) reeverStore(String key, String value, String category)
-
Constructor Details
-
MemoryTools
public MemoryTools()Default constructor — picks REEVER_API_URL from env (fallback to public endpoint). -
MemoryTools
Explicit-URL constructor (useful for self-hosted Reever). -
MemoryTools
public MemoryTools(String apiUrl, okhttp3.OkHttpClient http, com.fasterxml.jackson.databind.ObjectMapper mapper) Full constructor for tests / shared HTTP.
-
-
Method Details
-
reeverStore
@Tool(name="reever_store", description="Store a memory in the Reever memory backend under {key} with {value}. Optional {category} groups memories for later filtering. Idempotent at the key level \u2014 calling twice with the same key overwrites the existing memory.", keywords={"reever","memory","remember","persist","store"}, idempotent=true) public String reeverStore(@ToolParam(description="Memory key (any non-blank string)") String key, @ToolParam(description="Memory content") String value, @ToolParam(description="Optional category for grouping",required=false,defaultValue="") String category) throws IOException - Throws:
IOException
-
reeverRecall
@Tool(name="reever_recall", description="Recall a previously-stored memory by exact key. Returns the raw JSON response (value + metadata + created_at) or a 404 surfaced as an IOException when the key does not exist.", keywords={"reever","memory","recall","get","fetch"}, idempotent=true) public String reeverRecall(@ToolParam(description="Memory key to recall") String key) throws IOException - Throws:
IOException
-
reeverSearch
@Tool(name="reever_search", description="Semantic search across stored Reever memories. {query} is the natural-language search string. Optional {category} narrows the search to one group. {limit} clamps to [1, 100]. Returns the raw JSON results array.", keywords={"reever","memory","search","semantic","find"}, idempotent=true) public String reeverSearch(@ToolParam(description="Natural-language search query") String query, @ToolParam(description="Optional category filter",required=false,defaultValue="") String category, @ToolParam(description="Max results (1..100); 0 \u2192 default 10",required=false,defaultValue="0") int limit) throws IOException - Throws:
IOException
-