get_active_themes
Retrieve recently activated memory themes and patterns to maintain AI system continuity through thematic clustering and identity tracking.
Instructions
Get recently activated memory themes and patterns
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| days | No | Number of days to look back |
Implementation Reference
- src/memory-manager.js:428-439 (handler)The getActiveThemes method that queries the active_themes database view and returns themes data
async getActiveThemes(days = 7) { try { const themes = await this.db .select() .from(schema.activeThemes); return themes; } catch (error) { console.error('Error getting active themes:', error); throw error; } } - src/db/schema.js:318-324 (schema)Database view definition for active_themes that aggregates cluster activation data over the past 7 days
export const activeThemes = pgView("active_themes", { theme: text(), emotionalSignature: jsonb("emotional_signature"), keywords: text(), // You can use { mode: "bigint" } if numbers are exceeding js number limitations recentActivations: bigint("recent_activations", { mode: "number" }), associatedThemes: uuid("associated_themes"), }).as(sql`SELECT mc.name AS theme, mc.emotional_signature, mc.keywords, count(DISTINCT mch.id) AS recent_activations, array_agg(DISTINCT mch.co_activated_clusters) FILTER (WHERE mch.co_activated_clusters IS NOT NULL) AS associated_themes FROM memory_clusters mc JOIN cluster_activation_history mch ON mc.id = mch.cluster_id WHERE mch.activated_at > (CURRENT_TIMESTAMP - '7 days'::interval) GROUP BY mc.id, mc.name, mc.emotional_signature, mc.keywords ORDER BY (count(DISTINCT mch.id)) DESC`); - src/tools/memory-tools.js:181-193 (schema)Tool schema definition defining the input parameters (days) for get_active_themes
name: "get_active_themes", description: "Get recently activated memory themes and patterns", inputSchema: { type: "object", properties: { days: { type: "integer", description: "Number of days to look back", default: 7 } } } }, - mcp.js:206-218 (registration)MCP server registration of the get_active_themes tool with its input schema
{ name: "get_active_themes", description: "Get recently activated memory themes and patterns", inputSchema: { type: "object", properties: { days: { type: "integer", description: "Number of days to look back", default: 7 } } } - mcp.js:597-599 (handler)MCP tool handler that calls memoryManager.getActiveThemes with the days parameter
case "get_active_themes": const themes = await memoryManager.getActiveThemes(args.days || 7); return { content: [{ type: "text", text: JSON.stringify(themes, null, 2) }] };