Skip to main content
Glama

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
NameRequiredDescriptionDefault
daysNoNumber of days to look back

Implementation Reference

  • 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;
      }
    }
  • 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`);
  • 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) }] };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/randyandrade/agi-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server