Skip to main content
Glama
oaslananka

MCP Health Monitor

Get Monitor Statistics

get_monitor_stats
Read-only

Retrieve internal statistics and database activity metrics from the health monitor to assess its own performance and operational status.

Instructions

Get statistics about the health monitor itself, including database activity.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'get_monitor_stats' tool. It queries the SQLite database for total health checks, total registered servers, and the timestamp of the oldest health check, then returns those statistics along with the resolved database path.
    async () => {
      const db = getDb();
      const totalChecks = (
        db.prepare('SELECT COUNT(*) AS count FROM health_checks').get() as { count: number }
      ).count;
      const totalServers = (
        db.prepare('SELECT COUNT(*) AS count FROM servers').get() as { count: number }
      ).count;
      const oldestCheck = (
        db.prepare('SELECT MIN(timestamp) AS timestamp FROM health_checks').get() as {
          timestamp: number | null;
        }
      ).timestamp;
    
      return formatResponse({
        total_servers_registered: totalServers,
        total_checks_performed: totalChecks,
        monitoring_since: oldestCheck ? new Date(oldestCheck).toISOString() : null,
        db_path: getResolvedDbPath()
      });
    }
  • src/app.ts:743-776 (registration)
    Registration of the 'get_monitor_stats' tool with its title, description, input schema (EmptySchema), annotations, and the handler function.
    server.registerTool(
      'get_monitor_stats',
      {
        title: 'Get Monitor Statistics',
        description: 'Get statistics about the health monitor itself, including database activity.',
        inputSchema: EmptySchema,
        annotations: {
          readOnlyHint: true,
          destructiveHint: false,
          openWorldHint: false
        }
      },
      async () => {
        const db = getDb();
        const totalChecks = (
          db.prepare('SELECT COUNT(*) AS count FROM health_checks').get() as { count: number }
        ).count;
        const totalServers = (
          db.prepare('SELECT COUNT(*) AS count FROM servers').get() as { count: number }
        ).count;
        const oldestCheck = (
          db.prepare('SELECT MIN(timestamp) AS timestamp FROM health_checks').get() as {
            timestamp: number | null;
          }
        ).timestamp;
    
        return formatResponse({
          total_servers_registered: totalServers,
          total_checks_performed: totalChecks,
          monitoring_since: oldestCheck ? new Date(oldestCheck).toISOString() : null,
          db_path: getResolvedDbPath()
        });
      }
    );
  • EmptySchema definition (z.object({})) used as the input schema for 'get_monitor_stats' — no inputs required.
    export const EmptySchema = z.object({});
  • getResolvedDbPath() helper returns the resolved database path, used in the handler to report db_path.
    export function getResolvedDbPath(): string {
      return resolveDbPath();
    }
  • formatResponse helper wraps the payload in a ToolResponse with JSON text content, used to return the monitor stats.
    function formatResponse(payload: unknown): ToolResponse {
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(payload, null, 2)
          }
        ]
      };
    }
Behavior4/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false. The description adds value by specifying that statistics include database activity, providing additional context beyond the 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?

One concise sentence front-loads the purpose and includes relevant detail. Every word earns its place with no wasted text.

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 no parameters, no output schema, and informative annotations, the description is largely complete. It specifies the resource and includes database activity, but could be enhanced by hinting at return format or example statistics.

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

Parameters4/5

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

The input schema has 0 parameters with 100% coverage, so the description needs no parameter explanations. Baseline for 0 params is 4, and the description correctly implies no inputs needed.

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 verb 'Get' and resource 'statistics about the health monitor itself', including specific detail 'database activity'. It distinguishes from sibling tools like get_dashboard or get_report.

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 implies usage for monitor health statistics but provides no explicit guidance on when to use this tool versus alternatives like check_server or get_uptime. Usage context is only indirectly implied.

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/oaslananka/mcp-health-monitor'

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