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

io.github.ryanmat/logicmonitor

by ryanmat

analyze_metric

Read-onlyIdempotent

Compute summary statistics, trends, seasonality, change points, anomalies, forecasts, and baseline comparisons from recent device or OTLP metric history to support monitoring decisions.

Instructions

Analyze one device instance's metric series, such as CPU, memory or disk usage: call this for statistics on a datapoint's recent history, such as its current level against the window, whether it is rising, its daily cycle, when it shifted, or which samples stand out. One paged read of the window feeds every section; 'summary' gives latest, mean, standard deviation, min, max and the latest sample's signed z-score; 'trend' gives least-squares and Theil-Sen slopes per hour, r-squared, coefficient of variation, the detrended 24-hour autocorrelation and a label (volatile, cyclic, increasing, decreasing or stable); 'seasonality' gives detrended autocorrelation at 1, 4, 12, 24 and 168 hours, the dominant period and the peak hours in UTC; 'change_points' gives level shifts, where the mean of the next 30 samples leaves the mean of the previous 30 by five times the noise in that comparison (measured with any steady trend and autocorrelation the noise has), with the daily cycle removed first when the window holds three days or more and that leaves less noise; each shift has its timestamp and the levels before and after it, less the daily cycle when that was removed. A change in the last 30 samples is not reported yet, small shifts in strongly autocorrelated noise go unfound, on a window under a day a change inflates the noise and smaller shifts go unfound, and changes about a day apart in a few days leave the cycle in and go unfound; 'anomalies' gives z-score, IQR and MAD hits, each method's 20 most extreme; 'forecast' gives the least-squares and Holt-Winters (daily season, two days of samples needed) slopes per hour and, with threshold, when each crosses it, within 30 days; 'baseline' compares the window with one as long ending baseline_hours_ago hours ago (one more read): both windows' statistics, the mean's percent deviation and a status (normal within 20 percent, elevated or reduced within 50, anomalous past it). The baseline runs only with baseline_hours_ago. Use get_device_data for the raw samples. With source="otlp" it reads one PromQL range query (query, hours, step) in place of a device instance and runs the same sections on each series it returns, the first 20.

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": "analyze_metric"
  }
}

Input Schema

NameRequiredDescriptionDefault
stepNoResolution step of the otlp read, such as '5m'; the metrics backend picks one when omitted
hoursNoHours of history to read (default: 168)
queryNoPromQL expression; required with source otlp
sourceNodevice reads a device instance's datapoints; otlp reads a PromQL range query over native OTLP metricsdevice
analysesNoSections to compute (all if omitted; the baseline only with baseline_hours_ago)
device_idNoDevice ID; required with source device
thresholdNoLevel the forecast reports the crossing of
datapointsNoComma-separated datapoint names (all if omitted); source device
instance_idNoInstance ID; required with source device
baseline_hours_agoNoHours before now the baseline window ends, such as 168 for the same window a week earlier
device_datasource_idNoDevice-DataSource ID; required with source device

Output Schema

NameRequiredDescriptionDefault
stepNo
hoursYesHours the window reaches back.
queryNo
portalNoThe portal the call ran against, in multi-portal mode.
seriesNoSections per series label set.
sourceNo
analysesYes
warningsNo
device_idNo
datapointsNoSections per datapoint name.
instance_idNo
baseline_hours_agoNo
series_count_totalNo
device_datasource_idNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv5.0.1

TDQS

A4.5/5.0
Behavior5/5

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

Beyond the readOnly/idempotent annotations, it discloses the read-cost model ('one paged read of the window feeds every section', the baseline taking 'one more read') and concrete failure modes for change_points: shifts in the last 30 samples not reported, small shifts in autocorrelated noise unfound, windows under a day inflating noise, and ~daily-spaced shifts losing the cycle removal. It also notes Holt-Winters needs two days of samples and that the baseline runs only with baseline_hours_ago.

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

Conciseness3/5

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

It is front-loaded with purpose and mode selection, which is good, but the body is a single dense block with semicolon-chained clauses; the change_points sentence alone runs several nested conditions. The detail is largely justified by the tool's complexity, yet the readability cost is real and some limitation clauses could be tightened.

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?

For an 11-parameter, multi-section analytical tool with an output schema, the description covers every section's contents, mode switching, the read budget, and the known blind spots. An agent has enough to choose sections, set threshold and baseline_hours_ago correctly, and anticipate when results will be missing.

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 the baseline is 3; the description exceeds it by explaining what each analysis section computes, how 'threshold' is consumed by forecast, what baseline_hours_ago compares against, and how source="otlp" repurposes query/hours/step and caps output at the first 20 series. It does not explain the interaction of datapoints with analyses, which keeps it off a 5.

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 opens with a specific verb plus resource ('Analyze one device instance's metric series, such as CPU, memory or disk usage') and immediately scopes it to statistics over a datapoint's recent history rather than raw values. It also distinguishes the two operating modes (source=device vs source=otlp) and points to get_device_data for raw samples, so an agent can separate it from siblings without opening a schema.

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 states the trigger conditions clearly ('call this for statistics on a datapoint's recent history, such as its current level against the window, whether it is rising...') and names the alternative for raw data. What is missing is an explicit when-not for the other analytical siblings (correlate_metrics, capacity_plan), but the guidance is otherwise actionable.

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