Skip to main content
Glama
LGDiMaggio

Predictive Maintenance MCP Server

by LGDiMaggio

predict_anomalies

Detect anomalies in a loaded signal using a trained model. Returns aggregate anomaly statistics and worst segments for machinery health assessment.

Instructions

    Predict anomalies in a stored signal using a trained model.

    Requires the signal loaded via load_signal() first and a model
    trained via train_anomaly_model (its result echoes the model_name
    to pass here). Pipeline: segment -> features -> scaler -> PCA ->
    predict -> aggregate.

    Output is BOUNDED: counts, anomaly ratio, score percentiles, and
    up to 10 worst segments — never per-segment arrays, regardless of
    signal length.

    Args:
        signal_id: ID of the stored signal to analyze (from load_signal)
        model_name: Name of trained model (default: 'anomaly_model')
        ctx: MCP context for progress/logging

    Returns:
        AnomalyPredictionResult with aggregate statistics and health
        assessment.

    Raises:
        FileNotFoundError: If the model does not exist (the message
            lists the models actually on disk).
        ValueError: If the signal_id is not loaded, or no sampling rate
            is available for segmentation.
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
signal_idYes
model_nameNoanomaly_model

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
model_nameYesName of the trained model used
num_segmentsYesNumber of segments analyzed
anomaly_countYesNumber of anomalies detected
anomaly_ratioYesRatio of anomalies (0-1)
overall_healthYesOverall health status: 'Healthy', 'Suspicious', 'Faulty' (thresholded on anomaly_ratio: <0.1, <0.3, >=0.3)
worst_segmentsNoUp to 10 most anomalous segments, each with segment_index, start_time_s, and score (when available) — enough to locate the worst regions without dumping per-segment arrays.
score_percentilesNoPercentiles (p5/p25/p50/p75/p95) of the model decision scores; negative = anomalous side. None when the model exposes no decision_function.
segment_duration_sYesSegment length in seconds (from the model's training metadata)
Behavior5/5

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

With no annotations provided, the description fully discloses behavioral traits: output is bounded (counts, anomaly ratio, score percentiles, up to 10 worst segments), errors are documented (FileNotFoundError, ValueError), and the pipeline steps are detailed. No contradiction with annotations.

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?

The description is well-structured and front-loaded: purpose, prerequisites, pipeline, output details, args, returns, raises. Every sentence adds value with no fluff.

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?

Given the tool complexity (2 params, output schema exists), the description is complete: it covers prerequisites, pipeline, output nature, and errors. With no annotations, it provides sufficient context for an agent to use correctly.

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?

The input schema has 0% coverage, so the description must compensate. It explains signal_id as the ID from load_signal and model_name as the trained model name with default. While it adds meaning, it stops short of specifying validation rules or formats.

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 predicts anomalies in a stored signal using a trained model. It specifies the pipeline (segment -> features -> scaler -> PCA -> predict -> aggregate) and distinguishes from siblings like train_anomaly_model and analyze_statistics.

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 explicitly requires the signal to be loaded via load_signal() and a model trained via train_anomaly_model. It outlines the prerequisite pipeline steps. However, it does not explicitly state when not to use this tool or mention alternatives.

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/LGDiMaggio/predictive-maintenance-mcp'

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