Skip to main content
Glama
LGDiMaggio

Predictive Maintenance MCP Server

by LGDiMaggio

generate_pca_visualization_report

Generate an interactive 2D PCA scatter plot report to visualize model predictions on test signals, distinguishing predicted healthy and anomaly segments. Optionally add true labels to validate model accuracy.

Instructions

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.

Args:
    model_name: Name of trained model (e.g., 'bearing_health_model')
    test_signal_ids: Optional list of stored signal IDs to predict and visualize
    true_labels: Optional dict mapping signal_ids to true labels.
                Format: {"real_test_baseline_3": "healthy",
                         "real_test_InnerRaceFault_vload_6": "faulty"}
                When provided, legend shows both true and predicted labels for validation.
    segment_duration: Segment duration in seconds (default: 0.1s for ML)
    overlap_ratio: Overlap ratio 0-1 (default: 0.5)
    ctx: MCP context. Unused — see this module's docstring on logging.

Returns:
    Dictionary with file path, metadata, and summary (includes validation metrics if true_labels provided)

Raises:
    FileNotFoundError: If the model does not exist.
    ValueError: If a signal_id is not loaded or has no sampling rate.

Example (with validation):
    >>> generate_pca_visualization_report(
    ...     model_name="bearing_health_model",
    ...     test_signal_ids=["real_test_baseline_3", "real_test_InnerRaceFault_vload_6"],
    ...     true_labels={"real_test_baseline_3": "healthy",
    ...                  "real_test_InnerRaceFault_vload_6": "faulty"}
    ... )

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
model_nameYes
true_labelsNo
overlap_ratioNo
test_signal_idsNo
segment_durationNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior4/5

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

With no annotations provided, the description carries the full burden of disclosure. It honestly warns that labels are model predictions, not ground truth, and explains the need for `true_labels`. It also lists error conditions (FileNotFoundError, ValueError) and prerequisites. It only omits explicit details about where the HTML file is saved, but this is a minor gap given the return value mentions a file path.

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

Conciseness4/5

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

The description is well-structured with clear sections (overview, important note, args, returns, raises, example) and is front-loaded with the core purpose. Every sentence provides necessary information, though it is slightly longer than strictly needed. The example is valuable but adds length.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description covers all essential aspects for using this tool correctly: purpose, prerequisites, parameter meanings, return value, error cases, and a concrete example. Since an output schema is available (per context), the return description is a bonus. The only minor omission is the exact file output location, which is not critical for invocation.

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?

The input schema has 0% description coverage, but the description's Args section provides thorough semantics for every parameter: model_name includes an example, test_signal_ids explains optionality, true_labels includes format and example mapping, segment_duration gives unit and default, overlap_ratio gives range and default. This fully compensates for the schema's lack of descriptions.

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 specific action ('Generate PCA visualization HTML report') and resource ('test data in 2D PCA space'), distinguishing it from sibling report tools like FFT/envelope/ISO reports. The mention of 'interactive scatter plot' and prediction labels makes its unique purpose explicit.

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 gives clear context for when to use the tool, including the prerequisite that test signals must be loaded via load_signal() first. It also explains when to use the `true_labels` parameter for validation. However, it does not explicitly contrast this tool with alternative report tools or state when not to use it, so it misses exclusions.

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