Skip to main content
Glama

agentbay_memory_health

Assess memory health of any project: get total entries, tier/type breakdown, stale count, low confidence entries, expiring entries, alias count, and total tokens.

Instructions

Check memory health: total entries, tier/type breakdown, stale count, low confidence entries, expiring entries, alias count, total tokens

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesProject ID

Implementation Reference

  • src/index.ts:728-751 (registration)
    The tool 'agentbay_memory_health' is registered on the MCP server at line 728 via server.tool(), with Zod schema defining a 'projectId' input parameter, and its handler at lines 734-750.
    server.tool(
      'agentbay_memory_health',
      'Check memory health: total entries, tier/type breakdown, stale count, low confidence entries, expiring entries, alias count, total tokens',
      {
        projectId: z.string().describe('Project ID'),
      },
      async ({ projectId }) => {
        const data = await apiGet(`/api/v1/projects/${projectId}/memory?action=health`);
        if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] };
    
        const lines = [
          `Memory Health for project:`,
          `Total entries: ${data.totalEntries} | Total tokens: ${data.totalTokens?.toLocaleString() || 0} | Aliases: ${data.aliasCount || 0}`,
          ``,
          `By tier: ${Object.entries(data.byTier || {}).map(([k, v]) => `${k}=${v}`).join(', ') || 'none'}`,
          `By type: ${Object.entries(data.byType || {}).map(([k, v]) => `${k}=${v}`).join(', ') || 'none'}`,
          ``,
          `Stale (30+ days unverified): ${data.staleCount || 0}`,
          `Low confidence (<30%): ${data.lowConfidenceCount || 0}`,
          `Expiring in 24h: ${data.expiringCount || 0}`,
        ];
        return { content: [{ type: 'text' as const, text: lines.join('\n') }] };
      }
    );
  • The handler function for agentbay_memory_health: calls GET /api/v1/projects/{projectId}/memory?action=health and formats the response into a text report showing total entries, tokens, aliases, breakdowns by tier/type, stale count, low confidence count, and expiring entries.
    async ({ projectId }) => {
      const data = await apiGet(`/api/v1/projects/${projectId}/memory?action=health`);
      if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] };
    
      const lines = [
        `Memory Health for project:`,
        `Total entries: ${data.totalEntries} | Total tokens: ${data.totalTokens?.toLocaleString() || 0} | Aliases: ${data.aliasCount || 0}`,
        ``,
        `By tier: ${Object.entries(data.byTier || {}).map(([k, v]) => `${k}=${v}`).join(', ') || 'none'}`,
        `By type: ${Object.entries(data.byType || {}).map(([k, v]) => `${k}=${v}`).join(', ') || 'none'}`,
        ``,
        `Stale (30+ days unverified): ${data.staleCount || 0}`,
        `Low confidence (<30%): ${data.lowConfidenceCount || 0}`,
        `Expiring in 24h: ${data.expiringCount || 0}`,
      ];
      return { content: [{ type: 'text' as const, text: lines.join('\n') }] };
    }
  • Input schema: requires a 'projectId' string via Zod. Described as 'Project ID'.
    {
      projectId: z.string().describe('Project ID'),
    },
Behavior4/5

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

With no annotations, the description carries the burden. It clearly indicates a read-only operation ('Check'), lists output fields, and implies no side effects. However, it does not mention auth requirements or performance implications.

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?

Single sentence that efficiently conveys the tool's purpose and what data it returns, with no redundant information.

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

Completeness5/5

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

For a simple health-check tool with one parameter and no output schema, the description fully specifies the return metrics, making it complete for an agent to understand usage and output.

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?

Schema coverage is 100% with only one parameter (projectId), described as 'Project ID'. The tool description does not add any additional parameter details beyond the schema, so baseline 3 is appropriate.

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?

Description explicitly states 'Check memory health' and lists specific metrics (total entries, tier/type breakdown, etc.), distinguishing it from other memory tools that perform actions like store, recall, or forget.

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?

No explicit guidance on when to use this tool versus siblings like agentbay_memory_verify or agentbay_memory_recall. The purpose is implied for health monitoring, but alternatives are not discussed.

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/thomasjumper/agentbay-mcp'

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