get_working_memories
Retrieve active working memories from AGI MCP Server to maintain continuity in AI conversations, with optional inclusion of expired memories for comprehensive context.
Instructions
Retrieve current working memories
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| include_expired | No | Include expired working memories |
Implementation Reference
- mcp.js:664-668 (handler)MCP server handler for the 'get_working_memories' tool. Extracts the 'include_expired' parameter from tool arguments and delegates to MemoryManager.getWorkingMemories, then formats the result as MCP content.case "get_working_memories": const workingMemories = await memoryManager.getWorkingMemories( args.include_expired || false ); return { content: [{ type: "text", text: JSON.stringify(workingMemories, null, 2) }] };
- src/memory-manager.js:464-482 (helper)Core implementation of getWorkingMemories in MemoryManager class. Queries the workingMemory database table, optionally filtering out expired entries based on the expiry timestamp, and returns results ordered by creation time.async getWorkingMemories(includeExpired = false) { try { let query = this.db.select().from(schema.workingMemory); if (!includeExpired) { query = query.where( or( isNull(schema.workingMemory.expiry), gt(schema.workingMemory.expiry, new Date()) ) ); } const results = await query.orderBy(desc(schema.workingMemory.createdAt)); return results; } catch (error) { console.error('Error getting working memories:', error); throw error; }
- mcp.js:436-448 (schema)Tool schema definition provided in the MCP listTools response, specifying the input schema with optional 'include_expired' boolean parameter.{ name: "get_working_memories", description: "Retrieve current working memories", inputSchema: { type: "object", properties: { include_expired: { type: "boolean", description: "Include expired working memories", default: false } } }