| list_signalsA | List all available signal files in the data/signals directory.
Returns:
A formatted text listing of all available signals
|
| generate_test_signalA | Generate a test signal to validate analyses.
Useful for testing algorithms without having real data available.
Args:
signal_type: Signal type ("bearing_fault", "gear_fault", "imbalance", "normal")
duration: Signal duration in seconds (default: 10.0, gives 0.1 Hz frequency resolution)
sampling_rate: Sampling frequency in Hz (default: 10000)
noise_level: Noise level to add (default: 0.1)
ctx: Context for logging
Returns:
Generated file name
|
| load_signalA | Load a signal into the in-memory repository for fast repeated access. Once loaded, reference the signal by its signal_id in other tools like
compute_power_spectral_density, diagnose_vibration, etc.
Args:
filepath: Filename relative to data/signals/, or absolute path.
signal_id: Custom ID (defaults to filename stem).
sampling_rate: Sampling rate in Hz (overrides metadata file).
|
| list_stored_signalsA | List all signals currently cached in the in-memory repository. |
| get_signal_infoB | Get metadata for a stored signal without loading the full array. |
| clear_signalC | Remove a signal from the in-memory repository. |
| clear_all_signalsB | Clear all signals from the in-memory repository. |
| analyze_fftA | Perform FFT (Fast Fourier Transform) analysis on a signal.
FFT analysis converts the signal from time domain to frequency domain,
allowing identification of harmonic components and faults that manifest
at specific frequencies.
By default, analyzes a RANDOM 1.0-second segment from the signal for efficiency.
Set segment_duration=None to analyze the entire signal.
**CRITICAL - LLM Inference Policy:**
- **NEVER infer fault type from filename** (e.g., "OuterRaceFault_1.csv" does NOT mean outer race fault exists)
- **NEVER assume signal characteristics from filename** (e.g., "baseline" does NOT mean healthy)
- Treat ALL filenames as opaque identifiers
- Base analysis ONLY on frequency spectrum data returned by this tool
- If filename suggests a characteristic but data shows otherwise, report the data findings
**CRITICAL - Parameter Validation:**
- Sampling rate is auto-detected from metadata if available
- If no metadata: user MUST provide sampling_rate or results will be UNRELIABLE
- Segment duration defaults to 1.0s but can be customized
- User will be notified of all assumptions before analysis proceeds
Args:
ctx: MCP context for user communication
filename: Name of the file containing the signal
sampling_rate: Sampling frequency in Hz (auto-detect from metadata if None)
max_frequency: Maximum frequency to analyze (default: Nyquist frequency)
segment_duration: Duration in seconds to analyze (default: 1.0s random segment).
Set to None to analyze full signal.
random_seed: Random seed for reproducible segment selection (default: None = random)
Returns:
FFTResult with frequencies, magnitudes and dominant peak
|
| analyze_envelopeA | Perform Envelope Analysis to detect bearing faults.
Envelope analysis is particularly effective for detecting faults in ball/roller bearings.
The signal is high-pass filtered, then the envelope is calculated via Hilbert transform,
and finally the envelope spectrum is analyzed.
By default, analyzes a RANDOM 1.0-second segment from the signal for efficiency.
Set segment_duration=None to analyze the entire signal.
Returns ONLY peak information and diagnosis text (no full arrays) to avoid context overflow.
**CRITICAL - LLM Inference Policy:**
- **NEVER infer fault type from filename** (e.g., "OuterRaceFault_1.csv" does NOT mean outer race fault exists)
- **NEVER assume signal characteristics from filename** (e.g., "baseline" does NOT mean healthy)
- Treat ALL filenames as opaque identifiers
- Base diagnosis ONLY on frequency-domain evidence (peaks matching BPFO/BPFI/BSF/FTF)
- If filename suggests a fault but analysis shows no evidence, report "No fault detected despite filename"
**CRITICAL - Parameter Validation:**
- Sampling rate is auto-detected from metadata if available
- If no metadata: user MUST provide sampling_rate or results will be UNRELIABLE
- Segment duration defaults to 1.0s but can be customized
- User will be notified of all assumptions before analysis proceeds
Args:
ctx: MCP context for user communication
filename: Name of the file containing the signal
sampling_rate: Sampling frequency in Hz (auto-detect from metadata if None)
filter_low: Low frequency of bandpass filter in Hz (default: 500 Hz)
filter_high: High frequency of bandpass filter in Hz (default: 2000 Hz)
num_peaks: Number of main peaks to identify (default: 5)
segment_duration: Duration in seconds to analyze (default: 1.0s random segment).
Set to None to analyze full signal.
random_seed: Random seed for reproducible segment selection (default: None = random)
Returns:
EnvelopeResult with peak information and diagnosis (optimized for chat display)
|
| analyze_statisticsA | Calculate statistical parameters of the 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
**CRITICAL - LLM Inference Policy:**
- **NEVER infer fault type from filename** (e.g., "OuterRaceFault_1.csv" does NOT mean outer race fault exists)
- **NEVER assume signal characteristics from filename** (e.g., "baseline" does NOT mean healthy)
- Treat ALL filenames as opaque identifiers
- Statistical parameters (RMS/CF/Kurtosis) are indicators ONLY - NOT definitive diagnostics
- High kurtosis indicates "possible fault" - NOT "confirmed fault"
- Must be combined with frequency-domain evidence for diagnosis
Args:
filename: Name of the file containing the signal
Returns:
StatisticalResult with all statistical parameters
|
| extract_features_from_signalA | Extract time-domain features from signal using sliding window segmentation.
Segments the signal into overlapping windows and extracts 17 statistical features
from each segment. Features include: mean, std, RMS, kurtosis, crest factor, entropy, etc.
Args:
signal_file: Name of the CSV file in data/signals/
sampling_rate: Sampling frequency in Hz (auto-detect from metadata if None)
segment_duration: Duration of each segment in seconds (default: 0.1)
overlap_ratio: Overlap between segments, 0-1 (default: 0.5 = 50%)
ctx: MCP context for progress/logging
Returns:
FeatureExtractionResult with features matrix and metadata
Example:
extract_features_from_signal(
"healthy_motor.csv",
sampling_rate=10000,
segment_duration=0.2,
overlap_ratio=0.5
)
|
| compute_power_spectral_densityA | 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').
|
| compute_spectrogram_stftA | 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').
|
| compute_envelope_spectrum_toolB | Compute envelope spectrum for a stored signal (signal_id pattern). Use for bearing fault detection. The envelope spectrum reveals
modulation patterns caused by bearing defects.
Args:
signal_id: ID of the stored signal.
filter_low: Bandpass filter low frequency (Hz).
filter_high: Bandpass filter high frequency (Hz).
method: Envelope method (default 'hilbert').
|
| evaluate_iso_20816A | Evaluate vibration severity according to ISO 20816-3 standard.
ISO 20816-3 defines vibration severity zones for rotating machinery based on
broadband RMS velocity measurements on non-rotating parts (bearings, housings).
**CRITICAL - LLM Inference Policy:**
- **NEVER infer fault type or severity from filename** (e.g., "OuterRaceFault_1.csv" does NOT mean outer race fault)
- **NEVER assume baseline/healthy from filename** (e.g., "baseline" does NOT guarantee Zone A)
- Treat ALL filenames as opaque identifiers
- Report ONLY the ISO zone returned by measurement, regardless of filename
- If filename suggests "baseline" but measurement shows Zone C/D, report Zone C/D
**DEFAULTS** (use if user doesn't specify):
- machine_group = 2 (medium-sized machines, most common)
- support_type = "rigid" (horizontal machines on foundations)
**Machine Group Selection Guide** (ask user if unsure):
- Group 1: Large machines (power >300 kW OR shaft height H >= 315 mm)
Examples: Large turbines, generators, compressors, large pumps
- Group 2: Medium machines (15-300 kW OR 160mm <= H < 315mm) [DEFAULT]
Examples: Industrial motors, fans, pumps, gearboxes
**Support Type Selection Guide** (ask user if unsure):
- "rigid": Machine on stiff foundation, horizontal orientation [DEFAULT]
Rule: Lowest natural frequency > 1.25 x main excitation frequency
Examples: Motors/pumps on concrete, horizontal compressors
- "flexible": Machine on soft supports, vertical, or large turbine-generator sets
Examples: Vertical pumps, machines on springs, large turbogenerators
**When to ask user**:
- If power/dimensions unknown -> use defaults (Group 2, rigid)
- If clearly large turbine (>10 MW) -> suggest Group 1, flexible
- If vertical machine -> suggest flexible
- If user provides machine specs -> use guide above
Evaluation Zones:
- Zone A (Green): New machine condition - excellent
- Zone B (Yellow): Acceptable for long-term unrestricted operation
- Zone C (Orange): Unsatisfactory - limited operation, plan maintenance
- Zone D (Red): Sufficient severity to cause damage - immediate action
Args:
signal_file: Name of the CSV file in data/signals/
sampling_rate: Sampling frequency in Hz (default: 10000)
machine_group: Machine group 1 (large) or 2 (medium) (default: 2 - medium)
support_type: 'rigid' or 'flexible' (default: 'rigid')
operating_speed_rpm: Operating speed in RPM (optional, for frequency range selection)
signal_unit: Signal unit - 'g' or 'm/s2' (acceleration) or 'mm/s' or 'm/s' (velocity).
**PRIORITY ORDER FOR UNIT DETECTION:**
1. Check metadata file for 'signal_unit' field (recommended)
2. Use this parameter if explicitly provided
3. If neither exists: LLM will ask user to confirm based on RMS hypothesis
4. Default assumption: 'g' (most common for vibration sensors)
**IMPORTANT**: Wrong unit completely invalidates ISO 20816-3 results!
Best practice: Add 'signal_unit' field to metadata JSON files.
Returns:
ISO20816Result with evaluation zone, severity level, and recommendations
Example:
await evaluate_iso_20816(
ctx,
"motor_vibration.csv",
sampling_rate=10000,
machine_group=2,
support_type="rigid",
operating_speed_rpm=1500,
signal_unit="g" # Explicitly specify: 'g' or 'mm/s'
)
|
| plot_iso_20816_chartA | Generate visual chart showing ISO 20816-3 zone position for the analyzed signal.
Creates an interactive HTML plot with:
- Horizontal bar chart showing zones A/B/C/D with boundaries
- Marker indicating actual RMS velocity position
- Color-coded zones (green/yellow/orange/red)
- Zone descriptions
Args:
filename: Name of the signal file
sampling_rate: Sampling frequency (Hz)
machine_group: 1 (large >300kW) or 2 (medium 15-300kW)
support_type: 'rigid' or 'flexible'
operating_speed_rpm: Operating speed in RPM (optional)
ctx: MCP context
Returns:
Path to generated HTML file with ISO chart
|
| train_anomaly_modelA | Train ML-based anomaly detection model on healthy data (UNSUPERVISED/SEMI-SUPERVISED).
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 explained)
4. Train novelty detection model (OneClassSVM or LocalOutlierFactor) on HEALTHY DATA ONLY
5. Optional hyperparameter tuning using validation data (semi-supervised)
6. Save model, scaler, and PCA transformer
**Training Mode:**
- UNSUPERVISED: Train only on healthy data with automatic hyperparameters
- SEMI-SUPERVISED: Train on healthy data, tune hyperparameters using validation set (healthy + fault)
**Note:** This is NOT supervised learning. OneClassSVM/LOF are trained ONLY on healthy data.
Fault data (if provided) is used ONLY for hyperparameter tuning after training.
**Validation Strategy:**
- If healthy_validation_files provided: Use those explicitly (no split)
- If healthy_validation_files NOT provided: Automatic 80/20 split of training data
- If fault_signal_files provided: Enable semi-supervised mode (hyperparameter tuning)
Args:
healthy_signal_files: List of CSV files with healthy machine data (for training)
sampling_rate: Sampling frequency in Hz (auto-detect from metadata if None)
segment_duration: Segment duration in seconds (default: 0.1)
overlap_ratio: Overlap ratio 0-1 (default: 0.5)
model_type: 'OneClassSVM' or 'LocalOutlierFactor' (default: 'OneClassSVM')
pca_variance: Cumulative variance to explain with PCA (default: 0.95)
fault_signal_files: Optional list of fault signals for HYPERPARAMETER TUNING (semi-supervised)
healthy_validation_files: Optional list of healthy signals for validation (specificity check).
If not provided, 20% of training data will be used.
model_name: Name for saved model files (default: 'anomaly_model')
ctx: MCP context for progress/logging
Returns:
AnomalyModelResult with model paths and performance metrics
|
| predict_anomaliesA | Predict anomalies in new signal using trained model.
Applies the complete pipeline:
1. Segment signal
2. Extract features
3. Apply scaler (from training)
4. Apply PCA (from training)
5. Predict with trained model
6. Calculate anomaly ratio and overall health
Args:
signal_file: Name of CSV file to analyze
model_name: Name of trained model (default: 'anomaly_model')
ctx: MCP context for progress/logging
Returns:
AnomalyPredictionResult with predictions and health assessment
|
| list_machine_manualsA | List all available machine manuals in resources/machine_manuals/.
Returns list of PDFs and text files with filename, size, and modification date.
Use this to see what manuals are available before extracting specs.
**IMPORTANT - LLM Usage Guidelines:**
- This tool returns ONLY the list of available files
- DO NOT make assumptions about manual content without reading it
- DO NOT infer specifications without using extract_manual_specs() or read_manual_excerpt()
- ALWAYS use the returned filenames exactly as-is when calling other tools
- If user asks about manual content, use read_manual_excerpt() or extract_manual_specs()
Returns:
List of dictionaries with manual information
Example:
>>> manuals = list_machine_manuals()
>>> print(f"Found {len(manuals)} manuals")
>>> for m in manuals:
... print(f"- {m['filename']}: {m['size_mb']:.2f} MB")
|
| extract_manual_specsA | Extract machine specifications from equipment manual PDF.
Automatically extracts:
- Bearing designations (e.g., SKF 6205, FAG NU2205)
- Operating speeds (RPM values)
- Power ratings (kW, HP, MW)
- Text excerpt for LLM context
Results are cached for fast repeated access.
**IMPORTANT - LLM Usage Guidelines:**
- This tool returns ONLY data extracted from the manual text
- DO NOT add information not present in the extraction results
- DO NOT make assumptions about missing specifications
- If a specification is not in the results, tell the user it was not found
- ALWAYS base your response exclusively on the returned dictionary
- If user needs more detail, suggest using read_manual_excerpt() to read full text
- DO NOT invent bearing geometries, frequencies, or other technical data
**WORKFLOW for missing bearing geometry:**
1. Check if bearing geometry is in extraction results (rare in manuals)
2. If not found, use search_bearing_catalog(bearing_designation) tool
3. If bearing not in catalog, ask user to provide:
- All geometric parameters (num_balls, ball_diameter_mm, pitch_diameter_mm, contact_angle_deg)
- OR upload manufacturer catalog to bearing_catalogs/ directory
Args:
manual_filename: PDF filename in resources/machine_manuals/
use_cache: Use cached extraction if available (default: True)
ctx: MCP context
Returns:
Dictionary with extracted specifications and text excerpt
Example:
>>> specs = extract_manual_specs("pump_XYZ_manual.pdf")
>>> print(f"Bearings: {specs['bearings']}")
>>> print(f"RPM: {specs['rpm_values']}")
>>> print(f"Power: {specs['power_ratings']}")
|
| calculate_bearing_characteristic_frequenciesA | Calculate bearing characteristic frequencies from geometry.
Uses formulas from ISO 15243:2017 and SKF bearing handbook.
Essential for bearing fault diagnosis when you know bearing geometry
but don't have pre-calculated frequencies.
**IMPORTANT - LLM Usage Guidelines:**
- This tool REQUIRES exact bearing geometry parameters
- DO NOT guess or estimate bearing geometry if not provided
- DO NOT use "typical" or "standard" values without user confirmation
- If geometry is unknown, tell user to:
1. Check manual using read_manual_excerpt()
2. Look up bearing in manufacturer catalog (e.g., SKF, FAG, NSK)
3. Use lookup_bearing_in_catalog() if bearing designation is known
4. Measure the bearing physically if necessary
- ONLY calculate with geometry explicitly provided by user or found in manual
- DO NOT make assumptions about contact angle (use 0 deg if unknown and inform user)
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: Contact angle (alpha) in degrees (0 deg for deep groove ball bearings)
shaft_speed_rpm: Shaft rotation speed in RPM
ctx: MCP context
Returns:
Dictionary with BPFO, BPFI, BSF, FTF in Hz
Example:
>>> # For SKF 6205 bearing at 1797 RPM
>>> freqs = calculate_bearing_characteristic_frequencies(
... num_balls=9,
... ball_diameter_mm=7.94,
... pitch_diameter_mm=34.55,
... contact_angle_deg=0.0,
... shaft_speed_rpm=1797
... )
>>> print(f"BPFO: {freqs['BPFO']:.2f} Hz")
BPFO: 81.13 Hz
Common bearing geometries:
- Deep groove ball bearings: contact_angle = 0 deg
- Angular contact bearings: contact_angle = 15-40 deg
- Cylindrical roller bearings: contact_angle = 0 deg
|
| read_manual_excerptA | Read text excerpt from machine manual (PDF or TXT).
Useful for providing context to LLM for questions about
specific machine parameters, maintenance procedures, etc.
**Token Warning**: Reading many pages can consume significant tokens.
Start with max_pages=10 and increase if needed.
**IMPORTANT - LLM Usage Guidelines:**
- This tool returns ONLY the text extracted from the manual
- Base your answers EXCLUSIVELY on the returned text
- DO NOT add information not present in the extracted text
- If information is not found in the text, clearly state "Not found in manual"
- DO NOT make assumptions or fill gaps with general knowledge
- If user needs more pages, suggest increasing max_pages parameter
- ALWAYS cite the manual when answering: "According to the manual..."
Args:
manual_filename: Manual filename in resources/machine_manuals/ (PDF or TXT)
max_pages: Maximum number of pages to extract (default: 10, ignored for TXT files)
ctx: MCP context
Returns:
Extracted text from manual
Example:
>>> text = read_manual_excerpt("pump_manual.pdf", max_pages=5)
>>> # LLM can now answer: "What bearings are recommended for this pump?"
|
| search_bearing_catalogA | Search for bearing specifications in local bearing catalogs.
This is a FALLBACK tool. LLM should use this ONLY when:
1. Bearing designation found in machine manual
2. Bearing geometry NOT found in machine manual
3. Need geometry to calculate characteristic frequencies
**IMPORTANT - LLM Usage Guidelines:**
- Use this tool ONLY after checking machine manual first
- DO NOT use this as primary source - manual takes precedence
- If bearing not found here, ask user for specifications
- DO NOT guess or estimate if bearing not in catalog
- This catalog contains ~20 common ISO bearings (6200-6210, 6300-6310 series)
- For uncommon bearings, tell user: "Bearing {X} not in catalog. Please provide geometry or upload manufacturer catalog to bearing_catalogs/"
Search order:
1. JSON catalog (common_bearings_catalog.json) - 20 common bearings
2. In-memory fallback (legacy 6205, 6206)
3. Returns None if not found
Args:
bearing_designation: Bearing designation (e.g., "6205", "SKF 6205-2RS", "FAG 6206")
ctx: MCP context
Returns:
Dictionary with bearing specifications if found, None otherwise
Example:
>>> specs = search_bearing_catalog("SKF 6205-2RS")
>>> print(f"Balls: {specs['num_balls']}, Diameter: {specs['ball_diameter_mm']} mm")
Balls: 9, Diameter: 7.94 mm
|
| search_documentationA | 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
(e.g. "bearing 6205 geometry", "maintenance interval pump")
top_k: Number of passages to return (default: 5)
force_reindex: Rebuild the index even if cache is fresh (default: False)
ctx: MCP context
Returns:
Dictionary with ranked results, each containing text passage, source
file, relevance score, and chunk index.
|
| check_bearing_fault_peak_toolB | Check for a specific bearing fault frequency in a stored signal. Args:
signal_id: ID of the stored signal.
bearing_id: Bearing designation (e.g. '6205').
fault_type: Which fault to check: 'BPFO', 'BPFI', 'BSF', or 'FTF'.
rpm: Shaft speed in RPM.
tolerance_pct: Frequency matching tolerance (default 5%).
|
| check_bearing_faults_directA | Run all bearing fault checks (BPFO, BPFI, BSF, FTF) on a stored signal. Args:
signal_id: ID of the stored signal.
bearing_id: Bearing designation (e.g. '6205').
rpm: Shaft speed in RPM.
tolerance_pct: Frequency matching tolerance (default 5%).
|
| lookup_bearing_and_compute_toolA | Look up bearing, compute fault frequencies, and check signal -- all in one call. End-to-end bearing analysis: catalog lookup + frequency calculation +
envelope spectrum fault detection.
Args:
bearing_type: Bearing designation (e.g. 'SKF 6205-2RS', '6205').
rpm: Shaft speed in RPM.
signal_id: ID of the stored signal.
tolerance_pct: Frequency matching tolerance (default 5%).
|
| assess_vibration_severityA | Assess vibration severity per ISO 10816/20816 for a stored signal. Uses the signal_id pattern (load once, reference by ID).
Signal unit is read from metadata; defaults to 'g' if unknown.
Args:
signal_id: ID of the stored signal.
machine_class: 'I' (small <15kW), 'II' (medium 15-300kW),
'III' (large rigid >300kW), 'IV' (large flexible).
axis: Measurement axis (informational).
|
| diagnose_vibration_toolB | 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.
Args:
signal_id: ID of the stored signal.
rpm: Machine operating speed in RPM.
bearing_id: Bearing designation for fault detection (optional).
machine_class: ISO machine class (default 'II').
|
| generate_diagnostic_report_docxA | Generate a structured Word (.docx) diagnostic report.
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 (from evaluate_iso_20816 output)
- diagnosis: str (free-text diagnostic summary)
Args:
signal_file: Signal filename used for the report title / filename
sections: Content sections to include (see above)
title: Optional custom report title
ctx: MCP context
Returns:
Dictionary with file_path, file_name, and per-section summary.
|
| plot_signalA | Generate interactive time-domain signal plot.
Creates an interactive HTML plot showing the signal in the time domain.
Useful for inspecting signal quality, identifying anomalies, and visualizing transients.
Args:
signal_file: Name of the CSV file in data/signals/
sampling_rate: Sampling frequency in Hz (default: 10000)
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)
title: Custom plot title (optional)
ctx: MCP context for progress/logging
Returns:
Path to generated HTML file
Example:
plot_signal(
"bearing_signal.csv",
sampling_rate=10000,
time_range=[0.1, 0.3], # Zoom on 100-300 ms
show_statistics=True
)
|
| plot_spectrumA | Generate interactive FFT spectrum plot with automatic peak detection.
Creates an interactive HTML plot showing the frequency spectrum up to Nyquist frequency (Fs/2).
Automatically identifies and labels the most significant peaks. If rotation frequency is provided,
identifies harmonics as 1x, 2x, 3x RPM.
Args:
signal_file: Name of the CSV file in data/signals/
sampling_rate: Sampling frequency in Hz (default: 10000)
freq_range: [min_freq, max_freq] to limit the plot range (default: [0, Fs/2])
num_peaks: Number of peaks to identify and label (default: 10)
min_peak_distance: Minimum distance between peaks in Hz (default: 1.0)
rotation_freq: Rotation frequency in Hz for RPM harmonic labeling (optional)
title: Custom plot title (optional)
ctx: MCP context for progress/logging
Returns:
Path to generated HTML file with peak information
Example:
plot_spectrum(
"bearing_signal.csv",
sampling_rate=10000,
rotation_freq=25.0, # 1500 RPM = 25 Hz
num_peaks=15
)
|
| plot_envelopeA | Generate interactive envelope spectrum plot.
Creates an interactive HTML plot showing both the envelope spectrum and optionally
the filtered signal. Can highlight bearing/gear frequencies.
Args:
signal_file: Name of the CSV file in data/signals/
sampling_rate: Sampling frequency in Hz (default: 10000)
filter_band: [low_freq, high_freq] for bandpass filter (optional, default: [500, 5000])
freq_range: [min_freq, max_freq] to limit the envelope spectrum plot (optional)
highlight_freqs: List of frequencies (Hz) to mark (e.g., BPFO, BPFI) (optional)
freq_labels: Labels for highlighted frequencies (optional)
title: Custom plot title (optional)
ctx: MCP context for progress/logging
Returns:
Path to generated HTML file
Example:
plot_envelope(
"bearing_signal.csv",
sampling_rate=10000,
filter_band=[500, 5000],
freq_range=[0, 300],
highlight_freqs=[120.5, 241.0],
freq_labels=["BPFO", "2xBPFO"]
)
|
| generate_fft_reportA | Generate professional FFT spectrum report as HTML file.
**NEW PREFERRED METHOD**: Generates a professional HTML report file
instead of inline content. Saves to reports/ directory.
Args:
signal_file: Signal filename in data/signals/
sampling_rate: Sampling rate in Hz (auto-detect if None)
max_freq: Maximum frequency to display (Hz). Default 5000 Hz
num_peaks: Number of peaks to detect and label. Default 15
rotation_freq: Optional shaft rotation frequency for harmonic labels
ctx: MCP context
Returns:
Dictionary with file path, metadata, and summary (NO HTML content)
Example:
>>> result = generate_fft_report("real_train/baseline_1.csv")
>>> # User can open: result['file_path']
|
| generate_envelope_reportA | Generate professional envelope analysis report as HTML file.
**NEW PREFERRED METHOD**: Generates a professional HTML report file
instead of inline content. Saves to reports/ directory.
Args:
signal_file: Signal filename in data/signals/
sampling_rate: Sampling rate in Hz (auto-detect if None)
filter_low: Bandpass filter low cutoff (Hz). Default 500 Hz
filter_high: Bandpass filter high cutoff (Hz). Default 5000 Hz
max_freq: Max envelope spectrum frequency to display. Default 500 Hz
num_peaks: Number of peaks to detect. Default 15
bearing_freqs: Optional dict with BPFO, BPFI, BSF, FTF
ctx: MCP context
Returns:
Dictionary with file path, metadata, and summary (NO HTML content)
Example:
>>> result = generate_envelope_report(
... "real_train/OuterRaceFault_1.csv",
... bearing_freqs={"BPFO": 81.13, "BPFI": 118.88, "BSF": 63.91, "FTF": 14.84}
... )
|
| generate_iso_reportA | Generate professional ISO 20816-3 evaluation report as HTML file.
**NEW PREFERRED METHOD**: Generates a professional HTML report file
instead of inline content. Saves to reports/ directory.
Args:
signal_file: Signal filename in data/signals/
sampling_rate: Sampling rate in Hz (auto-detect if None)
machine_group: ISO machine group (1=large >300kW, 2=medium 15-300kW)
support_type: 'rigid' or 'flexible'
operating_speed_rpm: Operating speed in RPM (optional)
ctx: MCP context
Returns:
Dictionary with file path, metadata, and summary (NO HTML content)
Example:
>>> result = generate_iso_report(
... "real_train/baseline_1.csv",
... machine_group=2,
... support_type="rigid"
... )
|
| list_html_reportsA | List all available HTML reports in reports/ directory.
Returns list of reports with metadata (file name, type, signal, size).
Does NOT return HTML content - only metadata to avoid token consumption.
Returns:
List of dicts with report information
Example:
>>> reports = list_html_reports()
>>> print(f"Found {len(reports)} reports")
>>> for r in reports:
... print(f"- {r['file_name']}: {r['report_type']} for {r['signal_file']}")
|
| get_report_infoA | Get metadata from HTML report without loading entire file.
Extracts metadata JSON from HTML report file. This allows LLM to
understand report content without consuming tokens for HTML.
Args:
file_name: Report filename in reports/ directory
Returns:
Dictionary with metadata (NO HTML content)
Example:
>>> info = get_report_info("fft_spectrum_baseline_1.html")
>>> print(f"Signal: {info['metadata']['signal_file']}")
>>> print(f"Peaks detected: {info['metadata']['num_peaks']}")
|
| generate_pca_visualization_reportA | Generate PCA visualization HTML report showing training and test data in 2D PCA space.
Creates interactive scatter plot with:
- Training data (blue dots) - healthy baseline
- 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.
**Strategy**: Same HTML report approach as FFT/Envelope/ISO reports.
Saved to reports/ directory for LLM to reference without consuming tokens.
Args:
model_name: Name of trained model (e.g., 'bearing_health_model')
test_signal_files: Optional list of signals to predict and visualize
true_labels: Optional dict mapping signal filenames to true labels.
Format: {"baseline_3.csv": "healthy", "InnerRaceFault_vload_6.csv": "faulty"}
When provided, legend shows both true and predicted labels for validation.
sampling_rate: Sampling rate (auto-detect from metadata if None)
segment_duration: Segment duration in seconds (default: 0.1s for ML)
overlap_ratio: Overlap ratio 0-1 (default: 0.5)
ctx: MCP context
Returns:
Dictionary with file path, metadata, and summary (includes validation metrics if true_labels provided)
Example (predictions only):
>>> generate_pca_visualization_report(
... model_name="bearing_health_model",
... test_signal_files=["real_test/baseline_3.csv", "real_test/InnerRaceFault_vload_6.csv"]
... )
Example (with validation):
>>> generate_pca_visualization_report(
... model_name="bearing_health_model",
... test_signal_files=["real_test/baseline_3.csv", "real_test/InnerRaceFault_vload_6.csv"],
... true_labels={"baseline_3.csv": "healthy", "InnerRaceFault_vload_6.csv": "faulty"}
... )
|
| generate_feature_comparison_reportA | 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).
**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 list of signal files.
Example: {"Healthy": ["baseline_1.csv", "baseline_2.csv"],
"Faulty": ["InnerRaceFault_1.csv", "OuterRaceFault_1.csv"]}
sampling_rate: Sampling rate (auto-detect from metadata if None)
segment_duration: Segment duration in seconds (default: 0.1s for ML)
overlap_ratio: Overlap ratio 0-1 (default: 0.5)
features_to_plot: List of feature names to plot (default: all 17 features)
ctx: MCP context
Returns:
Dictionary with file path, metadata, and summary
Example:
>>> generate_feature_comparison_report(
... signal_groups={
... "Healthy": ["real_train/baseline_1.csv", "real_train/baseline_2.csv"],
... "Inner Fault": ["real_train/InnerRaceFault_vload_1.csv"],
... "Outer Fault": ["real_train/OuterRaceFault_1.csv"]
... }
... )
|
| estimate_rulA | Estimate Remaining Useful Life from a degradation signal. Segments the signal, extracts a feature series (e.g. RMS over time),
and fits a degradation curve to estimate when *failure_threshold*
will be reached.
Args:
ctx: MCP context for user communication.
signal_file: CSV signal file in the data directory.
failure_threshold: Feature value at which the component is
considered failed.
method: Estimation method — "linear", "exponential", "weibull",
or "kalman" (default: "linear").
feature_name: Time-domain feature to track (default: "rms").
sampling_interval: Time between successive segments in the
units you want the RUL expressed in (default: 1.0).
sampling_rate: Signal sampling rate in Hz (auto-detect if None).
segment_duration: Duration of each segment in seconds.
overlap_ratio: Overlap between segments (0-1).
Returns:
RULEstimationResult with estimated RUL and confidence.
|
| analyze_signal_trendA | Analyze the trend of a feature extracted from a signal over time. Segments the signal, extracts the requested feature per segment,
and fits a linear trend to detect increasing/decreasing behavior.
Args:
ctx: MCP context for user communication.
signal_file: CSV signal file in the data directory.
feature_name: Time-domain feature to analyze (default: "rms").
sampling_rate: Signal sampling rate in Hz (auto-detect if None).
segment_duration: Duration of each segment in seconds.
overlap_ratio: Overlap between segments (0-1).
Returns:
TrendAnalysisResult with slope, direction, and fit quality.
|
| detect_signal_degradation_onsetA | Detect whether and where a signal begins to degrade. Extracts a feature series from the signal and applies change detection
to identify the first segment where the feature exceeds baseline
statistics by *threshold_sigma* standard deviations.
Args:
ctx: MCP context for user communication.
signal_file: CSV signal file in the data directory.
feature_name: Time-domain feature to monitor (default: "rms").
threshold_sigma: Number of baseline standard deviations to trigger
degradation onset (default: 3.0).
sampling_rate: Signal sampling rate in Hz (auto-detect if None).
segment_duration: Duration of each segment in seconds.
overlap_ratio: Overlap between segments (0-1).
Returns:
DegradationOnsetResult with onset detection outcome.
|
| check_vibration_alertA | Check an RMS velocity value against ISO 10816 alert thresholds. Classifies the reading into ISO zones (A/B/C/D) and returns the
corresponding alert level (none, warning, alarm, danger).
Args:
ctx: MCP context for user communication.
rms_velocity: RMS velocity in mm/s.
machine_group: ISO 10816 machine group (1 or 2, default: 2).
support_type: Support type — "rigid" or "flexible" (default: "rigid").
Returns:
AlertResult with zone classification and alert level.
|
| check_custom_vibration_alertA | Check an RMS velocity value against user-defined thresholds. Allows custom alert boundaries instead of ISO 10816 defaults.
Args:
ctx: MCP context for user communication.
rms_velocity: RMS velocity in mm/s.
warning_threshold: Upper boundary of normal zone (mm/s).
alarm_threshold: Upper boundary of warning zone (mm/s).
danger_threshold: Upper boundary of alarm zone (mm/s).
Returns:
AlertResult with zone classification and alert level.
|
| generate_maintenance_recommendationsA | Generate maintenance recommendations based on severity and detected faults. Combines ISO zone-based urgency with fault-specific maintenance actions.
Args:
ctx: MCP context for user communication.
severity_zone: ISO zone letter — "A", "B", "C", or "D".
fault_types: Comma-separated fault type keywords, e.g.
"outer_race,misalignment". Leave empty for zone-only advice.
confidence: Diagnostic confidence (0-1, default: 0.0).
Returns:
Formatted string listing all maintenance recommendations.
|