Skip to main content
Glama

memory_learning_stats

Retrieve comprehensive learning statistics and knowledge graph data to analyze documentation deployment patterns and repository insights.

Instructions

Get comprehensive learning and knowledge graph statistics

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
includeDetailsNoInclude detailed statistics

Implementation Reference

  • Defines the input schema for the 'memory_learning_stats' tool, specifying an optional 'includeDetails' boolean parameter.
    {
      name: "memory_learning_stats",
      description: "Get comprehensive learning and knowledge graph statistics",
      inputSchema: {
        type: "object",
        properties: {
          includeDetails: {
            type: "boolean",
            description: "Include detailed statistics",
            default: true,
          },
        },
      },
    },
  • IncrementalLearningSystem.getStatistics() method that computes and returns comprehensive learning statistics including patterns count, confidence, and insights.
    async getStatistics(): Promise<{
      totalPatterns: number;
      patternsByType: Record<string, number>;
      averageConfidence: number;
      learningVelocity: number;
      insights: string[];
    }> {
      const stats = {
        totalPatterns: this.patterns.size,
        patternsByType: {} as Record<string, number>,
        averageConfidence: 0,
        learningVelocity: 0,
        insights: [] as string[],
      };
    
      let totalConfidence = 0;
      for (const pattern of this.patterns.values()) {
        stats.patternsByType[pattern.type] =
          (stats.patternsByType[pattern.type] || 0) + 1;
        totalConfidence += pattern.confidence;
      }
    
      stats.averageConfidence =
        stats.totalPatterns > 0 ? totalConfidence / stats.totalPatterns : 0;
    
      // Calculate learning velocity (patterns learned in last week)
      const weekAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000);
      stats.learningVelocity = Array.from(this.patterns.values()).filter(
        (p) => new Date(p.lastUpdated) > weekAgo,
      ).length;
    
      // Generate insights
      if (stats.totalPatterns > 10) {
        stats.insights.push(
          `System has learned ${stats.totalPatterns} patterns with ${(
            stats.averageConfidence * 100
          ).toFixed(0)}% average confidence`,
        );
      }
    
      if (stats.learningVelocity > 0) {
        stats.insights.push(
          `Learning velocity: ${stats.learningVelocity} new patterns this week`,
        );
      }
    
      const topPatternType = Object.entries(stats.patternsByType).sort(
        ([, a], [, b]) => b - a,
      )[0];
    
      if (topPatternType) {
        stats.insights.push(
          `Most common pattern type: ${topPatternType[0]} (${topPatternType[1]} patterns)`,
        );
      }
    
      return stats;
    }
  • KnowledgeGraph.getStatistics() method that returns detailed knowledge graph statistics such as node and edge counts by type.
    async getStatistics(): Promise<{
      nodeCount: number;
      edgeCount: number;
      nodesByType: Record<string, number>;
      edgesByType: Record<string, number>;
      averageConnectivity: number;
      mostConnectedNodes: Array<{ id: string; connections: number }>;
    }> {
      const nodesByType: Record<string, number> = {};
      const edgesByType: Record<string, number> = {};
    
      for (const node of this.nodes.values()) {
        nodesByType[node.type] = (nodesByType[node.type] || 0) + 1;
      }
    
      for (const edge of this.edges.values()) {
        edgesByType[edge.type] = (edgesByType[edge.type] || 0) + 1;
      }
    
      const connectivityCounts = Array.from(this.adjacencyList.entries())
        .map(([id, connections]) => ({ id, connections: connections.size }))
        .sort((a, b) => b.connections - a.connections);
    
      const averageConnectivity =
        connectivityCounts.length > 0
          ? connectivityCounts.reduce(
              (sum, { connections }) => sum + connections,
              0,
            ) / connectivityCounts.length
          : 0;
    
      return {
        nodeCount: this.nodes.size,
        edgeCount: this.edges.size,
        nodesByType,
        edgesByType,
        averageConnectivity,
        mostConnectedNodes: connectivityCounts.slice(0, 10),
      };
    }
  • Exports the memoryTools array which registers the memory_learning_stats tool among other memory-related tools.
    export const memoryTools = [
      {
        name: "memory_recall",
        description: "Recall memories about a project or topic",
        inputSchema: {
          type: "object",
          properties: {
            query: {
              type: "string",
              description: "Search query or project ID",
            },
            type: {
              type: "string",
              enum: [
                "analysis",
                "recommendation",
                "deployment",
                "configuration",
                "interaction",
                "all",
              ],
              description: "Type of memory to recall",
            },
            limit: {
              type: "number",
              description: "Maximum number of memories to return",
              default: 10,
            },
          },
          required: ["query"],
        },
      },
      {
        name: "memory_intelligent_analysis",
        description:
          "Get intelligent analysis with patterns, predictions, and recommendations",
        inputSchema: {
          type: "object",
          properties: {
            projectPath: {
              type: "string",
              description: "Path to the project for analysis",
            },
            baseAnalysis: {
              type: "object",
              description: "Base analysis data to enhance",
            },
          },
          required: ["projectPath", "baseAnalysis"],
        },
      },
      {
        name: "memory_enhanced_recommendation",
        description:
          "Get enhanced recommendations using learning and knowledge graph",
        inputSchema: {
          type: "object",
          properties: {
            projectPath: {
              type: "string",
              description: "Path to the project",
            },
            baseRecommendation: {
              type: "object",
              description: "Base recommendation to enhance",
            },
            projectFeatures: {
              type: "object",
              properties: {
                language: { type: "string" },
                framework: { type: "string" },
                size: { type: "string", enum: ["small", "medium", "large"] },
                complexity: {
                  type: "string",
                  enum: ["simple", "moderate", "complex"],
                },
                hasTests: { type: "boolean" },
                hasCI: { type: "boolean" },
                hasDocs: { type: "boolean" },
                isOpenSource: { type: "boolean" },
              },
              required: ["language"],
            },
          },
          required: ["projectPath", "baseRecommendation", "projectFeatures"],
        },
      },
      {
        name: "memory_learning_stats",
        description: "Get comprehensive learning and knowledge graph statistics",
        inputSchema: {
          type: "object",
          properties: {
            includeDetails: {
              type: "boolean",
              description: "Include detailed statistics",
              default: true,
            },
          },
        },
      },
      {
        name: "memory_knowledge_graph",
        description: "Query the knowledge graph for relationships and paths",
        inputSchema: {
          type: "object",
          properties: {
            query: {
              type: "object",
              properties: {
                nodeTypes: {
                  type: "array",
                  items: { type: "string" },
                  description: "Filter by node types",
                },
                edgeTypes: {
                  type: "array",
                  items: { type: "string" },
                  description: "Filter by edge types",
                },
                startNode: {
                  type: "string",
                  description: "Starting node for path queries",
                },
                maxDepth: {
                  type: "number",
                  description: "Maximum path depth",
                  default: 3,
                },
              },
            },
          },
          required: ["query"],
        },
      },
      {
        name: "memory_contextual_search",
        description: "Perform contextual memory retrieval with intelligent ranking",
        inputSchema: {
          type: "object",
          properties: {
            query: {
              type: "string",
              description: "Search query",
            },
            context: {
              type: "object",
              properties: {
                currentProject: {
                  type: "object",
                  properties: {
                    path: { type: "string" },
                    language: { type: "string" },
                    framework: { type: "string" },
                    size: { type: "string", enum: ["small", "medium", "large"] },
                  },
                },
                userIntent: {
                  type: "object",
                  properties: {
                    action: {
                      type: "string",
                      enum: [
                        "analyze",
                        "recommend",
                        "deploy",
                        "troubleshoot",
                        "learn",
                      ],
                    },
                    urgency: { type: "string", enum: ["low", "medium", "high"] },
                    experience: {
                      type: "string",
                      enum: ["novice", "intermediate", "expert"],
                    },
                  },
                },
                temporalContext: {
                  type: "object",
                  properties: {
                    recency: {
                      type: "string",
                      enum: ["recent", "all", "historical"],
                    },
                    timeRange: {
                      type: "object",
                      properties: {
                        start: { type: "string" },
                        end: { type: "string" },
                      },
                    },
                  },
                },
              },
            },
            options: {
              type: "object",
              properties: {
                maxResults: { type: "number", default: 10 },
                minRelevance: { type: "number", default: 0.3 },
                includeReasoning: { type: "boolean", default: true },
              },
            },
          },
          required: ["query", "context"],
        },
      },
      {
        name: "memory_agent_network",
        description: "Manage multi-agent memory sharing and collaboration",
        inputSchema: {
          type: "object",
          properties: {
            action: {
              type: "string",
              enum: [
                "register_agent",
                "share_memory",
                "sync_request",
                "get_insights",
                "network_status",
              ],
              description: "Action to perform",
            },
            agentInfo: {
              type: "object",
              properties: {
                name: { type: "string" },
                capabilities: { type: "array", items: { type: "string" } },
                specializations: { type: "array", items: { type: "string" } },
                trustLevel: {
                  type: "string",
                  enum: ["low", "medium", "high", "trusted"],
                },
              },
            },
            memoryId: {
              type: "string",
              description: "Memory ID for sharing operations",
            },
            targetAgent: {
              type: "string",
              description: "Target agent for sync operations",
            },
            options: {
              type: "object",
              properties: {
                anonymize: { type: "boolean", default: false },
                requireValidation: { type: "boolean", default: false },
              },
            },
          },
          required: ["action"],
        },
      },
      {
        name: "memory_insights",
        description: "Get insights and patterns from memory",
        inputSchema: {
          type: "object",
          properties: {
            projectId: {
              type: "string",
              description: "Project ID to analyze",
            },
            timeRange: {
              type: "object",
              properties: {
                start: { type: "string", format: "date-time" },
                end: { type: "string", format: "date-time" },
              },
              description: "Time range for analysis",
            },
          },
        },
      },
      {
        name: "memory_similar",
        description: "Find similar projects from memory",
        inputSchema: {
          type: "object",
          properties: {
            analysisId: {
              type: "string",
              description: "Analysis ID to find similar projects for",
            },
            limit: {
              type: "number",
              description: "Maximum number of similar projects",
              default: 5,
            },
          },
          required: ["analysisId"],
        },
      },
      {
        name: "memory_export",
        description: "Export memories to JSON or CSV",
        inputSchema: {
          type: "object",
          properties: {
            format: {
              type: "string",
              enum: ["json", "csv"],
              description: "Export format",
              default: "json",
            },
            filter: {
              type: "object",
              properties: {
                type: { type: "string" },
                projectId: { type: "string" },
                startDate: { type: "string", format: "date-time" },
                endDate: { type: "string", format: "date-time" },
              },
              description: "Filter memories to export",
            },
          },
        },
      },
      {
        name: "memory_cleanup",
        description: "Clean up old memories",
        inputSchema: {
          type: "object",
          properties: {
            daysToKeep: {
              type: "number",
              description: "Number of days of memories to keep",
              default: 30,
            },
            dryRun: {
              type: "boolean",
              description:
                "Preview what would be deleted without actually deleting",
              default: false,
            },
          },
        },
      },
      {
        name: "memory_pruning",
        description: "Intelligent memory pruning and optimization",
        inputSchema: {
          type: "object",
          properties: {
            policy: {
              type: "object",
              properties: {
                maxAge: {
                  type: "number",
                  description: "Maximum age in days",
                  default: 180,
                },
                maxSize: {
                  type: "number",
                  description: "Maximum storage size in MB",
                  default: 500,
                },
                maxEntries: {
                  type: "number",
                  description: "Maximum number of entries",
                  default: 50000,
                },
                preservePatterns: {
                  type: "array",
                  items: { type: "string" },
                  description: "Pattern types to preserve",
                },
                compressionThreshold: {
                  type: "number",
                  description: "Compress entries older than X days",
                  default: 30,
                },
                redundancyThreshold: {
                  type: "number",
                  description: "Remove similar entries with similarity > X",
                  default: 0.85,
                },
              },
            },
            dryRun: {
              type: "boolean",
              description: "Preview pruning without executing",
              default: false,
            },
          },
        },
      },
      {
        name: "memory_temporal_analysis",
        description: "Analyze temporal patterns and trends in memory data",
        inputSchema: {
          type: "object",
          properties: {
            query: {
              type: "object",
              properties: {
                timeRange: {
                  type: "object",
                  properties: {
                    start: { type: "string", format: "date-time" },
                    end: { type: "string", format: "date-time" },
                  },
                },
                granularity: {
                  type: "string",
                  enum: ["hour", "day", "week", "month", "year"],
                  default: "day",
                },
                aggregation: {
                  type: "string",
                  enum: ["count", "success_rate", "activity_level", "diversity"],
                  default: "count",
                },
                filters: {
                  type: "object",
                  properties: {
                    types: { type: "array", items: { type: "string" } },
                    projects: { type: "array", items: { type: "string" } },
                    outcomes: { type: "array", items: { type: "string" } },
                    tags: { type: "array", items: { type: "string" } },
                  },
                },
              },
            },
            analysisType: {
              type: "string",
              enum: ["patterns", "metrics", "predictions", "insights"],
              default: "patterns",
            },
          },
        },
      },
      {
        name: "memory_visualization",
        description: "Generate visual representations of memory data",
        inputSchema: {
          type: "object",
          properties: {
            visualizationType: {
              type: "string",
              enum: [
                "dashboard",
                "timeline",
                "network",
                "heatmap",
                "distribution",
                "trends",
                "custom",
              ],
              default: "dashboard",
            },
            options: {
              type: "object",
              properties: {
                timeRange: {
                  type: "object",
                  properties: {
                    start: { type: "string", format: "date-time" },
                    end: { type: "string", format: "date-time" },
                  },
                },
                includeCharts: { type: "array", items: { type: "string" } },
                config: {
                  type: "object",
                  properties: {
                    width: { type: "number", default: 800 },
                    height: { type: "number", default: 600 },
                    theme: {
                      type: "string",
                      enum: ["light", "dark", "auto"],
                      default: "light",
                    },
                    exportFormat: {
                      type: "string",
                      enum: ["svg", "png", "json", "html"],
                      default: "svg",
                    },
                    interactive: { type: "boolean", default: true },
                  },
                },
              },
            },
            customVisualization: {
              type: "object",
              properties: {
                type: {
                  type: "string",
                  enum: [
                    "line",
                    "bar",
                    "scatter",
                    "heatmap",
                    "network",
                    "sankey",
                    "treemap",
                    "timeline",
                  ],
                },
                query: {
                  type: "object",
                  properties: {
                    filters: { type: "object" },
                    groupBy: { type: "string" },
                    aggregation: { type: "string" },
                  },
                },
              },
            },
          },
        },
      },
      {
        name: "memory_export_advanced",
        description: "Advanced memory export with multiple formats and options",
        inputSchema: {
          type: "object",
          properties: {
            outputPath: { type: "string", description: "Output file path" },
            options: {
              type: "object",
              properties: {
                format: {
                  type: "string",
                  enum: [
                    "json",
                    "jsonl",
                    "csv",
                    "xml",
                    "yaml",
                    "sqlite",
                    "archive",
                  ],
                  default: "json",
                },
                compression: {
                  type: "string",
                  enum: ["gzip", "zip", "none"],
                  default: "none",
                },
                includeMetadata: { type: "boolean", default: true },
                includeLearning: { type: "boolean", default: true },
                includeKnowledgeGraph: { type: "boolean", default: true },
                filters: {
                  type: "object",
                  properties: {
                    types: { type: "array", items: { type: "string" } },
                    dateRange: {
                      type: "object",
                      properties: {
                        start: { type: "string", format: "date-time" },
                        end: { type: "string", format: "date-time" },
                      },
                    },
                    projects: { type: "array", items: { type: "string" } },
                    tags: { type: "array", items: { type: "string" } },
                    outcomes: { type: "array", items: { type: "string" } },
                  },
                },
                anonymize: {
                  type: "object",
                  properties: {
                    enabled: { type: "boolean", default: false },
                    fields: { type: "array", items: { type: "string" } },
                    method: {
                      type: "string",
                      enum: ["hash", "remove", "pseudonymize"],
                      default: "hash",
                    },
                  },
                },
                encryption: {
                  type: "object",
                  properties: {
                    enabled: { type: "boolean", default: false },
                    algorithm: {
                      type: "string",
                      enum: ["aes-256-gcm", "aes-192-gcm", "aes-128-gcm"],
                      default: "aes-256-gcm",
                    },
                    password: { type: "string" },
                  },
                },
              },
            },
          },
          required: ["outputPath"],
        },
      },
      {
        name: "memory_import_advanced",
        description:
          "Advanced memory import with validation and conflict resolution",
        inputSchema: {
          type: "object",
          properties: {
            inputPath: { type: "string", description: "Input file path" },
            options: {
              type: "object",
              properties: {
                format: {
                  type: "string",
                  enum: [
                    "json",
                    "jsonl",
                    "csv",
                    "xml",
                    "yaml",
                    "sqlite",
                    "archive",
                  ],
                  default: "json",
                },
                mode: {
                  type: "string",
                  enum: ["merge", "replace", "append", "update"],
                  default: "merge",
                },
                validation: {
                  type: "string",
                  enum: ["strict", "loose", "none"],
                  default: "strict",
                },
                conflictResolution: {
                  type: "string",
                  enum: ["skip", "overwrite", "merge", "rename"],
                  default: "skip",
                },
                backup: { type: "boolean", default: true },
                dryRun: { type: "boolean", default: false },
                mapping: {
                  type: "object",
                  description: "Field mapping for different schemas",
                },
                transformation: {
                  type: "object",
                  properties: {
                    enabled: { type: "boolean", default: false },
                    rules: {
                      type: "array",
                      items: {
                        type: "object",
                        properties: {
                          field: { type: "string" },
                          operation: {
                            type: "string",
                            enum: ["convert", "transform", "validate"],
                          },
                          params: { type: "object" },
                        },
                      },
                    },
                  },
                },
              },
            },
          },
          required: ["inputPath"],
        },
      },
      {
        name: "memory_migration",
        description:
          "Create and execute migration plans between different memory systems",
        inputSchema: {
          type: "object",
          properties: {
            action: {
              type: "string",
              enum: ["create_plan", "execute_migration", "validate_compatibility"],
              default: "create_plan",
            },
            sourcePath: { type: "string", description: "Source data path" },
            migrationPlan: {
              type: "object",
              properties: {
                sourceSystem: { type: "string" },
                targetSystem: { type: "string", default: "DocuMCP" },
                mapping: { type: "object" },
                transformations: { type: "array" },
                validation: { type: "array" },
                postProcessing: { type: "array", items: { type: "string" } },
              },
            },
            sourceSchema: { type: "object", description: "Source system schema" },
            targetSchema: { type: "object", description: "Target system schema" },
            options: {
              type: "object",
              properties: {
                autoMap: { type: "boolean", default: true },
                preserveStructure: { type: "boolean", default: true },
                customMappings: { type: "object" },
              },
            },
          },
        },
      },
      {
        name: "memory_optimization_metrics",
        description: "Get comprehensive optimization metrics and recommendations",
        inputSchema: {
          type: "object",
          properties: {
            includeRecommendations: { type: "boolean", default: true },
            timeRange: {
              type: "object",
              properties: {
                start: { type: "string", format: "date-time" },
                end: { type: "string", format: "date-time" },
              },
            },
          },
        },
      },
    ];
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool 'gets' statistics, implying a read-only operation, but doesn't specify if it requires authentication, has rate limits, or what the output format looks like. This is insufficient for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is minimal but covers the basic purpose. However, for a tool that likely returns complex statistics, more detail on behavior or output would improve completeness, making it adequate but with clear gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the single parameter 'includeDetails' documented as 'Include detailed statistics'. The description doesn't add any meaning beyond this, so it meets the baseline of 3 for high schema coverage without extra param info.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get') and the resource ('comprehensive learning and knowledge graph statistics'), making the purpose understandable. However, it doesn't differentiate from sibling tools like 'memory_optimization_metrics' or 'memory_insights' that might also provide statistics, so it's not fully specific.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. With many sibling tools related to memory and analysis, the description lacks context about appropriate scenarios or exclusions, leaving the agent without usage direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/tosin2013/documcp'

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