Skip to main content
Glama
oaslananka

MCP Health Monitor

Set Alert Thresholds

set_alert

Define thresholds to trigger alerts when server response time exceeds a limit, uptime drops below a percentage, or consecutive failures occur.

Instructions

Configure alert thresholds for response time, uptime, and consecutive failures.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesServer name
max_response_time_msNoAlert if response time exceeds this
min_uptime_percentNoAlert if uptime drops below this
consecutive_failures_before_alertNo

Implementation Reference

  • The handler function that implements the 'set_alert' tool. It validates the server exists, then calls setAlertConfig to persist the alert configuration.
    async (input: SetAlertInput) => {
      if (!getServer(input.name)) {
        throw new Error(`Server not registered: ${input.name}`);
      }
    
      return formatResponse(setAlertConfig(input));
    }
  • The setAlertConfig function that inserts or updates alert configuration in the database. Handles max_response_time_ms, min_uptime_percent, and consecutive_failures_before_alert fields.
    export function setAlertConfig(input: SetAlertInput): {
      configured: true;
      config: AlertConfigRecord;
    } {
      const db = getDb();
    
      db.prepare(
        `
          INSERT INTO alerts (
            server_name,
            max_response_time_ms,
            min_uptime_percent,
            consecutive_failures_before_alert
          )
          VALUES (?, ?, ?, ?)
          ON CONFLICT(server_name) DO UPDATE SET
            max_response_time_ms = excluded.max_response_time_ms,
            min_uptime_percent = excluded.min_uptime_percent,
            consecutive_failures_before_alert = excluded.consecutive_failures_before_alert
        `
      ).run(
        input.name,
        input.max_response_time_ms ?? null,
        input.min_uptime_percent ?? null,
        input.consecutive_failures_before_alert
      );
    
      const config = getAlertConfig(input.name);
      if (!config) {
        throw new Error(`Failed to persist alert configuration for ${input.name}`);
      }
    
      return {
        configured: true,
        config
      };
    }
  • Zod schema for the set_alert tool input: name (string), max_response_time_ms (optional int), min_uptime_percent (optional 0-100), consecutive_failures_before_alert (int 1-10, default 3).
    export const SetAlertSchema = z.object({
      name: z.string().describe('Server name'),
      max_response_time_ms: z.number().int().optional().describe('Alert if response time exceeds this'),
      min_uptime_percent: z
        .number()
        .min(0)
        .max(100)
        .optional()
        .describe('Alert if uptime drops below this'),
      consecutive_failures_before_alert: z.number().int().min(1).max(10).default(3)
    });
  • TypeScript type SetAlertInput inferred from SetAlertSchema.
    export type SetAlertInput = z.infer<typeof SetAlertSchema>;
  • src/app.ts:778-798 (registration)
    Registration of the 'set_alert' tool with metadata (title, description, inputSchema, annotations).
    server.registerTool(
      'set_alert',
      {
        title: 'Set Alert Thresholds',
        description:
          'Configure alert thresholds for response time, uptime, and consecutive failures.',
        inputSchema: SetAlertSchema,
        annotations: {
          readOnlyHint: false,
          destructiveHint: false,
          openWorldHint: false
        }
      },
      async (input: SetAlertInput) => {
        if (!getServer(input.name)) {
          throw new Error(`Server not registered: ${input.name}`);
        }
    
        return formatResponse(setAlertConfig(input));
      }
    );
Behavior4/5

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

Annotations already indicate non-destructive mutation (readOnlyHint=false, destructiveHint=false). The description adds context that it configures specific metrics, though it doesn't elaborate on side effects (e.g., whether existing alerts are overwritten) or authorization needs. With annotations covering safety, the description provides reasonable added value.

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

Conciseness4/5

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

A single, clear sentence with no wasted words. It efficiently conveys the tool's purpose, though a slightly more structured format (e.g., listing fields) could improve readability. Still well within acceptable conciseness.

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?

The tool has 4 parameters and no output schema. The description does not explain return values, confirmation behavior, or interaction effects. For a configuration operation, details on success indicators or apply timing would improve completeness. Adequate but not thorough.

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 75% (3 of 4 parameters have descriptions). The tool description does not add extra meaning beyond what the schema provides, and it fails to compensate for the undocumented 'consecutive_failures_before_alert' parameter. Thus, it adds minimal value semantically.

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 configures alert thresholds for response time, uptime, and consecutive failures. It uses specific verbs and resources, distinguishing it from sibling tools like check_all or get_uptime which are for monitoring or reading data.

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 alternatives. It is implied for setting thresholds, but no when-not conditions or comparisons to sibling configuration tools are provided. Adequate but lacks proactive 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/oaslananka/mcp-health-monitor'

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