Skip to main content
Glama

list_alerts

Retrieve active alerts across NinjaOne devices with filtering by severity, device, and pagination. View alert details including UID, severity, message, device, and trigger time.

Instructions

List active alerts and conditions across all devices in NinjaOne. Returns alert UID, severity, message, device, and trigger time.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
severityNoFilter alerts by severity level
device_filterNoFilter expression to limit devices (e.g., 'org = 123')
page_sizeNoNumber of alerts to return
afterNoAlert ID cursor for pagination

Implementation Reference

  • The async handler function that executes the list_alerts tool logic. It builds query parameters (severity, device_filter, page_size, after) and calls client.get('/alerts', params) to fetch alerts from the NinjaOne API.
    async ({ severity, device_filter, page_size, after }) => {
      const params: Record<string, string> = {
        pageSize: String(page_size),
      };
      if (severity) params.severity = severity;
      if (device_filter) params.df = device_filter;
      if (after !== undefined) params.after = String(after);
    
      try {
        const results = await client.get("/alerts", params);
        return toolResult(JSON.stringify(results, null, 2));
      } catch (error) {
        return toolResult(`Error listing alerts: ${error}`, true);
      }
    },
  • Zod schema definition for the list_alerts tool input parameters. Defines severity (enum), device_filter (string), page_size (number, default 100), and after (number) parameters with their descriptions.
      severity: z
        .enum(["NONE", "MINOR", "MODERATE", "MAJOR", "CRITICAL"])
        .optional()
        .describe("Filter alerts by severity level"),
      device_filter: z
        .string()
        .optional()
        .describe("Filter expression to limit devices (e.g., 'org = 123')"),
      page_size: z
        .number()
        .optional()
        .default(100)
        .describe("Number of alerts to return"),
      after: z
        .number()
        .optional()
        .describe("Alert ID cursor for pagination"),
    },
  • Complete registration of the list_alerts tool with the MCP server using server.tool(). Includes the tool name, description, schema, and handler function.
    server.tool(
      "list_alerts",
      "List active alerts and conditions across all devices in NinjaOne. Returns alert UID, severity, message, device, and trigger time.",
      {
        severity: z
          .enum(["NONE", "MINOR", "MODERATE", "MAJOR", "CRITICAL"])
          .optional()
          .describe("Filter alerts by severity level"),
        device_filter: z
          .string()
          .optional()
          .describe("Filter expression to limit devices (e.g., 'org = 123')"),
        page_size: z
          .number()
          .optional()
          .default(100)
          .describe("Number of alerts to return"),
        after: z
          .number()
          .optional()
          .describe("Alert ID cursor for pagination"),
      },
      async ({ severity, device_filter, page_size, after }) => {
        const params: Record<string, string> = {
          pageSize: String(page_size),
        };
        if (severity) params.severity = severity;
        if (device_filter) params.df = device_filter;
        if (after !== undefined) params.after = String(after);
    
        try {
          const results = await client.get("/alerts", params);
          return toolResult(JSON.stringify(results, null, 2));
        } catch (error) {
          return toolResult(`Error listing alerts: ${error}`, true);
        }
      },
    );
  • The NinjaOneClient.get() method that performs the actual HTTP GET request to the NinjaOne API endpoints. Used by list_alerts handler to fetch alert data.
    async get(
      path: string,
      params?: Record<string, string>,
    ): Promise<unknown> {
      return this.request("GET", path, undefined, params);
    }
  • Utility function that formats the tool response into the MCP standard format with content array and optional error flag.
    function toolResult(text: string, isError = false) {
      return { content: [{ type: "text" as const, text }], isError };
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. While it states what data is returned (alert UID, severity, message, device, trigger time), it doesn't mention important behavioral aspects like whether this is a read-only operation, pagination behavior beyond the 'after' parameter, rate limits, authentication requirements, or what 'active' means operationally. The description provides basic output information but lacks critical behavioral context.

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?

The description is appropriately concise with two sentences that efficiently convey the core functionality and return data. The first sentence states the purpose and scope, while the second specifies the returned fields. There's no wasted verbiage, and the information is front-loaded effectively.

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?

For a list/read operation with 4 parameters and no output schema, the description provides basic but incomplete context. It covers what the tool does and what data it returns, but lacks guidance on usage versus alternatives, behavioral constraints, and operational considerations. Without annotations or output schema, the description should do more to compensate, particularly around behavioral transparency and usage guidelines.

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?

The input schema has 100% description coverage, so all parameters are documented in the schema itself. The description doesn't add any parameter-specific information beyond what's in the schema - it doesn't explain parameter interactions, provide usage examples, or clarify semantics. With complete schema coverage, the baseline score of 3 is appropriate as the description doesn't compensate but doesn't need to.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/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: 'List active alerts and conditions across all devices in NinjaOne' with specific verb ('List'), resource ('alerts and conditions'), and scope ('across all devices'). It distinguishes from some siblings like 'list_device_alerts' (device-specific) and 'list_alert_conditions' (conditions only), but doesn't explicitly differentiate from all similar tools like 'list_devices' or 'get_device_activities'.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to choose 'list_alerts' over 'list_device_alerts' (which appears device-specific) or 'list_alert_conditions' (which appears condition-focused), nor does it provide any context about prerequisites, timing considerations, or appropriate use cases.

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/fredriksknese/mcp-ninjaone'

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