@hasna/mementos 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/mcp/index.js +18 -12
  2. package/package.json +1 -1
package/dist/mcp/index.js CHANGED
@@ -4936,7 +4936,7 @@ function formatMemory(m) {
4936
4936
  return parts.join(`
4937
4937
  `);
4938
4938
  }
4939
- server.tool("memory_save", "Save a memory (create or upsert). Use scope 'global' for all agents, 'shared' for project-level, 'private' for single agent.", {
4939
+ server.tool("memory_save", "Save/upsert a memory. scope: global=all agents, shared=project, private=single agent.", {
4940
4940
  key: exports_external.string().describe("Unique key for the memory"),
4941
4941
  value: exports_external.string().describe("Memory content/value"),
4942
4942
  scope: exports_external.enum(["global", "shared", "private"]).optional().describe("Memory scope (default: private)"),
@@ -4997,7 +4997,7 @@ ${formatMemory(best.memory)}`
4997
4997
  return { content: [{ type: "text", text: formatError(e) }], isError: true };
4998
4998
  }
4999
4999
  });
5000
- server.tool("memory_list", "List memories with optional filters", {
5000
+ server.tool("memory_list", "List memories. Default: compact lines. full=true for complete JSON objects.", {
5001
5001
  scope: exports_external.enum(["global", "shared", "private"]).optional(),
5002
5002
  category: exports_external.enum(["preference", "fact", "knowledge", "history"]).optional(),
5003
5003
  tags: exports_external.array(exports_external.string()).optional(),
@@ -5008,19 +5008,25 @@ server.tool("memory_list", "List memories with optional filters", {
5008
5008
  session_id: exports_external.string().optional(),
5009
5009
  status: exports_external.enum(["active", "archived", "expired"]).optional(),
5010
5010
  limit: exports_external.coerce.number().optional().describe("Max results (default: 50)"),
5011
- offset: exports_external.coerce.number().optional()
5011
+ offset: exports_external.coerce.number().optional(),
5012
+ full: exports_external.boolean().optional().describe("Return full Memory objects as JSON instead of compact lines")
5012
5013
  }, async (args) => {
5013
5014
  try {
5015
+ const { full, ...filterArgs } = args;
5014
5016
  const filter = {
5015
- ...args,
5016
- limit: args.limit || 50
5017
+ ...filterArgs,
5018
+ limit: filterArgs.limit || 50
5017
5019
  };
5018
5020
  const memories = listMemories(filter);
5019
5021
  if (memories.length === 0) {
5020
- return { content: [{ type: "text", text: "No memories found matching filters." }] };
5022
+ return { content: [{ type: "text", text: "No memories found." }] };
5021
5023
  }
5022
- const lines = memories.map((m, i) => `${i + 1}. [${m.scope}/${m.category}] ${m.key} = ${m.value.slice(0, 100)}${m.value.length > 100 ? "..." : ""} (importance: ${m.importance}, id: ${m.id.slice(0, 8)})`);
5023
- return { content: [{ type: "text", text: `${memories.length} memor${memories.length === 1 ? "y" : "ies"} found:
5024
+ if (full) {
5025
+ const compact = memories.map((m) => Object.fromEntries(Object.entries(m).filter(([, v]) => v !== null && v !== undefined && v !== 0 && v !== "")));
5026
+ return { content: [{ type: "text", text: JSON.stringify(compact, null, 2) }] };
5027
+ }
5028
+ const lines = memories.map((m, i) => `${i + 1}. [${m.scope}/${m.category}] ${m.key} = ${m.value.slice(0, 100)}${m.value.length > 100 ? "..." : ""} (imp:${m.importance} id:${m.id.slice(0, 8)})`);
5029
+ return { content: [{ type: "text", text: `${memories.length} memories:
5024
5030
  ${lines.join(`
5025
5031
  `)}` }] };
5026
5032
  } catch (e) {
@@ -5195,7 +5201,7 @@ server.tool("memory_import", "Import memories from JSON array", {
5195
5201
  return { content: [{ type: "text", text: formatError(e) }], isError: true };
5196
5202
  }
5197
5203
  });
5198
- server.tool("memory_inject", "Get formatted memory context for injection into agent system prompts. Selects most relevant memories by scope, importance, and recency.", {
5204
+ server.tool("memory_inject", "Get memory context for system prompt injection. Selects by scope, importance, recency.", {
5199
5205
  agent_id: exports_external.string().optional().describe("Agent ID for scope filtering"),
5200
5206
  project_id: exports_external.string().optional().describe("Project ID for scope filtering"),
5201
5207
  session_id: exports_external.string().optional().describe("Session ID for scope filtering"),
@@ -5274,7 +5280,7 @@ ${lines.join(`
5274
5280
  return { content: [{ type: "text", text: formatError(e) }], isError: true };
5275
5281
  }
5276
5282
  });
5277
- server.tool("register_agent", "Register an agent and get a short UUID. Idempotent: same name returns existing agent.", {
5283
+ server.tool("register_agent", "Register an agent. Idempotent \u2014 same name returns existing agent.", {
5278
5284
  name: exports_external.string().describe("Agent name"),
5279
5285
  description: exports_external.string().optional().describe("Agent description"),
5280
5286
  role: exports_external.string().optional().describe("Agent role")
@@ -5334,7 +5340,7 @@ Last seen: ${agent.last_seen_at}`
5334
5340
  return { content: [{ type: "text", text: formatError(e) }], isError: true };
5335
5341
  }
5336
5342
  });
5337
- server.tool("update_agent", "Update an agent's name, description, role, or metadata. Agents can update themselves.", {
5343
+ server.tool("update_agent", "Update agent name, description, role, or metadata.", {
5338
5344
  id: exports_external.string().describe("Agent ID or name"),
5339
5345
  name: exports_external.string().optional().describe("New agent name"),
5340
5346
  description: exports_external.string().optional().describe("New description"),
@@ -5442,7 +5448,7 @@ server.tool("clean_expired", "Remove expired memories from the database", {}, as
5442
5448
  return { content: [{ type: "text", text: formatError(e) }], isError: true };
5443
5449
  }
5444
5450
  });
5445
- server.tool("memory_context", "Get all memories relevant to the current context. Smart selection by scope visibility, importance, and recency.", {
5451
+ server.tool("memory_context", "Get memories relevant to current context, filtered by scope/importance/recency.", {
5446
5452
  agent_id: exports_external.string().optional(),
5447
5453
  project_id: exports_external.string().optional(),
5448
5454
  scope: exports_external.enum(["global", "shared", "private"]).optional().describe("Limit to specific scope"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/mementos",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Universal memory system for AI agents - CLI + MCP server + library API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",