Skip to main content
Glama

Audit

localnest_audit
Read-onlyIdempotent

Audit LocalNest health: get memory coverage, knowledge graph metrics, unpopulated nests, broken bridges, stale memories, and a 0-100 health score with actionable suggestions.

Instructions

Run a comprehensive self-audit of LocalNest health. Returns memory coverage by project, KG density metrics (entities, triples, orphans, duplicates, connected components), unpopulated nests, broken bridges, stale memories, a 0-100 health score, and actionable suggestions. Call once to get a full integrity dashboard.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
response_formatNojson

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYes
metaYes

Implementation Reference

  • Main handler function that runs the comprehensive self-audit by querying project coverage, KG density, nest health, and stale memories, then computes a health score and suggestions.
    export async function runAudit(adapter: Adapter): Promise<AuditResult> {
      const [coverage, density, nestHealth, stale] = await Promise.all([
        auditProjectCoverage(adapter),
        auditKgDensity(adapter),
        auditNestHealth(adapter),
        auditStaleMemories(adapter)
      ]);
    
      const suggestions = generateSuggestions(coverage, density, nestHealth, stale);
      const healthScore = computeHealthScore(coverage, density, nestHealth, stale);
    
      return {
        audited_at: new Date().toISOString(),
        health_score: healthScore,
        project_coverage: coverage,
        kg_density: density,
        nest_health: nestHealth,
        stale_memories: stale,
        suggestions,
        summary: buildSummary(healthScore, coverage, density, stale)
      };
    }
    
    function buildSummary(
      score: number,
      coverage: AuditProjectCoverage,
      density: AuditKgDensity,
      stale: AuditStaleMemories
    ): string {
      const parts: string[] = [
        `Health: ${score}/100`,
        `${coverage.total_memories} memories across ${coverage.total_projects} project(s)`,
        `${density.total_entities} KG entities, ${density.active_triples} active triples`
      ];
    
      if (density.orphaned_entities > 0) {
        parts.push(`${density.orphaned_entities} orphaned entities`);
      }
      if (stale.stale_count > 0) {
        parts.push(`${stale.stale_count} stale memories`);
      }
    
      return parts.join('. ') + '.';
    }
  • AuditResult type definition — the output schema for localnest_audit, specifying all returned fields including health score, coverage, density, nest health, stale memories, and suggestions.
    export interface AuditResult {
      audited_at: string;
      health_score: number;
      project_coverage: AuditProjectCoverage;
      kg_density: AuditKgDensity;
      nest_health: AuditNestHealth;
      stale_memories: AuditStaleMemories;
      suggestions: AuditSuggestion[];
      summary: string;
    }
  • MCP tool registration for localnest_audit — defines the tool with title, description, empty input schema, read-only annotation, and delegates to memory.audit().
      registerJsonTool(
        'localnest_audit',
        {
          title: 'Audit',
          description:
            'Run a comprehensive self-audit of LocalNest health. Returns memory coverage by project, ' +
            'KG density metrics (entities, triples, orphans, duplicates, connected components), ' +
            'unpopulated nests, broken bridges, stale memories, a 0-100 health score, and actionable suggestions. ' +
            'Call once to get a full integrity dashboard.',
          inputSchema: {},
          annotations: READ_ONLY_ANNOTATIONS,
          outputSchema: BUNDLE_RESULT_SCHEMA
        },
        async () => memory.audit()
      );
    }
  • Where registerAuditTools is called during app initialization, wiring the memory service as the provider.
    registerAuditTools({
      registerJsonTool,
      memory: services.memory
    });
  • Memory store's audit() method — delegates to the runAudit function from dashboard.ts, bridging the tool registration to the core audit logic.
    async audit(): Promise<AuditResult> {
      await this.init();
      return runAuditFn(this.adapter!);
    }
Behavior4/5

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

Annotations already indicate read-only, non-destructive, and idempotent behavior. The description adds value by detailing the returned metrics (memory coverage, KG density, health score, suggestions) and framing it as a self-audit, providing context beyond annotations.

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?

Three concise sentences: purpose, metrics, usage hint. Front-loaded with the verb 'Run,' no wasted words.

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

Completeness4/5

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

Given the tool's complexity and rich annotations, the description sufficiently covers purpose and output. The return values are defined in the output schema, so detail is adequate.

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

Parameters2/5

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

The single parameter (response_format) is not mentioned in the description. With 0% schema description coverage, the description should compensate by explaining the parameter or its effect, but it does not. The agent must rely solely on the schema.

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

Purpose5/5

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

The description clearly states the tool runs a comprehensive self-audit of LocalNest health, listing specific metrics like memory coverage, KG density, and health score. It distinguishes itself from siblings like localnest_health and localnest_kg_stats by being a comprehensive dashboard.

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

Usage Guidelines3/5

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

The description advises 'Call once to get a full integrity dashboard,' implying infrequent use for overall health checks. However, it lacks explicit guidance on when not to use it or how it differs from sibling tools like localnest_health.

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/wmt-mobile/localnest'

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