{
  "version": "1",
  "provenance": {
    "repo": "factverse-core-ai",
    "commit": "d452efa95b53a13701c68bd8e69bff150baac02c",
    "sources": [
      "advisor/tool_registry.py",
      "mcp_server.py",
      "mcp_scopes.py"
    ]
  },
  "counts": {
    "total": 91,
    "by_slice": {
      "base": 54,
      "trafficops": 7,
      "pdm": 5,
      "telcoops": 3,
      "semiops": 16,
      "aviation": 6
    },
    "by_source": {
      "advisor": 62,
      "engine": 23,
      "aviation": 6
    }
  },
  "tools": [
    {
      "name": "analyze_env_correlation",
      "slice": "semiops",
      "scope": "semiops.read",
      "category": "knowledge",
      "source": "advisor",
      "description": "Analyze correlation between environmental parameters (temperature, humidity, pressure, particles) in a cleanroom. Helps identify which parameters influence each other. Especially useful for diagnosing temperature/humidity impact on solder paste performance, PCB lamination quality, and photolithography exposure accuracy.",
      "parameters": {
        "type": "object",
        "properties": {
          "cleanroom_id": {
            "type": "string",
            "description": "Cleanroom ID to analyze"
          }
        },
        "required": [
          "cleanroom_id"
        ]
      }
    },
    {
      "name": "analyze_network_health",
      "slice": "telcoops",
      "scope": "telcoops.read",
      "category": "telcoops",
      "source": "advisor",
      "description": "Analyze telecom network health by fetching overview, link utilization, and open incidents. Returns a graded narrative (A-F) with node/link counts, incident summary, top-risk link, financial impact estimate, and prioritized recommendations. Use when asked about network status, NOC overview, telecom health, or infrastructure risk.",
      "parameters": {
        "type": "object",
        "properties": {}
      }
    },
    {
      "name": "analyze_spare_parts",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "analysis",
      "source": "advisor",
      "description": "Analyze spare parts inventory and usage patterns. Shows top replaced parts, slow-moving inventory, stockout risks, and reorder recommendations. Use for inventory optimization and procurement planning.",
      "parameters": {
        "type": "object",
        "properties": {
          "equipment_type": {
            "type": "string",
            "description": "Filter by equipment type (e.g. AHU, CHILLER)"
          },
          "part_category": {
            "type": "string",
            "description": "Filter by part category"
          },
          "months": {
            "type": "integer",
            "default": 12,
            "description": "Months of history to analyze"
          }
        }
      }
    },
    {
      "name": "analyze_spatial_anomaly",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "spatial",
      "source": "advisor",
      "description": "Analyze spatial heatmap sensor data for anomalies. Detects sensors with values more than N standard deviations from the mean. Use when asked about hot/cold spots, unusual readings, or spatial outliers.",
      "parameters": {
        "type": "object",
        "properties": {
          "scene_id": {
            "type": "string",
            "description": "Scene ID (heatops, iaq-building-env, energy-floor-consumption, space-occupancy)"
          },
          "variable": {
            "type": "string",
            "description": "Variable to analyze (supply_temp, co2, electricity)"
          },
          "zone": {
            "type": "string",
            "description": "Zone filter: all, north, south, etc.",
            "default": "all"
          },
          "threshold_sigma": {
            "type": "number",
            "description": "Sigma threshold for anomaly detection (default 2.0)",
            "default": 2
          }
        },
        "required": [
          "scene_id",
          "variable"
        ]
      }
    },
    {
      "name": "automl_forecast",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "forecasting",
      "source": "engine",
      "description": "AutoML model selection and forecast — picks the best algorithm",
      "parameters": null
    },
    {
      "name": "aviation_component_compare",
      "slice": "aviation",
      "scope": "aviation.analysis.read",
      "category": "aviation",
      "source": "aviation",
      "description": "Compare reliability behavior across component groups.",
      "parameters": null
    },
    {
      "name": "aviation_fleet_stats",
      "slice": "aviation",
      "scope": "aviation.analysis.read",
      "category": "aviation",
      "source": "aviation",
      "description": "Summarize fleet reliability signals by ATA chapter and failure distribution.",
      "parameters": null
    },
    {
      "name": "aviation_kpi_attribution",
      "slice": "aviation",
      "scope": "aviation.analysis.read",
      "category": "aviation",
      "source": "aviation",
      "description": "Attribute a reliability KPI to supporting failure records and evidence.",
      "parameters": null
    },
    {
      "name": "aviation_repetitive_fault_detect",
      "slice": "aviation",
      "scope": "aviation.analysis.read",
      "category": "aviation",
      "source": "aviation",
      "description": "Detect and summarize repetitive fault groups for reliability review.",
      "parameters": null
    },
    {
      "name": "aviation_text_mining_scan",
      "slice": "aviation",
      "scope": "aviation.analysis.read",
      "category": "aviation",
      "source": "aviation",
      "description": "Scan maintenance text for recurring or unusual technical issue candidates.",
      "parameters": null
    },
    {
      "name": "aviation_weibull_fit",
      "slice": "aviation",
      "scope": "aviation.analysis.read",
      "category": "aviation",
      "source": "aviation",
      "description": "Fit Weibull reliability curves for selected replacement or removal data.",
      "parameters": null
    },
    {
      "name": "calculate_emissions",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "analysis",
      "source": "advisor",
      "description": "Calculate GHG emissions (Scope 1/2/3) for a building or facility. Returns CO₂e breakdown by scope with regional default default emission factors. Use when the user asks about carbon footprint, emissions, or sustainability metrics.",
      "parameters": {
        "type": "object",
        "properties": {
          "scope": {
            "type": "integer",
            "enum": [
              1,
              2,
              3
            ],
            "description": "Emission scope: 1=direct, 2=electricity, 3=value chain"
          },
          "fuel_type": {
            "type": "string",
            "description": "Fuel type for Scope 1 (e.g. natural_gas, diesel, refrigerant_r410a)"
          },
          "electricity_kwh": {
            "type": "number",
            "description": "Electricity consumption in kWh for Scope 2"
          },
          "category": {
            "type": "string",
            "description": "Category for Scope 3 (e.g. waste_landfill, water_supply, commuting_mrt)"
          },
          "consumption": {
            "type": "number",
            "description": "Consumption quantity in the relevant unit"
          },
          "period": {
            "type": "string",
            "description": "Reporting period (e.g. '2025-01', '2025-Q1', '2025')"
          }
        },
        "required": [
          "scope"
        ]
      }
    },
    {
      "name": "cascade_simulation",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "simulation",
      "source": "engine",
      "description": "Multi-engine cascade simulation — chain DES, ABM, Monte Carlo",
      "parameters": null
    },
    {
      "name": "check_data_quality",
      "slice": "base",
      "scope": "base.read",
      "category": "knowledge",
      "source": "advisor",
      "description": "Check data quality dashboard for all integrated data sources. Returns quality scores by dimension (completeness, accuracy, consistency, timeliness) and lists top violations. Use when asked about data quality, data health, or data issues.",
      "parameters": {
        "type": "object",
        "properties": {}
      }
    },
    {
      "name": "check_officer_roster",
      "slice": "trafficops",
      "scope": "trafficops.read",
      "category": "trafficops",
      "source": "advisor",
      "description": "Check current shift officer roster and manpower availability at the checkpoint. Returns all deployed officers with their assignments, available spares, and next shift change time. Use this when asked about staffing, manpower, or whether additional officers can be deployed.",
      "parameters": {
        "type": "object",
        "properties": {
          "shift": {
            "type": "string",
            "default": "current",
            "description": "Shift to check: 'current', 'morning', 'afternoon', 'night'"
          }
        }
      }
    },
    {
      "name": "classify_smt_defects",
      "slice": "semiops",
      "scope": "semiops.read",
      "category": "quality",
      "source": "advisor",
      "description": "Classify SMT defects with Pareto analysis and root-cause recommendations. Shows defect distribution by type/severity, DPMO, and actionable fixes. Recognizes PCB/FPC-specific defect types including solder paste issues, tombstoning, bridging, missing components, cold joints, and pad lifting.",
      "parameters": {
        "type": "object",
        "properties": {
          "line_id": {
            "type": "string",
            "description": "SMT line ID (optional, all lines if omitted)"
          },
          "days": {
            "type": "integer",
            "default": 7,
            "description": "Days of defect data to analyze"
          }
        }
      }
    },
    {
      "name": "compare_zones",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "spatial",
      "source": "advisor",
      "description": "Compare spatial statistics between two zones or floors. Provides mean, min, max, std dev comparison with interpretation. Use when asked to compare north vs south, floor 1 vs floor 2, or any two zones.",
      "parameters": {
        "type": "object",
        "properties": {
          "scene_id": {
            "type": "string",
            "description": "Scene ID"
          },
          "variable": {
            "type": "string",
            "description": "Variable to compare"
          },
          "zone_a": {
            "type": "string",
            "description": "First zone (north, 1f, etc.)"
          },
          "zone_b": {
            "type": "string",
            "description": "Second zone (south, 2f, etc.)"
          }
        },
        "required": [
          "scene_id",
          "variable",
          "zone_a",
          "zone_b"
        ]
      }
    },
    {
      "name": "conformal_predict",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "analysis",
      "source": "engine",
      "description": "Distribution-free prediction intervals",
      "parameters": null
    },
    {
      "name": "create_work_order",
      "slice": "base",
      "scope": "base.action.write",
      "category": "action",
      "source": "advisor",
      "description": "Create a new work order based on the advisor's recommendation. Only use this when the user explicitly agrees to take action.",
      "parameters": {
        "type": "object",
        "properties": {
          "equipment_id": {
            "type": "integer",
            "description": "Equipment to create work order for"
          },
          "title": {
            "type": "string",
            "description": "Work order title"
          },
          "description": {
            "type": "string",
            "description": "Detailed description of work needed"
          },
          "priority": {
            "type": "string",
            "enum": [
              "LOW",
              "MEDIUM",
              "HIGH",
              "CRITICAL"
            ]
          }
        },
        "required": [
          "equipment_id",
          "title",
          "description",
          "priority"
        ]
      }
    },
    {
      "name": "detect_anomaly",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "forecasting",
      "source": "engine",
      "description": "Score data points for anomalies (z-score, isolation forest, autoencoder)",
      "parameters": null
    },
    {
      "name": "detect_drift",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "analysis",
      "source": "engine",
      "description": "Detect data or concept drift between datasets",
      "parameters": null
    },
    {
      "name": "estimate_causal_effect",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "analysis",
      "source": "engine",
      "description": "Estimate treatment effects via causal inference",
      "parameters": null
    },
    {
      "name": "evaluate_lane_reconfig",
      "slice": "trafficops",
      "scope": "trafficops.read",
      "category": "trafficops",
      "source": "advisor",
      "description": "Run a DES (Discrete Event Simulation) comparing the current lane configuration against a proposed reconfiguration (e.g., closing a car lane to open an additional motorcycle lane). Uses real simulation engine to compute wait times, throughput, and SLA compliance. You can provide user-reported data like arrival rates and queue lengths for accurate simulation. Use this when recommending lane changes to quantify the trade-off before the officer decides.",
      "parameters": {
        "type": "object",
        "properties": {
          "close_lanes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Lane IDs to close (e.g. ['CAR-4'])"
          },
          "open_lanes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "New lane ID (e.g. 'MC-6')"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "motorcycle",
                    "car"
                  ],
                  "description": "Vehicle type for new lane"
                },
                "from_lane": {
                  "type": "string",
                  "description": "Original lane being converted"
                }
              }
            },
            "description": "New lane configs to open (e.g. [{'id': 'MC-6', 'type': 'motorcycle', 'from_lane': 'CAR-4'}])"
          },
          "motorcycle_arrival_rate_hr": {
            "type": "number",
            "description": "Motorcycle arrival rate in vehicles/hour (default: 420 for surge scenario)"
          },
          "car_arrival_rate_hr": {
            "type": "number",
            "description": "Car arrival rate in vehicles/hour (default: 180)"
          },
          "motorcycle_lanes": {
            "type": "integer",
            "description": "Current number of motorcycle lanes in baseline (default: 5)"
          },
          "car_lanes": {
            "type": "integer",
            "description": "Current number of car lanes in baseline (default: 4)"
          },
          "motorcycle_queue_length": {
            "type": "integer",
            "description": "Current motorcycle queue length (total vehicles waiting, default: 0)"
          },
          "car_queue_length": {
            "type": "integer",
            "description": "Current car queue length (total vehicles waiting, default: 0)"
          },
          "simulation_time_min": {
            "type": "number",
            "description": "Simulation duration in minutes (default: 60)"
          }
        },
        "required": [
          "close_lanes",
          "open_lanes"
        ]
      }
    },
    {
      "name": "explain_incident",
      "slice": "telcoops",
      "scope": "telcoops.read",
      "category": "telcoops",
      "source": "advisor",
      "description": "Explain a specific telecom network incident in natural language. Returns severity, detection time, root cause, customer/revenue impact, and step-by-step remediation actions (immediate, short-term, long-term). Use when asked about a particular incident, alert, or fault.",
      "parameters": {
        "type": "object",
        "properties": {
          "incident_id": {
            "type": "string",
            "description": "Incident ID to explain"
          }
        },
        "required": [
          "incident_id"
        ]
      }
    },
    {
      "name": "explain_prediction",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "analysis",
      "source": "engine",
      "description": "Explain a model prediction using SHAP",
      "parameters": null
    },
    {
      "name": "extract_maintenance_record",
      "slice": "base",
      "scope": "base.read",
      "category": "knowledge",
      "source": "advisor",
      "description": "Extract structured data from maintenance document (PDF/image) using AI. Returns equipment ID, maintenance date, type, technician, findings, replaced parts, and confidence score. Use when the user wants to digitize paper maintenance records.",
      "parameters": {
        "type": "object",
        "properties": {
          "document_id": {
            "type": "integer",
            "description": "ECM document ID to extract"
          }
        },
        "required": [
          "document_id"
        ]
      }
    },
    {
      "name": "find_changepoints",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "analysis",
      "source": "engine",
      "description": "Detect structural breaks in a time series",
      "parameters": null
    },
    {
      "name": "find_optimal_policy",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "optimization",
      "source": "engine",
      "description": "Find optimal treatment policy using causal inference",
      "parameters": null
    },
    {
      "name": "find_path",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "wayfinding",
      "source": "advisor",
      "description": "Find navigation path between two locations in a building. Supports multi-floor routing, accessibility options, and crowd avoidance.",
      "parameters": {
        "type": "object",
        "properties": {
          "from_location": {
            "type": "string",
            "description": "Starting location name or node ID"
          },
          "to_location": {
            "type": "string",
            "description": "Destination location name or node ID"
          },
          "accessible": {
            "type": "boolean",
            "description": "Wheelchair-accessible route only",
            "default": false
          },
          "avoid_crowds": {
            "type": "boolean",
            "description": "Avoid congested areas",
            "default": false
          }
        },
        "required": [
          "from_location",
          "to_location"
        ]
      }
    },
    {
      "name": "fit_distribution",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "analysis",
      "source": "advisor",
      "description": "Fit probability distributions to observed data. Useful for analyzing failure times, service durations, or arrival patterns. Returns best-fit distribution with parameters and goodness-of-fit statistics (KS test, AIC). Use when the user wants to understand what statistical distribution best describes their data.",
      "parameters": {
        "type": "object",
        "properties": {
          "data_source": {
            "type": "string",
            "enum": [
              "sensor_readings",
              "failure_times",
              "service_times",
              "custom"
            ],
            "description": "Source of data to fit. 'custom' expects raw data array."
          },
          "equipment_id": {
            "type": "integer",
            "description": "Equipment ID for sensor/failure data (required for sensor_readings, failure_times)"
          },
          "sensor_type": {
            "type": "string",
            "description": "Sensor type filter (e.g. 'temperature', 'vibration') for sensor_readings"
          },
          "custom_data": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "description": "Raw data points for custom fitting (min 20 points)"
          }
        },
        "required": [
          "data_source"
        ]
      }
    },
    {
      "name": "forecast_fab_load",
      "slice": "semiops",
      "scope": "semiops.read",
      "category": "prediction",
      "source": "advisor",
      "description": "Forecast fab electrical load for the next 24-168 hours using pattern-based model. Identifies peak/valley periods and demand response opportunities.",
      "parameters": {
        "type": "object",
        "properties": {
          "hours_ahead": {
            "type": "integer",
            "default": 24,
            "description": "Hours to forecast (1-168)"
          }
        }
      }
    },
    {
      "name": "forecast_timeseries",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "forecasting",
      "source": "engine",
      "description": "Run Holt-Winters or Prophet forecast on a time series",
      "parameters": null
    },
    {
      "name": "generate_report",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "reporting",
      "source": "advisor",
      "description": "Generate a status report or simulation report. Use for equipment overview, alert summary, or simulation analysis reports.",
      "parameters": {
        "type": "object",
        "properties": {
          "report_type": {
            "type": "string",
            "enum": [
              "simulation",
              "equipment_status"
            ],
            "description": "Type of report: 'simulation' runs a DES and reports KPIs, 'equipment_status' summarizes current equipment/alerts/work orders"
          },
          "module": {
            "type": "string",
            "enum": [
              "trafficops",
              "heatops",
              "fms"
            ],
            "description": "Module for simulation reports"
          },
          "format": {
            "type": "string",
            "enum": [
              "pdf",
              "excel"
            ],
            "description": "Output format (default: pdf)"
          }
        },
        "required": [
          "report_type"
        ]
      }
    },
    {
      "name": "get_action_plan_history",
      "slice": "base",
      "scope": "base.read",
      "category": "knowledge",
      "source": "advisor",
      "description": "Get the history of AI action plans including their workflow approval status. Returns past action plans with approval decisions, execution outcomes, and linked ECM documents (incident reports). Use this to answer questions about past incidents, decisions, and their outcomes.",
      "parameters": {
        "type": "object",
        "properties": {
          "checkpoint_id": {
            "type": "string",
            "description": "Optional: filter by checkpoint ID"
          },
          "urgency": {
            "type": "string",
            "enum": [
              "CRITICAL",
              "WARNING",
              "ALL"
            ],
            "description": "Filter by urgency level. Default ALL",
            "default": "ALL"
          },
          "limit": {
            "type": "integer",
            "description": "Maximum number of results to return. Default 10",
            "default": 10
          }
        }
      }
    },
    {
      "name": "get_checkpoint_lane_status",
      "slice": "trafficops",
      "scope": "trafficops.read",
      "category": "trafficops",
      "source": "advisor",
      "description": "Get real-time lane status for a vehicle checkpoint including per-lane utilization, queue lengths, wait times, and assigned officers. Covers both motorcycle and car lanes. You can provide user-reported data (queue lengths, arrival rates, lane counts) to override defaults. Use this when asked about current checkpoint conditions, congestion, or lane capacity.",
      "parameters": {
        "type": "object",
        "properties": {
          "scene_id": {
            "type": "string",
            "default": "border-lbc-arrival-car",
            "description": "Scene ID (e.g. border-lbc-arrival-car, border-lbc-departure-car)"
          },
          "motorcycle_lanes": {
            "type": "integer",
            "description": "Override number of motorcycle lanes (default: 5)"
          },
          "car_lanes": {
            "type": "integer",
            "description": "Override number of car lanes (default: 4)"
          },
          "motorcycle_queue_total": {
            "type": "integer",
            "description": "User-reported total motorcycle queue length across all lanes"
          },
          "car_queue_total": {
            "type": "integer",
            "description": "User-reported total car queue length across all lanes"
          },
          "motorcycle_arrival_rate_hr": {
            "type": "number",
            "description": "User-reported motorcycle arrival rate (vehicles/hour)"
          },
          "car_arrival_rate_hr": {
            "type": "number",
            "description": "User-reported car arrival rate (vehicles/hour)"
          }
        }
      }
    },
    {
      "name": "get_cleanroom_status",
      "slice": "semiops",
      "scope": "semiops.read",
      "category": "knowledge",
      "source": "advisor",
      "description": "Get real-time cleanroom status including temperature, humidity, pressure, particle counts, and ISO compliance. Covers lamination rooms, PCB/FPC exposure zones, and general semiconductor cleanrooms. Use when asked about cleanroom conditions, environment, or contamination levels. Omit cleanroom_id to get all cleanrooms.",
      "parameters": {
        "type": "object",
        "properties": {
          "cleanroom_id": {
            "type": "string",
            "description": "Cleanroom ID (omit for all cleanrooms)"
          }
        }
      }
    },
    {
      "name": "get_compliance_documents",
      "slice": "base",
      "scope": "base.read",
      "category": "knowledge",
      "source": "advisor",
      "description": "Get compliance-related documents (certificates, audit reports, evidence packs) filtered by standard. Use when the user asks about ISO compliance, FDA, or regulatory documentation.",
      "parameters": {
        "type": "object",
        "properties": {
          "standard": {
            "type": "string",
            "description": "Compliance standard (e.g. ISO_14644, SEMI_S2, GM, FDA_21_CFR)"
          },
          "status": {
            "type": "string",
            "enum": [
              "APPROVED",
              "EXPIRED",
              "IN_REVIEW",
              "RECORD"
            ],
            "description": "Filter by document status"
          }
        }
      }
    },
    {
      "name": "get_equipment_documents",
      "slice": "base",
      "scope": "base.read",
      "category": "knowledge",
      "source": "advisor",
      "description": "Get all documents associated with an equipment (manuals, SOPs, drawings, maintenance records). Use when the user asks about equipment documentation or wants to find related manuals/SOPs.",
      "parameters": {
        "type": "object",
        "properties": {
          "equipment_id": {
            "type": "integer",
            "description": "Equipment ID"
          },
          "doc_type": {
            "type": "string",
            "enum": [
              "MANUAL",
              "SOP",
              "DRAWING",
              "REPORT",
              "CERTIFICATE",
              "PHOTO"
            ],
            "description": "Filter by document type"
          }
        },
        "required": [
          "equipment_id"
        ]
      }
    },
    {
      "name": "get_equipment_health",
      "slice": "pdm",
      "scope": "pdm.read",
      "category": "pdm",
      "source": "advisor",
      "description": "Get health status of a predictive maintenance equipment. Returns health score (0-100), grade (A/B/C/D/F), anomaly level, crest factor, vibration RMS.",
      "parameters": {
        "type": "object",
        "properties": {
          "equipment_name": {
            "type": "string",
            "description": "Equipment name or code (e.g. VB-VP-001, vacuum pump)"
          },
          "equipment_id": {
            "type": "string",
            "description": "Equipment UUID (optional)"
          }
        },
        "required": [
          "equipment_name"
        ]
      }
    },
    {
      "name": "get_equipment_status",
      "slice": "base",
      "scope": "base.read",
      "category": "knowledge",
      "source": "advisor",
      "description": "Get real-time status of equipment including latest sensor readings, active alerts, and recent work orders. Use this to understand current conditions.",
      "parameters": {
        "type": "object",
        "properties": {
          "equipment_id": {
            "type": "integer",
            "description": "Equipment ID to query (omit for all equipment)"
          }
        }
      }
    },
    {
      "name": "get_expiring_documents",
      "slice": "base",
      "scope": "base.read",
      "category": "knowledge",
      "source": "advisor",
      "description": "Get documents approaching retention end date or requiring periodic review. Use for compliance monitoring and proactive document management.",
      "parameters": {
        "type": "object",
        "properties": {
          "days_ahead": {
            "type": "integer",
            "default": 30,
            "description": "Days ahead to check (default: 30)"
          }
        }
      }
    },
    {
      "name": "get_fab_pue",
      "slice": "semiops",
      "scope": "semiops.read",
      "category": "knowledge",
      "source": "advisor",
      "description": "Get current Power Usage Effectiveness (PUE) for the fab facility with energy breakdown (IT load, cooling, lighting, HVAC, etc.) and benchmark rating. Applicable to PCB/FPC factories, semiconductor fabs, and electronics manufacturing plants. Use for energy efficiency questions.",
      "parameters": {
        "type": "object",
        "properties": {}
      }
    },
    {
      "name": "get_filter_circular_recovery",
      "slice": "pdm",
      "scope": "pdm.read",
      "category": "pdm",
      "source": "advisor",
      "description": "Get live circular recovery and aftermarket outlook for predictive maintenance filter components in the current tenant or one equipment. Returns recovery candidates, risk band, remaining life, recommended actions, and aftermarket or disposal guidance. Use for circular recovery, reuse, remanufacture, disposal, aftermarket, or sustainability questions about filter components.",
      "parameters": {
        "type": "object",
        "properties": {
          "equipment_id": {
            "type": "string",
            "description": "Equipment ID (optional)"
          },
          "equipment_code": {
            "type": "string",
            "description": "Equipment code or name, e.g. MH-MP-001 (optional)"
          },
          "top_n": {
            "type": "integer",
            "description": "How many components to highlight (default: 5)"
          }
        }
      }
    },
    {
      "name": "get_filter_component_intelligence",
      "slice": "pdm",
      "scope": "pdm.read",
      "category": "pdm",
      "source": "advisor",
      "description": "Get live predictive maintenance filter component intelligence for the current tenant or one equipment. Returns components that need attention now, including risk band, predicted remaining life, recommended action, benchmark context, and aftermarket narrative. Use for questions about filter components, component intelligence, customer fleet filters, what needs attention right now, or component-level maintenance priorities.",
      "parameters": {
        "type": "object",
        "properties": {
          "equipment_id": {
            "type": "string",
            "description": "Equipment ID (optional)"
          },
          "equipment_code": {
            "type": "string",
            "description": "Equipment code or name, e.g. MH-EX-003 (optional)"
          },
          "top_n": {
            "type": "integer",
            "description": "How many components to highlight (default: 5)"
          }
        }
      }
    },
    {
      "name": "get_filter_life",
      "slice": "semiops",
      "scope": "semiops.read",
      "category": "knowledge",
      "source": "advisor",
      "description": "Get HEPA/ULPA filter remaining life prediction based on pressure drop trends. Shows estimated days remaining before filter replacement is needed. Covers cleanroom filters for PCB exposure areas, lamination zones, and semiconductor fabs. Do NOT use for predictive maintenance/mobile-equipment filter components such as excavators, loaders, generators, or customer fleet fleet assets.",
      "parameters": {
        "type": "object",
        "properties": {
          "cleanroom_id": {
            "type": "string",
            "description": "Cleanroom ID (omit for all filters)"
          }
        }
      }
    },
    {
      "name": "get_iso_compliance",
      "slice": "semiops",
      "scope": "semiops.read",
      "category": "knowledge",
      "source": "advisor",
      "description": "Get ISO 14644 compliance status and assessment history for cleanrooms. Shows current classification, pass/fail status, and historical assessment trends.",
      "parameters": {
        "type": "object",
        "properties": {
          "cleanroom_id": {
            "type": "string",
            "description": "Cleanroom ID (omit for all)"
          }
        }
      }
    },
    {
      "name": "get_optimization_recommendation",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "optimization",
      "source": "advisor",
      "description": "Find the optimal staff configuration for checkpoint operations within a budget constraint. Uses NSGA-II multi-objective optimization to balance throughput vs wait time. Returns Pareto-optimal solutions with cost-benefit analysis and operator-ready actions. Use this to answer questions like 'How should we allocate 10 extra staff?' or 'What's the best configuration for a $5000/hr budget?'.",
      "parameters": {
        "type": "object",
        "properties": {
          "budget": {
            "type": "number",
            "description": "Total hourly budget for staff (cost units). Default 5000",
            "default": 5000
          },
          "cost_per_staff": {
            "type": "number",
            "description": "Cost per additional staff member per hour. Default 100",
            "default": 100
          },
          "target_kpi": {
            "type": "string",
            "enum": [
              "avg_wait",
              "throughput",
              "p95_wait"
            ],
            "description": "Primary KPI to optimize",
            "default": "avg_wait"
          },
          "audience": {
            "type": "string",
            "enum": [
              "manager",
              "operator",
              "both"
            ],
            "description": "Target audience for the insight report",
            "default": "both"
          }
        }
      }
    },
    {
      "name": "get_particle_trend",
      "slice": "semiops",
      "scope": "semiops.read",
      "category": "knowledge",
      "source": "advisor",
      "description": "Get particle count trends over time for a specific cleanroom. Shows how particle levels have changed and helps identify contamination events or degradation patterns.",
      "parameters": {
        "type": "object",
        "properties": {
          "cleanroom_id": {
            "type": "string",
            "description": "Cleanroom ID to query"
          },
          "hours": {
            "type": "integer",
            "default": 24,
            "description": "Hours of history to retrieve"
          },
          "particle_size": {
            "type": "string",
            "description": "Particle size filter (e.g. '0.5um', '5.0um')"
          }
        },
        "required": [
          "cleanroom_id"
        ]
      }
    },
    {
      "name": "get_pdm_summary",
      "slice": "pdm",
      "scope": "pdm.read",
      "category": "pdm",
      "source": "advisor",
      "description": "Get predictive maintenance fleet health summary: equipment count, grade distribution (A/B/C/D/F), critical count, active alerts, 7-day health trend.",
      "parameters": {
        "type": "object",
        "properties": {
          "tenant_filter": {
            "type": "string"
          }
        }
      }
    },
    {
      "name": "get_pending_tasks",
      "slice": "base",
      "scope": "base.read",
      "category": "action",
      "source": "advisor",
      "description": "Get pending ECM workflow tasks (documents awaiting approval, signature, or review). Use when the user asks about their to-do list or pending approvals.",
      "parameters": {
        "type": "object",
        "properties": {
          "user_id": {
            "type": "integer",
            "description": "User ID (omit for current user)"
          }
        }
      }
    },
    {
      "name": "get_pressure_gradient",
      "slice": "semiops",
      "scope": "semiops.read",
      "category": "knowledge",
      "source": "advisor",
      "description": "Get pressure gradient cascade status across cleanroom pairs. Shows whether pressure differentials between rooms are maintained correctly to prevent cross-contamination.",
      "parameters": {
        "type": "object",
        "properties": {}
      }
    },
    {
      "name": "get_proactive_alerts",
      "slice": "trafficops",
      "scope": "trafficops.read",
      "category": "trafficops",
      "source": "advisor",
      "description": "Get proactive congestion alerts based on forecast vs SLA comparison. Returns predicted SLA breaches with severity, evidence, and improvement suggestions (Budget/Speed/Balanced). Use this when asked about potential upcoming issues or congestion risks.",
      "parameters": {
        "type": "object",
        "properties": {
          "sla_minutes": {
            "type": "number",
            "default": 12,
            "description": "SLA threshold in minutes for wait time"
          }
        }
      }
    },
    {
      "name": "get_smt_oee",
      "slice": "semiops",
      "scope": "semiops.read",
      "category": "knowledge",
      "source": "advisor",
      "description": "Get SMT (Surface Mount Technology) production line OEE (Overall Equipment Effectiveness) with Availability × Performance × Quality breakdown. Covers PCB assembly lines including solder paste printing, pick-and-place, reflow oven, and AOI stations. Use for production efficiency questions.",
      "parameters": {
        "type": "object",
        "properties": {
          "line_id": {
            "type": "string",
            "description": "SMT line ID (omit for all lines)"
          }
        }
      }
    },
    {
      "name": "get_surge_detection",
      "slice": "trafficops",
      "scope": "trafficops.read",
      "category": "trafficops",
      "source": "advisor",
      "description": "Get current traffic surge/anomaly detection status for a checkpoint. Detects unusual spikes in arrival rates by vehicle type (motorcycle, car, bus). Returns surge magnitude, estimated duration, probable cause, and initial recommendation. You can provide user-reported arrival rates to override defaults. Use this when asked about current traffic anomalies or unexpected congestion.",
      "parameters": {
        "type": "object",
        "properties": {
          "checkpoint": {
            "type": "string",
            "default": "vehicle-arrival",
            "description": "Checkpoint area (e.g. vehicle-arrival, pedestrian-arrival)"
          },
          "motorcycle_arrival_rate_hr": {
            "type": "number",
            "description": "User-reported motorcycle arrival rate (vehicles/hour)"
          },
          "car_arrival_rate_hr": {
            "type": "number",
            "description": "User-reported car arrival rate (vehicles/hour)"
          },
          "motorcycle_lanes": {
            "type": "integer",
            "description": "Number of motorcycle lanes (for affected lanes list)"
          }
        }
      }
    },
    {
      "name": "get_traffic_forecast",
      "slice": "trafficops",
      "scope": "trafficops.read",
      "category": "trafficops",
      "source": "advisor",
      "description": "Get an 8-hour traffic flow forecast for a specific checkpoint. Returns predicted throughput (pax/h) at 15-minute intervals with confidence bands. Use this to check if congestion is expected and plan ahead.",
      "parameters": {
        "type": "object",
        "properties": {
          "checkpoint": {
            "type": "string",
            "default": "document-check",
            "description": "Checkpoint ID (e.g. document-check, biometric-scan, security-screen)"
          },
          "hours": {
            "type": "integer",
            "default": 8,
            "description": "Hours ahead to forecast (1-24)"
          }
        }
      }
    },
    {
      "name": "get_traffic_patterns",
      "slice": "trafficops",
      "scope": "trafficops.read",
      "category": "trafficops",
      "source": "advisor",
      "description": "Get detected recurring patterns for a traffic checkpoint using DOE statistical analysis. Returns day-of-week effects, hour-of-day peaks, and bottleneck patterns with p-values and confidence levels. Use this to understand structural traffic behavior.",
      "parameters": {
        "type": "object",
        "properties": {
          "checkpoint": {
            "type": "string",
            "default": "document-check",
            "description": "Checkpoint ID"
          },
          "days": {
            "type": "integer",
            "default": 90,
            "description": "Days of historical data to analyze"
          }
        }
      }
    },
    {
      "name": "get_utility_status",
      "slice": "semiops",
      "scope": "semiops.read",
      "category": "knowledge",
      "source": "advisor",
      "description": "Get utility systems status including CDA (Clean Dry Air), N2 (Nitrogen), PCW (Process Cooling Water), and UPW (Ultra Pure Water). Shows pressure, flow, purity readings.",
      "parameters": {
        "type": "object",
        "properties": {}
      }
    },
    {
      "name": "import_data",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "analysis",
      "source": "advisor",
      "description": "Import and process data from external sources (REST API, CSV) through ETL pipeline for analysis. Connects to a data source, extracts records, and optionally fits distributions to the imported data. Use when the user wants to bring in external data for simulation input modeling.",
      "parameters": {
        "type": "object",
        "properties": {
          "connector_type": {
            "type": "string",
            "enum": [
              "rest",
              "csv"
            ],
            "description": "Type of data connector: 'rest' for REST API, 'csv' for CSV file"
          },
          "endpoint": {
            "type": "string",
            "description": "URL for REST API or file path for CSV"
          },
          "pipeline_id": {
            "type": "string",
            "enum": [
              "arrival-fitting",
              "service-time"
            ],
            "description": "Optional ETL pipeline: 'arrival-fitting' or 'service-time'"
          },
          "field_mapping": {
            "type": "object",
            "description": "Optional source→target field mapping (e.g. {'timestamp': 'arrival_time'})"
          }
        },
        "required": [
          "connector_type",
          "endpoint"
        ]
      }
    },
    {
      "name": "import_dxf",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "spatial",
      "source": "engine",
      "description": "Import a DXF floor plan and recognize walls/doors/windows/fences",
      "parameters": null
    },
    {
      "name": "list_connectors",
      "slice": "base",
      "scope": "base.read",
      "category": "knowledge",
      "source": "advisor",
      "description": "List all configured data connectors (REST, CSV, MQTT, OPC-UA, database, etc.) with their current status (active/error/syncing), last sync time, and source info. Use when asked about data sources, integrations, connectors, or data pipelines.",
      "parameters": {
        "type": "object",
        "properties": {}
      }
    },
    {
      "name": "list_pdm_anomalies",
      "slice": "pdm",
      "scope": "pdm.read",
      "category": "pdm",
      "source": "advisor",
      "description": "List predictive maintenance anomalies: bearing wear, overheating, vibration excess. Returns type, severity, equipment, AI recommendation.",
      "parameters": {
        "type": "object",
        "properties": {
          "severity": {
            "type": "string",
            "enum": [
              "ALL",
              "CRITICAL",
              "HIGH",
              "MEDIUM",
              "LOW"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "OPEN",
              "RESOLVED",
              "ALL"
            ]
          },
          "limit": {
            "type": "integer"
          }
        }
      }
    },
    {
      "name": "monitor_particles",
      "slice": "semiops",
      "scope": "semiops.read",
      "category": "monitoring",
      "source": "advisor",
      "description": "Monitor real-time particle counts in a cleanroom against ISO 14644-1 limits. Returns per-size evaluation, alerts for threshold exceedances, and overall status.",
      "parameters": {
        "type": "object",
        "properties": {
          "cleanroom_id": {
            "type": "string",
            "description": "Cleanroom ID to monitor"
          }
        },
        "required": [
          "cleanroom_id"
        ]
      }
    },
    {
      "name": "optimize_bayesian",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "optimization",
      "source": "engine",
      "description": "Bayesian optimization for black-box function tuning",
      "parameters": null
    },
    {
      "name": "optimize_chiller_cop",
      "slice": "semiops",
      "scope": "semiops.read",
      "category": "optimization",
      "source": "advisor",
      "description": "Optimize chiller loading across multiple units to maximize system COP. Compares optimal vs equal-loading strategies and calculates energy savings.",
      "parameters": {
        "type": "object",
        "properties": {
          "cooling_demand_kw": {
            "type": "number",
            "description": "Total cooling demand in kW"
          },
          "ambient_temp_c": {
            "type": "number",
            "default": 35,
            "description": "Outdoor ambient temperature °C"
          }
        },
        "required": [
          "cooling_demand_kw"
        ]
      }
    },
    {
      "name": "optimize_evolutionary",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "optimization",
      "source": "engine",
      "description": "Evolutionary multi-objective optimization (NSGA-II)",
      "parameters": null
    },
    {
      "name": "optimize_layout",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "optimization",
      "source": "advisor",
      "description": "Optimize the spatial layout of a facility (checkpoint positions, capacities, routes) using NSGA-II multi-objective optimization with DES evaluation. Finds Pareto-optimal layouts balancing throughput vs wait time. Use for facility design and space planning.",
      "parameters": {
        "type": "object",
        "properties": {
          "template_id": {
            "type": "string",
            "enum": [
              "immigration-hall-small",
              "security-screening",
              "departure-lounge"
            ],
            "description": "Layout template to optimize"
          },
          "objectives": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Objectives to optimize (default: throughput, avg_wait_time)"
          },
          "pop_size": {
            "type": "integer",
            "description": "NSGA-II population size (default: 20)"
          },
          "n_gen": {
            "type": "integer",
            "description": "Number of generations (default: 30)"
          }
        },
        "required": [
          "template_id"
        ]
      }
    },
    {
      "name": "optimize_milp",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "optimization",
      "source": "engine",
      "description": "Solve a mixed-integer linear programming (MILP) problem",
      "parameters": null
    },
    {
      "name": "predict_capacity",
      "slice": "telcoops",
      "scope": "telcoops.read",
      "category": "telcoops",
      "source": "advisor",
      "description": "Predict link capacity breaches based on current utilization and growth trends. Identifies links above 70% utilization, estimates days to breach threshold, and returns CapEx requirements and SLA penalty exposure if upgrades are deferred. Use when asked about capacity planning, bandwidth forecasting, or upgrade priorities.",
      "parameters": {
        "type": "object",
        "properties": {}
      }
    },
    {
      "name": "predict_env_trend",
      "slice": "semiops",
      "scope": "semiops.read",
      "category": "simulation",
      "source": "advisor",
      "description": "Predict environmental parameter trends (temperature, humidity, particles) for the next 2-4 hours in a cleanroom. Use for proactive monitoring and early warning.",
      "parameters": {
        "type": "object",
        "properties": {
          "cleanroom_id": {
            "type": "string",
            "description": "Cleanroom ID to predict"
          },
          "parameter": {
            "type": "string",
            "enum": [
              "temperature",
              "humidity",
              "particles",
              "pressure"
            ],
            "description": "Environmental parameter to predict"
          },
          "hours": {
            "type": "integer",
            "default": 4,
            "description": "Hours ahead to predict (1-8)"
          }
        },
        "required": [
          "cleanroom_id"
        ]
      }
    },
    {
      "name": "predict_rul",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "forecasting",
      "source": "engine",
      "description": "Predict remaining useful life (RUL) from sensor readings",
      "parameters": null
    },
    {
      "name": "predict_surrogate",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "data",
      "source": "engine",
      "description": "Run inference with a trained surrogate model",
      "parameters": null
    },
    {
      "name": "query_knowledge",
      "slice": "base",
      "scope": "base.read",
      "category": "knowledge",
      "source": "advisor",
      "description": "Query the knowledge graph for equipment types, failure modes, repair actions, diagnostic rules, and maintenance schedules. Use this to find expert knowledge.",
      "parameters": {
        "type": "object",
        "properties": {
          "query_type": {
            "type": "string",
            "enum": [
              "equipment_info",
              "failure_modes",
              "repair_actions",
              "diagnostic_rules"
            ],
            "description": "Type of knowledge to query"
          },
          "equipment_type": {
            "type": "string",
            "description": "Equipment type (e.g. COMPRESSOR, AHU, PUMP, CHILLER)"
          },
          "keyword": {
            "type": "string",
            "description": "Search keyword for free-text knowledge search"
          }
        },
        "required": [
          "query_type"
        ]
      }
    },
    {
      "name": "recommend_model",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "data",
      "source": "engine",
      "description": "AutoML recommendation for best model type",
      "parameters": null
    },
    {
      "name": "recommend_sensor_placement",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "spatial",
      "source": "advisor",
      "description": "Recommend optimal locations for additional sensors based on spatial coverage gaps and IDW confidence analysis. Use when asked about sensor deployment, coverage gaps, or where to install new sensors.",
      "parameters": {
        "type": "object",
        "properties": {
          "scene_id": {
            "type": "string",
            "description": "Scene ID"
          },
          "variable": {
            "type": "string",
            "description": "Variable to analyze for coverage"
          },
          "zone": {
            "type": "string",
            "description": "Zone to analyze. Use all for full area.",
            "default": "all"
          },
          "max_recommendations": {
            "type": "integer",
            "description": "Maximum number of placement recommendations (default 5)",
            "default": 5
          }
        },
        "required": [
          "scene_id",
          "variable"
        ]
      }
    },
    {
      "name": "recommend_training",
      "slice": "base",
      "scope": "base.read",
      "category": "knowledge",
      "source": "advisor",
      "description": "Recommend training courses based on equipment type, user role, and identified skill gaps. Returns prioritized course list with duration and priority level. Use for workforce development and certification planning.",
      "parameters": {
        "type": "object",
        "properties": {
          "equipment_type": {
            "type": "string",
            "description": "Equipment type (e.g. AHU, CHILLER, COMPRESSOR)"
          },
          "user_role": {
            "type": "string",
            "enum": [
              "operator",
              "technician",
              "engineer",
              "manager"
            ],
            "description": "User role for role-specific training",
            "default": "operator"
          },
          "skill_gap": {
            "type": "string",
            "description": "Identified skill gap to address"
          }
        }
      }
    },
    {
      "name": "run_abm",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "simulation",
      "source": "engine",
      "description": "Run an agent-based crowd simulation",
      "parameters": null
    },
    {
      "name": "run_dag_simulation",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "simulation",
      "source": "advisor",
      "description": "Run a DAG-routed DES simulation with advanced routing (shortest-queue, probability, condition). Returns throughput, bottleneck analysis, Sankey flow data, and AI recommendations. Use for complex multi-path checkpoint scenarios.",
      "parameters": {
        "type": "object",
        "properties": {
          "scene_id": {
            "type": "string",
            "enum": [
              "cp-immigration-dag",
              "cp-security-dag",
              "cp-multi-terminal"
            ],
            "description": "DAG scene to simulate"
          },
          "simulation_time": {
            "type": "number",
            "description": "Simulation duration in minutes (default: 120)"
          },
          "staff_count": {
            "type": "integer",
            "description": "Number of staff/lanes (affects capacity)"
          }
        },
        "required": [
          "scene_id"
        ]
      }
    },
    {
      "name": "run_des",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "simulation",
      "source": "engine",
      "description": "Run a discrete event simulation for process/queue modelling",
      "parameters": null
    },
    {
      "name": "run_doe",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "simulation",
      "source": "advisor",
      "description": "Run a Design of Experiments to identify which factors most significantly affect a target metric. Returns ANOVA analysis showing factor significance.",
      "parameters": {
        "type": "object",
        "properties": {
          "scene_type": {
            "type": "string",
            "enum": [
              "trafficops",
              "heatops",
              "fms"
            ]
          },
          "scene_id": {
            "type": "string"
          },
          "factors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "low": {
                  "type": "number"
                },
                "high": {
                  "type": "number"
                }
              }
            },
            "description": "Factors to vary in the experiment"
          },
          "response_metric": {
            "type": "string",
            "description": "KPI to analyze (e.g. throughput, availability, total_heat_delivered_kj)"
          }
        },
        "required": [
          "scene_type",
          "scene_id",
          "factors",
          "response_metric"
        ]
      }
    },
    {
      "name": "run_montecarlo",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "simulation",
      "source": "engine",
      "description": "Monte Carlo stress test / risk simulation",
      "parameters": null
    },
    {
      "name": "run_optimization",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "optimization",
      "source": "advisor",
      "description": "Find optimal parameters using multi-objective optimization (NSGA-II). Returns Pareto-optimal solutions trading off competing objectives. Use this when the user wants to find the best configuration.",
      "parameters": {
        "type": "object",
        "properties": {
          "module_type": {
            "type": "string",
            "enum": [
              "trafficops",
              "heatops",
              "fms"
            ]
          },
          "population_size": {
            "type": "integer",
            "default": 20
          },
          "generations": {
            "type": "integer",
            "default": 10
          }
        },
        "required": [
          "module_type"
        ]
      }
    },
    {
      "name": "run_simulation",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "simulation",
      "source": "advisor",
      "description": "Run a discrete event simulation (DES) to test a what-if scenario. Use this to verify predictions, compare configurations, or estimate impact of changes. Available scenes: trafficops (checkpoint flow), heatops (district heating), fms (equipment lifecycle).",
      "parameters": {
        "type": "object",
        "properties": {
          "scene_type": {
            "type": "string",
            "enum": [
              "trafficops",
              "heatops",
              "fms"
            ],
            "description": "Type of simulation to run"
          },
          "scene_id": {
            "type": "string",
            "description": "Scene configuration ID (e.g. 'rts-main-hall', 'small-network', 'hvac-fleet')"
          },
          "simulation_time": {
            "type": "number",
            "default": 480,
            "description": "Simulation time in minutes"
          },
          "config_overrides": {
            "type": "object",
            "description": "Override scene parameters (e.g. num_counters, supply_temp)"
          }
        },
        "required": [
          "scene_type",
          "scene_id"
        ]
      }
    },
    {
      "name": "run_soft_sensors",
      "slice": "semiops",
      "scope": "semiops.read",
      "category": "monitoring",
      "source": "advisor",
      "description": "Run virtual soft sensors to estimate unmeasurable parameters (AMC molecular contamination in ppb, dew point °C, HEPA filter loading %) from available cleanroom sensor data. Use when asked about molecular contamination, AMC levels, dew point, or filter status and no direct measurement is available.",
      "parameters": {
        "type": "object",
        "properties": {
          "temperature_c": {
            "type": "number",
            "description": "Current cleanroom temperature in °C"
          },
          "humidity_pct": {
            "type": "number",
            "description": "Current relative humidity %"
          },
          "particle_05um": {
            "type": "number",
            "description": "Current 0.5 µm particle count, particles/m³"
          },
          "air_changes_hour": {
            "type": "integer",
            "description": "Air changes per hour (ACH)",
            "default": 600
          },
          "cleanroom_age_days": {
            "type": "integer",
            "description": "Age of the cleanroom in days (affects outgassing AMC estimate)",
            "default": 365
          },
          "filter_dp_pa": {
            "type": "number",
            "description": "Current HEPA/ULPA filter pressure drop in Pa",
            "default": 200
          },
          "filter_initial_dp_pa": {
            "type": "number",
            "description": "Pressure drop of a new clean filter in Pa",
            "default": 50
          },
          "filter_max_dp_pa": {
            "type": "number",
            "description": "Replacement-threshold filter pressure drop in Pa",
            "default": 450
          },
          "filter_operating_hours": {
            "type": "number",
            "description": "Cumulative filter operating hours",
            "default": 4380
          }
        }
      }
    },
    {
      "name": "run_system_dynamics",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "simulation",
      "source": "engine",
      "description": "Run a system dynamics (stock-and-flow) simulation",
      "parameters": null
    },
    {
      "name": "run_what_if_comparison",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "simulation",
      "source": "advisor",
      "description": "Compare the current checkpoint configuration against a modified scenario using DES simulation. Use this to answer questions like 'What if we add 2 staff to biometric-scan?' or 'What happens if the bag scanner fails every 4 hours?'. Returns side-by-side KPI comparison, cost-benefit analysis, and concrete operator actions. Supports staff changes, lane adjustments, and equipment failure injection.",
      "parameters": {
        "type": "object",
        "properties": {
          "changes": {
            "type": "object",
            "description": "Per-checkpoint overrides: {checkpoint_id: {staff_count, mean_service_time, counters}}. Example: {'biometric-scan': {'staff_count': 4}, 'bag-scan': {'staff_count': 3}}"
          },
          "failure_injection": {
            "type": "object",
            "description": "Per-checkpoint failure configs: {checkpoint_id: {mtbf, mttr}}. Example: {'biometric-scan': {'mtbf': 240, 'mttr': 15}} — scanner fails every 4h, 15min repair"
          },
          "label": {
            "type": "string",
            "description": "Human-readable label for the modified scenario",
            "default": "Modified Scenario"
          },
          "audience": {
            "type": "string",
            "enum": [
              "manager",
              "operator",
              "both"
            ],
            "description": "Target audience for the insight report",
            "default": "both"
          },
          "replications": {
            "type": "integer",
            "description": "Number of simulation replications (higher = more accurate, slower)",
            "default": 5
          }
        }
      }
    },
    {
      "name": "search_checkpoint_sop",
      "slice": "base",
      "scope": "base.read",
      "category": "knowledge",
      "source": "advisor",
      "description": "Search checkpoint Standard Operating Procedures (SOPs) stored in the ECM system. Returns relevant SOP documents for a given checkpoint or operation type. Use this when the user asks about procedures, protocols, or standard operations for checkpoint management, immigration control, or customs clearance. Leverages ECM RAG (Retrieval-Augmented Generation) for semantic search.",
      "parameters": {
        "type": "object",
        "properties": {
          "query": {
            "type": "string",
            "description": "Search query for SOP content (e.g. 'peak hour lane opening procedure', 'biometric scanner fallback protocol', 'VIP passenger handling')"
          },
          "checkpoint_id": {
            "type": "string",
            "description": "Optional: specific checkpoint ID to scope the search"
          },
          "doc_type": {
            "type": "string",
            "enum": [
              "SOP",
              "INCIDENT_REPORT",
              "CAPACITY_PLANNING",
              "ALL"
            ],
            "description": "Type of document to search. Default ALL",
            "default": "ALL"
          }
        },
        "required": [
          "query"
        ]
      }
    },
    {
      "name": "search_documents",
      "slice": "base",
      "scope": "base.read",
      "category": "knowledge",
      "source": "advisor",
      "description": "Search ECM (Enterprise Content Management) for documents by keyword, type, or related entity. Returns document title, version, classification, and direct link. With RAG enhancement enabled, also provides AI-generated summary of relevant documents. Use when the user asks about manuals, SOPs, reports, certificates, or any documentation.",
      "parameters": {
        "type": "object",
        "properties": {
          "query": {
            "type": "string",
            "description": "Search keyword (title, description, content)"
          },
          "doc_type": {
            "type": "string",
            "enum": [
              "MANUAL",
              "SOP",
              "REPORT",
              "DRAWING",
              "CERTIFICATE",
              "PHOTO",
              "CONTRACT",
              "TEMPLATE"
            ],
            "description": "Filter by document type"
          },
          "entity_type": {
            "type": "string",
            "enum": [
              "EQUIPMENT",
              "ALERT",
              "WORK_ORDER",
              "CLEANROOM",
              "SMT_LINE"
            ],
            "description": "Filter by related entity type"
          },
          "entity_id": {
            "type": "integer",
            "description": "Entity ID to filter by"
          },
          "use_rag": {
            "type": "boolean",
            "default": true,
            "description": "Enable RAG-based AI summary"
          }
        }
      }
    },
    {
      "name": "simulate_logistics",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "simulation",
      "source": "engine",
      "description": "Run AGV/forklift logistics simulation on a facility layout",
      "parameters": null
    },
    {
      "name": "simulate_smt_bottleneck",
      "slice": "semiops",
      "scope": "semiops.read",
      "category": "simulation",
      "source": "advisor",
      "description": "Run discrete-event simulation of an SMT production line to identify throughput bottleneck station, utilization imbalances, and optimization opportunities.",
      "parameters": {
        "type": "object",
        "properties": {
          "line_id": {
            "type": "string",
            "description": "SMT line ID (optional, uses default config)"
          },
          "sim_hours": {
            "type": "number",
            "default": 8,
            "description": "Simulation duration in hours"
          },
          "boards": {
            "type": "integer",
            "default": 500,
            "description": "Number of boards to produce"
          }
        }
      }
    },
    {
      "name": "train_surrogate",
      "slice": "base",
      "scope": "base.compute.run",
      "category": "data",
      "source": "engine",
      "description": "Train a fast surrogate model from data",
      "parameters": null
    },
    {
      "name": "troubleshoot_connector",
      "slice": "base",
      "scope": "base.read",
      "category": "knowledge",
      "source": "advisor",
      "description": "Diagnose a specific data connector by fetching its details and recent sync logs. Analyzes recent errors and suggests concrete fixes (credentials, network, schema mapping, etc.). Use when a connector is failing, data is not syncing, or the user reports import/export issues.",
      "parameters": {
        "type": "object",
        "properties": {
          "connector_name": {
            "type": "string",
            "description": "Name or partial name of the connector to troubleshoot"
          }
        },
        "required": [
          "connector_name"
        ]
      }
    }
  ]
}
