Skip to main content
Glama
io.github.ryanmat/logicmonitor

io.github.ryanmat/logicmonitor

by ryanmat

calculate_availability

Read-onlyIdempotent

Calculate availability percentage and MTTR from alert history, with per-device breakdown and SLA error-budget tracking when a target SLO is set.

Instructions

Calculate availability percentage from alert history. Computes SLA-style uptime metrics, MTTR, and per-device breakdown from the window's cleared and active alerts, read as two lists; truncated says when the 5000-alert cap cut either read short. With target_slo it adds error_budget for the window: budget, consumed and remaining minutes, percent consumed, burn rate, projected exhaustion in days and a status (healthy, warning past 50 percent, critical past 90, exhausted).

Common mistakes: hours_back defaults to 720 (30 days). Narrow scope with device_id/group_id for performance.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "calculate_availability"
  }
}

Input Schema

NameRequiredDescriptionDefault
group_idNoOptional device group ID filter; not with device_id or device_name
device_idNoOptional device ID filter
hours_backNoHours to look back (default 30 days)
target_sloNoTarget availability percentage, such as 99.9; adds error_budget over the hours_back window
device_nameNoExact device display name; pass it or device_id, not group_id
severity_thresholdNoMinimum severity for downtime (critical, error, warning, info)error

Output Schema

NameRequiredDescriptionDefault
portalNoThe portal the call ran against, in multi-portal mode.
api_totalYes
by_deviceYesAvailability per device name.
device_idNo
truncatedYes
hours_backYes
error_budgetNo
mttr_minutesYes
incident_countYes
device_resolvedNo
severity_thresholdYes
availability_percentYes
total_uptime_minutesYes
total_downtime_minutesYes
longest_incident_minutesYes
measurement_window_contextNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv5.0.1
    • addedInput schema / properties / device_name
      Added value: +{
      +  "description": "Exact device display name; pass it or device_id, not group_id",
      +  "type": "string"
      +}
    • addedInput schema / properties / target_slo
      Added value: +{
      +  "description": "Target availability percentage, such as 99.9; adds error_budget over the hours_back window",
      +  "exclusiveMinimum": 0,
      +  "maximum": 100,
      +  "type": "number"
      +}
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": false,
      +  "properties": {
      +    "api_total": {
      +      "type": [
      +        "integer",
      +        "null"
      +      ]
      +    },
      +    "availability_percent": {
      +      "type": "number"
      +    },
      +    "by_device": {
      +      "description": "Availability per device name.",
      +      "type": "object"
      +    },
      +    "device_id": {
      +      "type": "integer"
      +    },
      +    "device_resolved": {
      +      "type": "boolean"
      +    },
      +    "error_budget": {
      +      "type": "object"
      +    },
      +    "hours_back": {
      +      "type": "integer"
      +    },
      +    "incident_count": {
      +      "type": "integer"
      +    },
      +    "longest_incident_minutes": {
      +      "type": "number"
      +    },
      +    "measurement_window_context": {
      +      "type": "object"
      +    },
      +    "mttr_minutes": {
      +      "type": "number"
      +    },
      +    "portal": {
      +      "description": "The portal the call ran against, in multi-portal mode.",
      +      "type": [
      +        "string",
      +        "null"
      +      ]
      +    },
      +    "severity_threshold": {
      +      "type": "string"
      +    },
      +    "total_downtime_minutes": {
      +      "type": "number"
      +    },
      +    "total_uptime_minutes": {
      +      "type": "number"
      +    },
      +    "truncated": {
      +      "type": "boolean"
      +    }
      +  },
      +  "required": [
      +    "availability_percent",
      +    "total_downtime_minutes",
      +    "total_uptime_minutes",
      +    "mttr_minutes",
      +    "incident_count",
      +    "longest_incident_minutes",
      +    "by_device",
      +    "hours_back",
      +    "severity_threshold",
      +    "truncated",
      +    "api_total"
      +  ],
      +  "type": "object"
      +}
  2. Changed1 schema field changedv4.3.0
    • changedInput schema / properties / group_id / description
      Previous value: -"Optional device group ID filter"New value: +"Optional device group ID filter; not with device_id or device_name"
  3. First observedv4.2.0

TDQS

A4.3/5.0
Behavior5/5

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

Annotations already cover safety (readOnly, idempotent, non-destructive), yet the description adds substantial behavior beyond them: it reads cleared and active alerts as two lists, discloses a 5000-alert cap with a 'truncated' signal when either read is cut short, and specifies the error_budget return fields and the exact status thresholds (healthy, warning >50%, critical >90%, exhausted). That is exactly the kind of result-shaping and limit information an agent needs before trusting the numbers.

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?

Front-loaded with the core purpose, then conditional behavior, then a clearly labeled 'Common mistakes' block — a sensible ordering. The error_budget field enumeration is dense but each field carries decision value. Slightly long, though nothing is genuinely redundant.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return shape need not be documented, yet the description still explains the truncation flag and error_budget semantics that an output schema alone would not convey as interpretable meaning. Combined with the scope-defaults warning, an agent has everything needed to call this correctly and interpret the result.

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?

Schema coverage is 100%, so baseline would be 3, but the description adds meaning the schema does not: it explains that hours_back's 720 default is a common mistake, that scoping by device/group improves performance, and that target_slo materially changes the response by adding error_budget over the window. severity_threshold is left to the schema, which is acceptable given full coverage.

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 opens with a specific verb+resource ('Calculate availability percentage from alert history') and enumerates the concrete outputs (SLA-style uptime, MTTR, per-device breakdown, optional error budget). An agent can immediately tell this is a derived-metrics computation rather than a raw alert fetch. It stops short of naming a sibling like analyze_alerts or get_alerts as the alternative, so differentiation is inferred rather than stated.

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?

It gives concrete operational guidance: use target_slo to trigger error_budget, and narrow scope with device_id/group_id for performance. The 'Common mistakes' section flags the 720-hour default window, which is genuine when-to-consider guidance. It does not state when to prefer a sibling alert-listing tool over this one, leaving that comparison to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools