Predictive Maintenance
v0.13.0Industrial vibration analysis, bearing fault diagnosis, ISO 20816, and ML anomaly detection
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
list_signals
List signal files on disk or signals loaded in the repository. scope='disk' (default): files under data/signals/ that load_signal can open — use before loading. scope='memory': signals currently cached in the in-memory repository with their metadata (signal_id, sampling_rate, declared unit) — use to see which signal_ids are available for analysis. Args: ctx: MCP context. Unused — see this module's docstring on logging. scope: 'disk' for loadable files, 'memory' for loaded signal_ids. Returns: Dict with scope, count, and either 'files' (r…
| Parameter | Type | Description |
|---|---|---|
scope | string |
generate_test_signal
Generate a synthetic test signal, save it, and load it into the repository. The signal is written to data/signals/ with a timestamped filename and a companion _metadata.json declaring sampling_rate and signal_unit='g' (synthetic acceleration), then auto-registered in the repository — the returned signal_id is immediately usable by every analysis, diagnosis, and ISO severity tool with no manual steps. Signal content: 'bearing_fault' = 10 Hz impacts modulating a 1 kHz carrier; 'gear_fault' = 200 Hz mesh tone + harmonics; 'imbalance' = 25 Hz (1500 RPM) tone; 'n…
| Parameter | Type | Description |
|---|---|---|
duration | number | |
noise_level | number | |
random_seed | ||
sampling_rate | number | |
signal_type | string |
load_signal
Load one signal — or a batch — into the in-memory repository. Once loaded, reference the signal by its signal_id in every analysis, diagnosis, report, and prognostics tool (the load -> analyze -> diagnose -> report flow uses signal_id as the single handle). Batch form: pass a LIST of file paths (e.g. for training sets). The batch is fail-fast and atomic — all paths and derived ids are validated up front, and on the first problem ONE error names the offending entries and nothing is loaded. One declared sampling_rate/ signal_unit applies to all files; per-…
| Parameter | Type | Description |
|---|---|---|
filepath * | ||
byte_order | ||
channel_index | ||
header_offset | ||
n_channels | ||
overwrite | boolean | |
sample_format | ||
sampling_rate | ||
scale_factor | ||
signal_id | ||
signal_unit |
get_signal_info
Get metadata for a stored signal without loading the full array. Includes the COMPLETE companion-metadata dict (source_metadata: rpm/ shaft_speed, reference frequencies, ...) alongside the repository fields (sampling_rate, declared signal_unit, shape, timestamps). Args: ctx: MCP context. Unused — see this module's docstring on logging. signal_id: ID of a signal previously loaded via load_signal. Returns: StoredSignalInfo with source_metadata populated from the companion _metadata.json (empty dict when the file has none). Raises:…
| Parameter | Type | Description |
|---|---|---|
signal_id * | string |
clear_signals
Remove one signal — or all signals — from the in-memory repository. Args: ctx: MCP context. Unused — see this module's docstring on logging. signal_id: ID to remove; None (default) clears the whole cache. Returns: Dict with cleared_count, plus signal_id and status ('removed' or 'not_found') for single-signal calls.
| Parameter | Type | Description |
|---|---|---|
signal_id |
analyze_fft
Perform FFT (Fast Fourier Transform) analysis on a stored signal. FFT analysis converts the signal from time domain to frequency domain, allowing identification of harmonic components and faults that manifest at specific frequencies. Requires the signal loaded via load_signal() first; the sampling rate comes from the stored signal metadata. 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 se…
| Parameter | Type | Description |
|---|---|---|
signal_id * | string | |
max_frequency | ||
random_seed | ||
segment_duration |
analyze_envelope
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…
| Parameter | Type | Description |
|---|---|---|
signal_id * | string | |
filter_high | number | |
filter_low | number | |
num_peaks | integer | |
random_seed | ||
segment_duration |
analyze_statistics
Calculate statistical parameters of a stored signal for diagnostics. Statistical parameters are key indicators for diagnostics: - RMS: Effective value, correlated to signal energy - Crest Factor: Indicates presence of impulses (high = possible faults) - Kurtosis: Measures impulsiveness (excess kurtosis; >0 = non-Gaussian, >3 = strong impulses) - Peak-to-Peak: Signal range Requires the signal loaded via load_signal() first. Statistical parameters are screening indicators, not definitive diagnostics — combine with frequency-domain evidence. **Signal…
| Parameter | Type | Description |
|---|---|---|
signal_id * | string |
extract_features_from_signal
Extract time-domain features from a stored signal using sliding windows. Segments the signal into overlapping windows and extracts 17 statistical features from each segment. Features include: mean, std, RMS, kurtosis, crest factor, entropy, etc. Requires the signal loaded via load_signal() first; the sampling rate comes from the stored signal metadata. Returns an in-memory summary only — no CSV is written to data/signals/. Args: signal_id: ID of the stored signal (from load_signal). segment_duration: Duration of each segment in seconds (default:…
| Parameter | Type | Description |
|---|---|---|
signal_id * | string | |
overlap_ratio | number | |
segment_duration | number |
compute_power_spectral_density
Compute Power Spectral Density (Welch method) for a stored signal. Requires signal loaded via load_signal() first. Args: signal_id: ID of the stored signal. nperseg: Samples per FFT segment (default 256). noverlap: Overlap between segments (default 128). window: Window function (default 'hann').
| Parameter | Type | Description |
|---|---|---|
signal_id * | string | |
noverlap | integer | |
nperseg | integer | |
window | string |
compute_spectrogram_stft
Compute STFT spectrogram for a stored signal. Returns time-frequency summary (no full 2D array). Use for detecting time-varying frequency content (transient faults, speed changes). Args: signal_id: ID of the stored signal. nperseg: Samples per STFT segment (default 256). noverlap: Overlap between segments (default 128). window: Window function (default 'hann').
| Parameter | Type | Description |
|---|---|---|
signal_id * | string | |
noverlap | integer | |
nperseg | integer | |
window | string |
assess_severity
Assess vibration severity (ISO 20816-3 zones A-D) and alert level. THE unified severity tool: ISO zone assessment and alert classification in one call. Zone boundary values are those of ISO 10816-3:2009 (ISO 20816-3:2022 merges zones A/B — provenance is noted in the result). Scope: machines rated above 15 kW; a declared machine_power_kw below 15 kW is refused. Input routes (exactly ONE required): - signal_id: a stored signal (load_signal first). Sampling rate AND declared unit come from the stored metadata; an undeclared unit is refused, never guesse…
| Parameter | Type | Description |
|---|---|---|
machine_group | integer | |
machine_power_kw | ||
rms_velocity_mm_s | ||
rpm | ||
signal_id | ||
support_type | string | |
thresholds |
train_anomaly_model
Train ML-based anomaly detection model on healthy data (UNSUPERVISED/SEMI-SUPERVISED). All signals are referenced by signal_id: load them first with load_signal — its batch form accepts a list of file paths, e.g. load_signal(filepath=["real_train/baseline_1.csv", ...]). Each signal's sampling rate comes from its stored metadata. Complete pipeline: 1. Extract features from healthy signals (segmentation + time-domain features) 2. Standardize features (StandardScaler - fitted on training data only) 3. Dimensionality reduction (PCA with specified variance e…
| Parameter | Type | Description |
|---|---|---|
healthy_signal_ids * | array | |
fault_signal_ids | ||
healthy_validation_ids | ||
model_name | string | |
model_type | string | |
overlap_ratio | number | |
pca_variance | number | |
segment_duration | number |
predict_anomalies
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: 'anom…
| Parameter | Type | Description |
|---|---|---|
signal_id * | string | |
model_name | string |
list_machine_manuals
List all machine manuals in resources/machine_manuals/ (PDF/TXT). Use before read_manual_excerpt / extract_manual_specs, and pass the returned filenames exactly as-is. Returns: List of dicts with filename, size_mb, modified, and path.
extract_manual_specs
Extract machine specifications from an equipment manual (PDF). Extracts bearing designations (e.g. SKF 6205), operating speeds (RPM), power ratings (kW/HP/MW), and a text excerpt. Results are cached. If a bearing's geometry is not in the manual, follow up with search_bearing_catalog(bearing_id=...); if it is not in the catalog either, ask the user for the geometry — never invent it. Args: file_name: Manual filename in resources/machine_manuals/ use_cache: Use cached extraction if available (default: True) ctx: MCP context. Unused — see…
| Parameter | Type | Description |
|---|---|---|
file_name * | string | |
use_cache | boolean |
calculate_bearing_characteristic_frequencies
Calculate bearing characteristic frequencies from geometry. Standard rolling-element kinematic formulas (Randall & Antoni 2011, "Rolling element bearing diagnostics — A tutorial", MSSP 25(2)). Requires the EXACT geometry — from the manual, the catalog (search_bearing_catalog), or the user; never guessed. Deep-groove ball bearings have contact_angle_deg = 0. Args: num_balls: Number of rolling elements (Z) ball_diameter_mm: Ball/roller diameter (Bd) in mm pitch_diameter_mm: Pitch circle diameter (Pd) in mm contact_angle_deg: Cont…
| Parameter | Type | Description |
|---|---|---|
ball_diameter_mm * | number | |
num_balls * | integer | |
pitch_diameter_mm * | number | |
contact_angle_deg | number | |
rpm | number |
read_manual_excerpt
Read a text excerpt from a machine manual (PDF or TXT). Use for consecutive-page reading; for targeted questions prefer search_documentation. Start with max_pages=10 and increase only if needed (pages consume tokens). Args: file_name: Manual filename in resources/machine_manuals/ (PDF or TXT) max_pages: Maximum pages to extract (ignored for TXT files) ctx: MCP context. Unused — see this module's docstring on logging. Returns: Extracted text from the manual. Raises: FileNotFoundError: If the manual does not e…
| Parameter | Type | Description |
|---|---|---|
file_name * | string | |
max_pages | integer |
search_bearing_catalog
Search for bearing specifications in the local verified catalog. Fallback for when the machine manual names a bearing but not its geometry. The catalog is small BY DESIGN: only entries whose geometry is traceable to a public source (mandatory `source` citation). A miss is a legitimate negative outcome — ask the user for the geometry; never guess it. Args: bearing_id: Bearing designation (e.g. "6205", "SKF 6205-2RS") ctx: MCP context. Unused — see this module's docstring on logging. Returns: Dictionary with bearing specifications i…
| Parameter | Type | Description |
|---|---|---|
bearing_id * | string |
search_documentation
Semantic search across all machine manuals and bearing catalogs. Uses vector retrieval (RAG) to find the most relevant passages from PDFs, text files, and JSON catalogs in resources/. Backends (chosen automatically): - FAISS + sentence-transformers (pip install predictive-maintenance-mcp[vector-search]) - TF-IDF keyword search (default, zero extra deps) The index is built lazily on first call and cached on disk. It is automatically rebuilt when source files change. Args: query: Natural-language question or keywords…
| Parameter | Type | Description |
|---|---|---|
query * | string | |
force_reindex | boolean | |
top_k | integer |
check_bearing_faults
Check expected fault frequencies in a stored signal's envelope spectrum. THE unified bearing-check tool: catalog lookup, explicit frequencies, or explicit geometry in one call. Requires the signal loaded via load_signal() first. Expected-frequency routes (exactly ONE required): - bearing_id: catalog lookup (verified entries only) — BPFO/BPFI/BSF/ FTF computed from the catalog geometry; the entry's source citation is echoed in the result. - frequencies: explicit {label: hz} dict — for bearings not in the catalog or non-bearing checks such as a gea…
| Parameter | Type | Description |
|---|---|---|
rpm * | number | |
signal_id * | string | |
ball_diameter_mm | ||
bearing_id | ||
contact_angle_deg | number | |
frequencies | ||
num_balls | ||
pitch_diameter_mm | ||
tolerance_pct | number |
diagnose_vibration
Full integrated diagnosis: FFT + PSD + STFT + bearing faults + ISO severity. Comprehensive vibration diagnostic pipeline. Loads signal from repository, runs all analyses, and synthesizes results into an actionable report. The ISO severity block uses ISO 20816-3 machine group/support type (zone boundaries from ISO 10816-3:2009, provenance noted in output). The diagnosis DEGRADES instead of failing when the ISO verdict cannot be produced honestly: if the stored signal has no declared unit (or the sampling rate cannot cover the ISO evaluation band), the iso_sever…
| Parameter | Type | Description |
|---|---|---|
rpm * | number | |
signal_id * | string | |
bearing_id | ||
machine_group | integer | |
support_type | string |
generate_diagnostic_report
Generate the integrated diagnostic report — one document, whole case. Runs the full diagnosis, then renders signal overview, ISO severity, anomaly state, characteristic-frequency matching, spectral energy, an annotated envelope spectrum, and recommended actions into a single self-contained document. AUTHORSHIP CONTRACT — this matters more than it may appear. Every evaluative sentence in the returned ``statements`` list was written by this server. Reuse them verbatim when presenting the result. Do NOT coin standard names, machine classes, severity zones, or…
| Parameter | Type | Description |
|---|---|---|
rpm * | number | |
signal_id * | string | |
baseline_signal_id | ||
bearing_id | ||
formats | ||
machine_group | integer | |
support_type | string |
generate_diagnostic_report_docx
Generate a structured Word (.docx) diagnostic report for a stored signal. Requires: ``pip install predictive-maintenance-mcp[docx]`` ``sections`` is a dict whose keys define what to include (all optional): - statistics: dict (RMS, Kurtosis, Crest Factor …) - fft_peaks: list [{frequency, magnitude_db, note}, …] - envelope_peaks: list [{frequency, magnitude_db, match}, …] - bearing_frequencies: dict {BPFO, BPFI, BSF, FTF} - iso: dict (mapped from assess_severity output) - diagnosis:…
| Parameter | Type | Description |
|---|---|---|
sections * | object | |
signal_id * | string | |
title |
plot_signal
Generate interactive time-domain plot for a stored signal. Creates an interactive HTML plot showing the signal in the time domain. Useful for inspecting signal quality, identifying anomalies, and visualizing transients. Requires the signal loaded via load_signal() first; the sampling rate comes from the stored signal metadata. Args: signal_id: ID of the stored signal (from load_signal). time_range: [start_time, end_time] in seconds to zoom on a portion (optional) show_statistics: Show RMS, peak levels as horizontal lines (default: True)…
| Parameter | Type | Description |
|---|---|---|
signal_id * | string | |
show_statistics | boolean | |
time_range | ||
title |
generate_fft_report
Generate an interactive FFT spectrum report (HTML) for a stored signal. Saves a self-contained Plotly HTML report (spectrum in dB, automatic peak detection, harmonic labels) to the reports/ directory with a timestamped filename — consecutive runs produce distinct files. Requires the signal loaded via load_signal() first; the sampling rate comes from the stored signal metadata. Args: signal_id: ID of the stored signal (from load_signal). max_freq: Maximum frequency to display (Hz). Default 5000 Hz num_peaks: Number of peaks to detect and…
| Parameter | Type | Description |
|---|---|---|
signal_id * | string | |
max_freq | number | |
num_peaks | integer | |
rpm |
generate_envelope_report
Generate professional envelope analysis report (HTML) for a stored signal. Generates a professional HTML report file instead of inline content. Saves to reports/ directory. Requires the signal loaded via load_signal() first; the sampling rate comes from the stored signal metadata. Reference bearing frequencies (BPFO/BPFI/BSF/FTF) can be passed explicitly or, if omitted, are read from the source file's companion _metadata.json when present. Args: signal_id: ID of the stored signal (from load_signal). filter_low: Bandpass filter low cutoff (Hz).…
| Parameter | Type | Description |
|---|---|---|
signal_id * | string | |
bearing_freqs | ||
filter_high | ||
filter_low | number | |
max_freq | number | |
num_peaks | integer |
generate_iso_report
Generate an ISO 20816-3 evaluation report (HTML) for a stored signal. Saves a self-contained Plotly HTML report (color-coded A-D zone chart with the measured RMS marker, boundaries, severity text) to the reports/ directory with a timestamped filename. The evaluation itself is delegated to assess_severity — requires the signal loaded via load_signal() first with sampling rate AND a declared unit (units are never guessed). Args: signal_id: ID of the stored signal (from load_signal). machine_group: 1 (large, >300 kW) or 2 (medium, 15-300 kW)…
| Parameter | Type | Description |
|---|---|---|
signal_id * | string | |
machine_group | integer | |
rpm | ||
support_type | string |
list_html_reports
List HTML reports, or get one report's embedded metadata. Without file_name: lists every report in reports/ with file name, type, signal, and size. With file_name: returns that report's embedded metadata block (absorbed get_report_info). Never returns HTML content — metadata only, to avoid token consumption. Args: file_name: Optional report filename inside reports/ — returns its metadata instead of the listing. Returns: List of report summaries (no file_name), or a dict with the single report's metadata (file_name given).…
| Parameter | Type | Description |
|---|---|---|
file_name |
generate_pca_visualization_report
Generate PCA visualization HTML report showing test data in 2D PCA space. Creates interactive scatter plot with: - Test/prediction data (green = predicted healthy, red = predicted anomaly) - PC1 vs PC2 axes with variance explained - Hover information showing segment details and prediction status **IMPORTANT**: Labels show MODEL PREDICTIONS, not ground truth. Use `true_labels` parameter to provide actual labels for validation visualization. Requires the test signals loaded via load_signal() first; each signal's sampling rate comes from its stored metadata…
| Parameter | Type | Description |
|---|---|---|
model_name * | string | |
overlap_ratio | number | |
segment_duration | number | |
test_signal_ids | ||
true_labels |
generate_feature_comparison_report
Generate feature comparison report with violin plots comparing time-domain features. Creates interactive HTML report with violin plots showing distribution of 17 time-domain features across different signal groups (e.g., Healthy vs Faulty). Requires every signal loaded via load_signal() first; each signal's sampling rate comes from its stored metadata. **Strategy**: Same HTML report approach as other reports. Useful for understanding which features are most discriminative for fault detection. Args: signal_groups: Dictionary mapping group names to lis…
| Parameter | Type | Description |
|---|---|---|
signal_groups * | object | |
features_to_plot | ||
overlap_ratio | number | |
segment_duration | number |
estimate_rul
Estimate Remaining Useful Life from repeated measurements over time. RUL is only physically meaningful when fitted on a degradation trend across MULTIPLE measurements of the same machine taken at different times (days/weeks/months apart). This tool refuses a single recording or single point — for within-recording screening use analyze_signal_trend instead. Two mutually exclusive input routes (both need `timestamps`, one entry per measurement, strictly increasing, in `time_unit`): 1. `feature_values`: the degradation indicator already measured external…
| Parameter | Type | Description |
|---|---|---|
failure_threshold * | number | |
timestamps * | array | |
feature_name | string | |
feature_values | ||
method | string | |
signal_ids | ||
time_unit | string |
analyze_signal_trend
Within-recording screening: feature trend + degradation onset. THE unified screening tool: feature trend AND degradation onset in one call. Segments a single recording (seconds of data), extracts the requested feature per segment, tests whether the per-segment values show a statistically significant trend (slope p < 0.05), and detects the first segment AFTER the baseline window (first half of the series) whose value exceeds baseline mean + onset_threshold_sigma standard deviations. Onset inside the baseline window cannot be detected (the baseline defines "n…
| Parameter | Type | Description |
|---|---|---|
signal_id * | string | |
feature_name | string | |
onset_threshold_sigma | number | |
overlap_ratio | number | |
segment_duration | number |
generate_maintenance_recommendations
Generate maintenance recommendations based on severity and detected faults. Combines ISO zone-based urgency with fault-specific maintenance actions. This tool intentionally does NOT accept a confidence value: any number supplied by the caller would be echoed into advisory output without evidential basis. Args: ctx: MCP context. Unused — see this module's docstring on logging. severity_zone: ISO zone letter — "A", "B", "C", or "D". fault_types: Detected fault types from the closed canonical vocabulary — outer_race/inner_race/ball/c…
| Parameter | Type | Description |
|---|---|---|
severity_zone * | string | |
fault_types |