Skip to main content
Glama

get_alerts

Retrieve recent guard alerts and errors to monitor if AI agents are hitting safety limits like loop detection and budget exceeded thresholds.

Instructions

Get recent guard alerts (loop detection, budget exceeded) and errors. Useful for checking if your agents are hitting safety limits.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMax alerts to return (default 50)
sinceNoISO timestamp — only alerts after this time

Implementation Reference

  • The 'get_alerts' tool definition including its input schema and handler function. The handler calls client.getAlerts() with limit and since parameters, then stringifies the result.
    {
      name: "get_alerts",
      description:
        "Get recent guard alerts (loop detection, budget exceeded) and errors. " +
        "Useful for checking if your agents are hitting safety limits.",
      inputSchema: {
        type: "object",
        properties: {
          limit: { type: "number", description: "Max alerts to return (default 50)" },
          since: { type: "string", description: "ISO timestamp — only alerts after this time" },
        },
      },
      handler: async (client, args) => {
        const result = await client.getAlerts({
          limit: args.limit ? String(args.limit) : undefined,
          since: args.since as string | undefined,
        });
        return JSON.stringify(result, null, 2);
      },
    },
  • Input schema for get_alerts: optional 'limit' (number, max 50) and 'since' (string, ISO timestamp).
    name: "get_alerts",
    description:
      "Get recent guard alerts (loop detection, budget exceeded) and errors. " +
      "Useful for checking if your agents are hitting safety limits.",
    inputSchema: {
      type: "object",
      properties: {
        limit: { type: "number", description: "Max alerts to return (default 50)" },
        since: { type: "string", description: "ISO timestamp — only alerts after this time" },
      },
    },
    handler: async (client, args) => {
      const result = await client.getAlerts({
        limit: args.limit ? String(args.limit) : undefined,
        since: args.since as string | undefined,
      });
      return JSON.stringify(result, null, 2);
    },
  • The getAlerts method on AgentGuardClient that makes the actual HTTP GET request to /api/v1/alerts.
    async getAlerts(opts?: { limit?: string; since?: string }) {
      return this.fetch<{ alerts: unknown[] }>("/api/v1/alerts", opts);
    }
  • Registration loop in index.ts that registers all tools (including get_alerts) with the MCP server using server.tool().
    // Register each tool with the MCP server
    for (const tool of tools) {
      const shape = buildToolShape(tool.inputSchema.properties, tool.inputSchema.required ?? []);
    
      const toolName = tool.name;
      const handler = tool.handler;
    
      server.tool(toolName, tool.description, shape, async (args) => {
        try {
          const text = await handler(client, args as Record<string, unknown>);
          return { content: [{ type: "text" as const, text }] };
        } catch (err) {
          const message = err instanceof Error ? err.message : String(err);
          return {
            content: [{ type: "text" as const, text: `Error: ${message}` }],
            isError: true,
          };
        }
      });
    }
Behavior3/5

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

With no annotations, the description must disclose behavioral traits. It mentions 'recent' but doesn't specify sorting or freshness criteria. It doesn't state if alerts are read-only or if any mutations occur. The behavior is partially inferred from parameter filtering but lacks depth.

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?

Two sentences: first defines the tool's action and resource, second provides a use case. No redundant or irrelevant information. Efficient and front-loaded.

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 simplicity with 2 optional parameters and no output schema, the description is adequate. It explains what alerts are and a common usage scenario. Could mention if errors are separate or if there's a default time range, but overall complete enough.

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%, so the baseline is 3. The description does not add new information about parameters beyond what the schema provides. No additional semantics like default behavior of 'since' or format of 'limit' are given.

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 retrieves recent guard alerts and errors, listing specific types like loop detection and budget exceeded. It also provides a use case about checking safety limits. This distinguishes it from siblings like check_budget which is budget-specific.

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

Usage Guidelines4/5

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

The description gives a direct use case: 'checking if your agents are hitting safety limits.' While it doesn't explicitly contrast with siblings, the inclusion of 'budget exceeded' hints at overlap with check_budget. More explicit when-to-use vs alternatives would be helpful.

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/bmdhodl/agent47'

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