The N3uron MCP Server exposes two categories of tools to AI agents: built-in tools and custom tools. Built-in tools are provided by the module itself and allow the AI agent to access general N3uron capabilities such as browsing the tag model, reading real-time values, querying historian data, reading alarms, and checking system information.
Custom tools extend this foundation with domain-specific logic. In the AI-Ready PV Demo Project, custom tools are implemented as JavaScript scripts executed by the Scripting module and exposed through the MCP Server as callable MCP tools.
The demo includes 10 custom tools: 8 operational tools under Operations and 2 diagnostic tools under System. These tools package common photovoltaic O&M analyses into reusable functions that return structured JSON results the AI model can interpret, summarize, and explain.
Important:
The current custom tool interface does not rely on hidden plant-specific defaults. Values such as the plant root path, KPI group, weather group, tag names, discovery patterns, thresholds, and analysis windows must be provided by the caller, by the custom prompt, or through the optional pv_model_json argument.
Built-in tools vs. Custom tools
Custom tools are application-specific. They allow developers to expose higher-level operations that combine several platform queries, calculations, and business rules into a single AI-callable function.
In the AI-Ready PV Demo, each custom tool receives validated inputs from the MCP Server, executes a linked Scripting script, uses the N3uron Scripting API to read data, and returns a structured result to the AI agent.
Aspect | Built-in tools | Custom tools |
|---|---|---|
Purpose | General access to platform data and configuration. | Domain-specific analytics and workflows. |
Execution | Executed directly by the MCP Server. | Delegated to a linked Scripting script. |
Output | Raw or direct platform query result. | Structured analytics envelope with summary, findings, items, warnings, and metadata. |
Custom tool configuration
In the MCP Server module, custom tools are set up under Tools, with each definition specifying the MCP interface tool and the scripting script that runs when the tool is triggered.
The Script instance field points to the Scripting module instance, and the Script name field points to the script path inside the Scripting action structure.
.png)
Field | Description |
|---|---|
Enabled | Controls whether the custom tool is exposed by the MCP Server. |
Name | Stable MCP identifier, such as ops_summary_daily or system_tags_detect_anomalies. This is the name the AI agent uses when invoking the tool. |
Title | Human-readable label shown to MCP clients, for example Daily Plant Summary or Scan Fleet Performance. |
Description | Explains what the tool does and gives the AI model useful context about the expected input strategy. |
Script instance | The Scripting module instance used to execute the script. In this demo, the instance name is Scripting. |
Script name | Full script path inside Scripting, such as McpCustomTools/Operations/ops_summary_daily. |
Tip:
Tool and input descriptions are part of the MCP metadata exposed to the AI agent. Clear descriptions improve tool selection and help the model supply the correct arguments.
Scripting structure
The custom tools are implemented in the Scripting module under the McpCustomTools action group. The action structure is divided into two subgroups that match the tool groups exposed by the MCP Server: Operations and System.
McpCustomTools/Operations: contains the 8 operational O&M scripts.
McpCustomTools/System: contains the 2 system diagnostic scripts.
Each script has a worker inactivity timeout configured as 10000 ms. The scripts are intentionally small and delegate the actual analytics to the shared McpToolsLib library.
.png)
Scripting library: McpToolsLib
The custom tools share a static library named McpToolsLib, configured under Scripting → Libraries. This library contains the reusable logic used by all custom tools.
The library centralizes request parsing, input validation, time-window resolution, historian queries, real-time tag reads, alarm history analysis, tag metadata inspection, PV model mapping, topology discovery, fleet performance calculation, yield comparison, trend detection, downtime detection, maintenance recommendation logic, and standardized response formatting.
This design keeps the individual scripts short. Fixes and improvements to the analytics logic are made once in McpToolsLib and are then reused by all linked custom tools.
.png)
Script wrapper pattern
Each custom tool script follows the same wrapper pattern: load McpToolsLib, call the matching library runner function, pass $.event and $.api, and return the result.
'use strict';
var lib = null;
try {
lib = $.lib('McpToolsLib');
return await lib.runOpsSummaryDaily($.event, $.api);
} catch (err) {
if (lib && typeof lib.fail === 'function') {
return lib.fail('ops_summary_daily', err, $.event || {}, null);
}
throw err;
}Input strategy
The current tool interface is designed to be portable across different PV tag models. Instead of assuming one fixed plant structure, the tools accept explicit model context through arguments.
The caller can pass direct tag paths, group names and leaf tag names, explicit asset roots, discovery patterns, or a full model mapping through pv_model_json. This allows the same custom tools to work with different naming conventions and customer tag hierarchies.
Strategy | Description |
|---|---|
Direct tag paths | Provide absolute paths such as active_power_total_path, irradiance_path, active_energy_path, expected_energy_path, asset_energy_paths_csv, or tag_paths_csv. |
Group plus leaf tag names | Provide group names and leaf tag names, such as plant_kpi_group plus performance_ratio_tag, or weather_group plus poa_irradiance_tag. |
Explicit asset roots | Use asset_paths_csv to pass station or inverter root paths. The library can then combine those roots with leaf tag names such as active_energy_tag or active_power_tag. |
Discovery patterns | Use station_group_regex and inverter_group_regex when the tool should discover stations and inverters by browsing the tag model. |
pv_model_json | Pass a JSON object with customer-specific mappings. Values in pv_model_json can be combined with direct tool inputs. |
Time-window strategy
Tools that query historical data support rolling and fixed time windows. Rolling windows use lookback_days. Fixed windows use period_start_utc and period_end_utc.
Input | Description |
|---|---|
lookback_days | Rolling historical window in days. Used when a fixed period is not provided. |
period_start_utc | Fixed-period start in ISO 8601 UTC format. Must be provided together with period_end_utc. |
period_end_utc | Fixed-period end in ISO 8601 UTC format. Must be provided together with period_start_utc. |
Tip:
The tools produce better results when the tag model includes clear tag names, descriptions, engineering units, history settings, and a consistent asset hierarchy. This metadata helps the AI agent discover the correct paths before invoking the custom tools.
pv_model_json example
The pv_model_json argument is useful when a custom prompt or client wants to provide all plant-specific mappings in one structured field.
{
"plant_kpi_group": "KPI_VG",
"weather_group": "WST",
"station_group_regex": "^PST_\\d+$",
"inverter_group_regex": "^INV\\d+$",
"active_power_tag": "ACTIVE_POWER",
"active_energy_tag": "ACTIVE_ENERGY",
"performance_ratio_tag": "PERFORMANCE_RATIO",
"poa_irradiance_tag": "POA_IRRADIANCE"
}Available custom tools
The following custom tools are included in the AI-Ready PV Demo.
Tool | Group | Purpose |
|---|---|---|
ops_summary_daily | Operations | Generates a plant status summary from explicitly mapped KPI, irradiance, forecast, and alarm paths. |
ops_alarm_analyze_patterns | Operations | Groups repeated alarms, alarm bursts, and recurring fault patterns for a plant, site, or alarm subtree. |
ops_downtime_summarize | Operations | Identifies periods when assets stopped producing during daylight — offline, zero power, outage, went down. Uses irradiance to distinguish weather-driven vs equipment-driven downtime. |
ops_performance_scan_fleet | Operations | Ranks underperforming assets using direct energy paths, explicit asset roots, or discovered topology. |
ops_performance_score_assets | Operations | Scores asset health from performance, trend, and alarm burden. |
ops_performance_trend_assets | Operations | Detects degrading asset trends from direct energy metric paths, explicit asset roots, or discovered topology. |
ops_performance_compare_yield | Operations | Compares actual and expected energy yield using either expected_energy_path or a PR and irradiance model. |
ops_maintenance_recommend | Operations | Returns prioritized maintenance actions from recurring alarms and performance issues. |
system_audit_node | System | Audits node health and important tag quality for the provided path. |
system_tags_detect_anomalies | System | Compares recent tag behavior against a historical baseline for an explicit tag list. |
Tool input summary
The following table summarizes the main required inputs and the additional mapping inputs typically used by each custom tool.
Tool | Main required inputs | Additional model context |
|---|---|---|
ops_summary_daily | path, include_forecast | KPI paths, weather paths, forecast paths, KPI group, weather group, or pv_model_json. |
ops_alarm_analyze_patterns | path, min_priority, cluster_window_minutes | lookback_days or fixed period, alarm subtree context, or pv_model_json. |
ops_downtime_summarize | path, granularity, irradiance_threshold, zero_power_threshold_kw | Power paths, irradiance path, asset roots, station and inverter regex, or pv_model_json. |
ops_performance_scan_fleet | path, threshold_pct | Energy paths, power paths, asset roots, PR context, station and inverter regex, time window, or pv_model_json. |
ops_performance_score_assets | path, granularity, threshold_pct, trend_threshold_pct_per_week, min_priority, cluster_window_minutes | Metric paths, asset roots, KPI context, discovery regex, time window, or pv_model_json. |
ops_performance_trend_assets | path, granularity, trend_threshold_pct_per_week | Energy paths, metric paths, asset roots, discovery regex, time window, or pv_model_json. Minimum recommended rolling window: 7 days. |
ops_performance_compare_yield | path, pr_baseline_pct | Actual energy path, expected energy path, irradiance path, nominal power value or path, KPI group, weather group, time window, or pv_model_json. |
ops_maintenance_recommend | path, threshold_pct, min_priority, cluster_window_minutes | Energy paths, power paths, asset roots, PR context, discovery regex, time window, or pv_model_json. |
system_audit_node | path, max_backup_age_hours | Optional important_tag_regex to focus the audit on specific tag categories. |
system_tags_detect_anomalies | tag_paths_csv, baseline_days, recent_days, sigma_threshold | Optional min_value to exclude low values from the statistical window. |
Output schema
All custom tools return a consistent JSON envelope. This makes it easier for the AI model to reason over results from different tools using the same response structure.
Field | Type | Description |
|---|---|---|
success | Boolean | true when the tool completed without a fatal validation or execution error. |
error | String | Error message returned when success is false. |
meta | Object | Execution metadata, including tool name, generated timestamp, contract version, request echo, and resolved time window. |
summary | Object | Short statement of the capability represented by the tool and the shared modules used to produce the result. |
findings | Array | Ordered list of issues, insights, or recommendations detected by the tool. |
items | Array | Structured data payload, such as ranked assets, summary metrics, alarm clusters, downtime rows, or anomaly rows. |
warnings | Array | Non-fatal data gaps, caveats, or low-confidence conditions. |
The $.event parameter
When the MCP Server invokes a Scripting script on behalf of a custom tool call, it passes the tool arguments through the $.event object.
For example, a tool call that includes path, lookback_days, and threshold_pct makes those values available inside the script as $.event.path, $.event.lookback_days, and $.event.threshold_pct.
Inside McpToolsLib, request parsing is handled centrally. The library reads values from $.event, validates the required fields, applies numeric bounds, parses pv_model_json when provided, resolves paths, and builds a normalized request echo for the response metadata.
Tool-to-script mapping
Each MCP custom tool maps to one Scripting script, and each script calls one runner function from McpToolsLib.
Script path | Library runner function |
|---|---|
Operations/ops_summary_daily | runOpsSummaryDaily |
Operations/ops_alarm_analyze_patterns | runOpsAlarmAnalyzePatterns |
Operations/ops_downtime_summarize | runOpsDowntimeSummarize |
Operations/ops_performance_scan_fleet | runOpsPerformanceScanFleet |
Operations/ops_performance_score_assets | runOpsPerformanceScoreAssets |
Operations/ops_performance_trend_assets | runOpsPerformanceTrendAssets |
Operations/ops_performance_compare_yield | runOpsPerformanceCompareYield |
Operations/ops_maintenance_recommend | runOpsMaintenanceRecommend |
System/system_audit_node | runSystemAuditNode |
System/system_tags_detect_anomalies | runSystemTagsDetectAnomalies |
Usage recommendations
Start with context: Use ops_summary_daily to establish the current plant state before running deeper analysis.
Provide explicit mappings: Pass direct paths, group names, tag names, regex patterns, or pv_model_json so the tools can resolve the correct tags reliably.
Use fixed periods for incident reviews: Provide period_start_utc and period_end_utc when investigating a specific event window.
Use rolling windows for routine checks: Use lookback_days for daily, weekly, or monthly checks relative to the current time.
Keep tools read-only: The demo custom tools query and analyze data. They do not write tags or modify the node state.
For AI-Ready PV Demo Project, use /PVSIM/BLUELAKE/PVG001 as the plant root path when testing the tools. This path is supplied as an input and is not assumed automatically by the scripts.
Tips:
Use controlled data and metadata changes to validate how the AI agent behaves. For example:
Delete the description from one important tag and run a tag audit.
Delete the engineering unit from a power, energy, or irradiance tag and check whether the audit reports it.
Disable history on one relevant tag and verify that the audit identifies the missing historian configuration.
Backfill historical data with normal production values and confirm that no false underperformance is reported.
Backfill historical data with two inverters or stations clearly underperforming and verify that the agent ranks it correctly.
Create a daylight zero-power period while irradiance remains high and test whether downtime is detected.
Add low irradiance periods with low production and confirm that the agent does not report them as abnormal downtime.
Create repeated alarms for the same asset and check whether alarm pattern analysis groups them correctly.
Test the same prompt with different plant paths or site roots to confirm that the tool input schema works across different PV tag models.
Run the same question with minimal and explicit prompts to compare how much the provided context improves tool selection, parameter resolution, and final answer quality.
Add supporting knowledge sources to your AI agent, such as manufacturer datasheets, internal procedures, maintenance manuals, company policies, or RAG-based documentation. Then ask the agent to cross-reference the custom tool results with those sources to produce more contextual recommendations.
Connect additional MCP servers to extend the agent’s capabilities beyond analysis. For example, the agent could send notifications by email, or messaging services, create charts from the results, generate reports, or trigger follow-up workflows based on the detected issues.
Further details can be found in the MCP Server Tools.