Skip to main content
Glama
metrxbots

Metrx MCP Server

by metrxbots

Get Alerts

metrx_get_alerts
Read-onlyIdempotent

Retrieve active alerts for your agent fleet including cost spikes, error rate increases, budget warnings, and system health notifications. Filter by severity and view unread alerts to monitor operational issues.

Instructions

Get active alerts and notifications for your agent fleet. Includes cost spikes, error rate increases, budget warnings, and system health notifications. Optionally filter by severity. Do NOT use for configuring alert triggers — use configure_alert_threshold for that.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
severityNoFilter by alert severity
unread_onlyNoOnly return unread alerts (default: true)
limitNoMaximum number of alerts to return

Implementation Reference

  • Main handler function for get_alerts tool that fetches alerts from the API, formats them using formatAlerts, and returns the response. Handles errors and processes the alerts list.
    async ({ severity, unread_only, limit }) => {
      const params: Record<string, string | number | boolean> = {
        limit: limit ?? 25,
      };
      if (severity) params.severity = severity;
      if (unread_only !== undefined) params.unread_only = unread_only;
    
      const result = await client.get<{ alerts: AlertEvent[] }>(
        '/alerts',
        params as Record<string, string>
      );
    
      if (result.error) {
        return {
          content: [{ type: 'text', text: `Error fetching alerts: ${result.error}` }],
          isError: true,
        };
      }
    
      const alerts = result.data?.alerts || [];
      const text = formatAlerts(alerts);
    
      return {
        content: [{ type: 'text', text }],
      };
    }
  • Tool registration with name 'get_alerts', including input schema with severity, unread_only, and limit parameters, along with annotations and the handler function.
    server.registerTool(
      'get_alerts',
      {
        title: 'Get Alerts',
        description:
          'Get active alerts and notifications for your agent fleet. ' +
          'Includes cost spikes, error rate increases, budget warnings, ' +
          'and system health notifications. Optionally filter by severity. ' +
          'Do NOT use for configuring alert triggers — use configure_alert_threshold for that.',
        inputSchema: {
          severity: z
            .enum(['info', 'warning', 'critical'])
            .optional()
            .describe('Filter by alert severity'),
          unread_only: z
            .boolean()
            .default(true)
            .describe('Only return unread alerts (default: true)'),
          limit: z
            .number()
            .int()
            .min(1)
            .max(100)
            .default(25)
            .describe('Maximum number of alerts to return'),
        },
        annotations: {
          readOnlyHint: true,
          destructiveHint: false,
          idempotentHint: true,
          openWorldHint: false,
        },
      },
      async ({ severity, unread_only, limit }) => {
        const params: Record<string, string | number | boolean> = {
          limit: limit ?? 25,
        };
        if (severity) params.severity = severity;
        if (unread_only !== undefined) params.unread_only = unread_only;
    
        const result = await client.get<{ alerts: AlertEvent[] }>(
          '/alerts',
          params as Record<string, string>
        );
    
        if (result.error) {
          return {
            content: [{ type: 'text', text: `Error fetching alerts: ${result.error}` }],
            isError: true,
          };
        }
    
        const alerts = result.data?.alerts || [];
        const text = formatAlerts(alerts);
    
        return {
          content: [{ type: 'text', text }],
        };
      }
    );
  • Input schema definition using zod for validation of severity (enum), unread_only (boolean), and limit (number) parameters.
    inputSchema: {
      severity: z
        .enum(['info', 'warning', 'critical'])
        .optional()
        .describe('Filter by alert severity'),
      unread_only: z
        .boolean()
        .default(true)
        .describe('Only return unread alerts (default: true)'),
      limit: z
        .number()
        .int()
        .min(1)
        .max(100)
        .default(25)
        .describe('Maximum number of alerts to return'),
    },
  • AlertEvent interface defining the type structure for alert objects including id, type, severity, title, message, agent_id, is_read, and created_at fields.
    export interface AlertEvent {
      id: string;
      type: string;
      severity: string;
      title: string;
      message: string;
      agent_id?: string;
      is_read: boolean;
      created_at: string;
    }
  • Helper function formatAlerts that formats an array of AlertEvent objects into a readable markdown string with severity icons, titles, messages, agent IDs, and timestamps.
    export function formatAlerts(alerts: AlertEvent[]): string {
      if (alerts.length === 0) {
        return 'No active alerts.';
      }
    
      const lines: string[] = [`## Active Alerts (${alerts.length})`, ''];
    
      for (const a of alerts) {
        const icon = a.severity === 'critical' ? '🔴' : a.severity === 'warning' ? '🟡' : 'â„šī¸';
        lines.push(`${icon} **${a.title}** (${a.severity})`);
        lines.push(`  ${a.message}`);
        if (a.agent_id) {
          lines.push(`  Agent: ${a.agent_id}`);
        }
        lines.push(`  Time: ${a.created_at}`);
        lines.push('');
      }
    
      return lines.join('\n');
    }
Behavior4/5

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

Annotations already cover key behavioral traits (read-only, non-destructive, idempotent, closed-world), but the description adds valuable context beyond this: it specifies the types of alerts included (cost spikes, error rate increases, etc.) and mentions optional filtering by severity. No contradictions with annotations are present.

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 front-loaded with core purpose, followed by scope details and usage guidance. Every sentence earns its place: the first defines the tool, the second elaborates on included alerts, and the third provides critical usage rules. 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 moderate complexity (3 parameters, no output schema) and rich annotations, the description is largely complete. It covers purpose, scope, and usage guidelines effectively. A minor gap is lack of detail on return format or pagination, but annotations provide safety context.

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?

With 100% schema description coverage, the input schema fully documents all parameters (severity, unread_only, limit). The description only mentions 'Optionally filter by severity,' which adds minimal semantic value beyond the schema. Baseline score of 3 is appropriate as the schema carries the burden.

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's purpose with specific verbs ('Get active alerts and notifications') and resources ('for your agent fleet'), including detailed scope ('cost spikes, error rate increases, budget warnings, and system health notifications'). It explicitly distinguishes from sibling 'configure_alert_threshold' for configuration tasks, avoiding redundancy.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool ('Get active alerts and notifications') versus alternatives, with a clear exclusion: 'Do NOT use for configuring alert triggers — use configure_alert_threshold for that.' This directly addresses sibling tool differentiation and context.

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/metrxbots/metrx-mcp-server'

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