Skip to main content
Glama
LGDiMaggio

Predictive Maintenance MCP Server

analyze_envelope

Detect bearing faults by performing envelope-spectrum analysis on vibration signals, returning top FFT peaks for comparison with bearing characteristic frequencies.

Instructions

Envelope-spectrum analysis of a stored signal (bearing fault screening).

THE unified envelope tool: bandpass filter -> Hilbert
envelope -> mean subtraction + Hann window -> FFT -> top peaks.
The mean subtraction/window step is an intentional U9 fix: the
envelope's DC leakage used to bury the low-frequency FTF zone.
Requires the signal loaded via load_signal() first; the sampling
rate comes from the stored signal metadata.

The requested band must fit the signal: an invalid band (low <= 0,
low >= high, high > Nyquist) raises a ValueError — it is NEVER
silently clamped. The band used is echoed in the result.

By default analyzes the LEADING 1.0-second segment (deterministic:
two identical calls return identical results). Set
segment_duration=None to analyze the entire signal, or pass
random_seed to sample a seeded random segment position instead.

No reference bearing frequencies are assumed: compare the returned
peaks against frequencies computed for the actual bearing and
shaft speed (check_bearing_faults or
calculate_bearing_characteristic_frequencies).

Args:
    ctx: MCP context. Unused — see this module's docstring on logging.
    signal_id: ID of the stored signal (from load_signal).
    filter_low: Bandpass low edge in Hz (default: 500).
    filter_high: Bandpass high edge in Hz (default: 5000). Must
        not exceed the signal's Nyquist frequency.
    num_peaks: Number of top peaks to return (default: 5).
    segment_duration: Duration in seconds to analyze (default:
        leading 1.0 s). None analyzes the full signal.
    random_seed: Seed for random segment position (default: None =
        deterministic leading segment).

Returns:
    EnvelopeResult with the band actually used, top peaks, and
    comparison guidance.

Raises:
    ValueError: If the signal_id is not loaded, the stored signal
        has no sampling rate, or the band is invalid vs Nyquist.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
num_peaksNo
signal_idYes
filter_lowNo
filter_highNo
random_seedNo
segment_durationNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
diagnosisYesPeak listing and comparison guidance. No reference bearing frequencies are assumed — compare against frequencies computed for the actual bearing and shaft speed.
signal_idYesSignal identifier used
top_peaksYesTop peaks in the envelope spectrum, sorted by frequency
filter_bandYesBandpass filter band (Hz) actually used — echoed from the request
num_samplesYesNumber of samples analyzed (envelope length)
sampling_rateYesSampling rate (Hz)

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Changed18 schema fields changedv0.9.1
    • removedInput schema / properties / filename
      Removed value: -{
      -  "title": "Filename",
      -  "type": "string"
      -}
    • changedInput schema / properties / filter_high / default
      Previous value: -2000New value: +5000
    • removedInput schema / properties / sampling_rate
      Removed value: -{
      -  "anyOf": [
      -    {
      -      "type": "number"
      -    },
      -    {
      -      "type": "null"
      -    }
      -  ],
      -  "default": null,
      -  "title": "Sampling Rate"
      -}
    • changedInput schema / properties / segment_duration / default
      Previous value: -nullNew value: +1
    • addedInput schema / properties / signal_id
      Added value: +{
      +  "title": "Signal Id",
      +  "type": "string"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "filename"
      -]New value: +[
      +  "signal_id"
      +]
    • addedOutput schema / $defs
      Added value: +{
      +  "SpectralPeak": {
      +    "description": "A single peak in the frequency spectrum.",
      +    "properties": {
      +      "frequency_hz": {
      +        "description": "Peak frequency in Hz",
      +        "title": "Frequency Hz",
      +        "type": "number"
      +      },
      +      "magnitude": {
      +        "description": "Peak magnitude (linear)",
      +        "title": "Magnitude",
      +        "type": "number"
      +      },
      +      "magnitude_db": {
      +        "description": "Peak magnitude in dB (relative to max)",
      +        "title": "Magnitude Db",
      +        "type": "number"
      +      },
      +      "note": {
      +        "default": "",
      +        "description": "Optional annotation (e.g. harmonic label)",
      +        "title": "Note",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "frequency_hz",
      +      "magnitude",
      +      "magnitude_db"
      +    ],
      +    "title": "SpectralPeak",
      +    "type": "object"
      +  }
      +}
    • changedOutput schema / description
      Previous value: -"Envelope analysis result - optimized for chat display."New value: +"Unified envelope-spectrum analysis result (U9 merge).\n\nCompact summary: top peaks + the band ACTUALLY used — no full arrays.\nThe envelope FFT is computed after mean subtraction + Hann window\n(audit 2.8 fix), so low-frequency (FTF-zone) peaks are not buried by\nDC leakage."
    • changedOutput schema / properties / diagnosis / description
      Previous value: -"Interpretive diagnosis text with bearing frequency analysis"New value: +"Peak listing and comparison guidance. No reference bearing frequencies are assumed — compare against frequencies computed for the actual bearing and shaft speed."
    • changedOutput schema / properties / filter_band / description
      Previous value: -"Bandpass filter band (Hz)"New value: +"Bandpass filter band (Hz) actually used — echoed from the request"
    • changedOutput schema / properties / num_samples / description
      Previous value: -"Number of samples in envelope signal"New value: +"Number of samples analyzed (envelope length)"
    • removedOutput schema / properties / peak_frequencies
      Removed value: -{
      -  "description": "Top peak frequencies (Hz)",
      -  "items": {
      -    "type": "number"
      -  },
      -  "title": "Peak Frequencies",
      -  "type": "array"
      -}
    • removedOutput schema / properties / peak_magnitudes
      Removed value: -{
      -  "description": "Top peak magnitudes",
      -  "items": {
      -    "type": "number"
      -  },
      -  "title": "Peak Magnitudes",
      -  "type": "array"
      -}
    • addedOutput schema / properties / signal_id
      Added value: +{
      +  "description": "Signal identifier used",
      +  "title": "Signal Id",
      +  "type": "string"
      +}
    • removedOutput schema / properties / spectrum_preview_freq
      Removed value: -{
      -  "default": [],
      -  "description": "First 100 freq points (Hz)",
      -  "items": {
      -    "type": "number"
      -  },
      -  "title": "Spectrum Preview Freq",
      -  "type": "array"
      -}
    • removedOutput schema / properties / spectrum_preview_mag
      Removed value: -{
      -  "default": [],
      -  "description": "First 100 magnitude points",
      -  "items": {
      -    "type": "number"
      -  },
      -  "title": "Spectrum Preview Mag",
      -  "type": "array"
      -}
    • addedOutput schema / properties / top_peaks
      Added value: +{
      +  "description": "Top peaks in the envelope spectrum, sorted by frequency",
      +  "items": {
      +    "$ref": "#/$defs/SpectralPeak"
      +  },
      +  "title": "Top Peaks",
      +  "type": "array"
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "num_samples",
      -  "sampling_rate",
      -  "filter_band",
      -  "peak_frequencies",
      -  "peak_magnitudes",
      -  "diagnosis"
      -]New value: +[
      +  "signal_id",
      +  "num_samples",
      +  "sampling_rate",
      +  "filter_band",
      +  "top_peaks",
      +  "diagnosis"
      +]
  2. First observedv0.8.0

TDQS

A5/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and excels. It discloses the intentional U9 fix (mean subtraction/window) and why it exists ('DC leakage used to bury the low-frequency FTF zone'), states invalid bands raise ValueError and are 'NEVER silently clamped', notes the band is echoed in the result, and explains the deterministic default (leading 1.0-s segment) and random_seed behavior. Also clarifies no reference frequencies are assumed, preventing false expectations.

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 long but every sentence earns its place: algorithm, rationale, requirements, constraints, defaults, and comparison guidance. It uses a clear structure (intro, behavior, Args, Returns, Raises) and front-loads the purpose. No fluff or repetition; the 'THE unified envelope tool' line, while emphatic, reinforces its role among siblings.

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?

The tool is complex (6 parameters, prerequisites, error conditions, segment selection) and the description covers all aspects: preconditions (signal must be loaded), constraints (band vs Nyquist), deterministic vs random behavior, no assumed bearing frequencies, and error types. The output schema exists, so it appropriately keeps return details brief ('EnvelopeResult with the band actually used, top peaks, and comparison guidance').

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description must fully compensate. It explains every parameter: signal_id (ID from load_signal), filter_low/filter_high (edges in Hz with defaults, Nyquist constraint), num_peaks (count of top peaks), segment_duration (duration, default leading 1.0s, None for full signal), random_seed (seed for random position, None = deterministic). It also adds error semantics for invalid values, going far beyond the bare schema.

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 states a specific verb+resource: 'Envelope-spectrum analysis of a stored signal (bearing fault screening)' and details the algorithm ('bandpass filter -> Hilbert envelope -> mean subtraction + Hann window -> FFT -> top peaks'). It clearly distinguishes itself from siblings like analyze_fft and check_bearing_faults by positioning itself as 'THE unified envelope tool' and referencing the comparison tools for subsequent analysis.

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

Usage Guidelines5/5

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

Provides explicit usage context: 'Requires the signal loaded via load_signal() first', explains when to use the tool (bearing fault screening), and gives alternative/next-step guidance: 'compare the returned peaks against frequencies computed for the actual bearing and shaft speed (check_bearing_faults or calculate_bearing_characteristic_frequencies)'. It also clarifies segment selection options and when to pass None or random_seed.

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

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