{
  "$schema": "https://www.aitraining2u.com/casestudies/retail/demo/06-tools-registry.schema.json",
  "title": "Retail Agentic Operating Model — MCP Tools Registry",
  "version": "1.0.0",
  "router": {
    "description": "CSOA's tool-to-agent decision class router. Determines who owns which decision and where escalation goes.",
    "ownership": {
      "DDPA": ["pricing", "promo", "demand_forecast"],
      "ILA":  ["replenishment", "routing", "vendor_pull", "halal_chain_verify"],
      "HCOA": ["roster", "overtime", "skill_coverage", "burnout_watch"],
      "FOA":  ["facility_maintenance", "peak_shift", "safety_compliance"],
      "SPPA": ["site_tier_change", "closure_diligence", "replication_diligence", "new_format_pilot"],
      "CSOA": ["compose_daily_decision_list", "route_approval", "nightly_retraining"]
    },
    "escalation_triggers": [
      {"if": "rm_impact_abs > 5000000", "to": "human_ceo"},
      {"if": "regulatory_flag in ['KPDN_price_control', 'JAKIM_halal_break', 'MOH_food_safety']", "to": "human_ceo"},
      {"if": "labour_short > 0.10", "to": "human_cos"},
      {"if": "outcome_pending_age_days > 7", "to": "human_cos"}
    ],
    "learning": {
      "approve": "RPL signal +1 to the originating agent's playbook entry; weight by realised_rm_impact / forecast_rm_impact.",
      "defer":   "RPL signal 0; bump the decision to re-evaluation in the next cycle with refreshed signals.",
      "escalate":"RPL signal -1 to the originating agent's playbook entry; queue a playbook revision draft."
    }
  },
  "tools": {
    "DDPA": [
      {"name":"query_pricespy","description":"Live competitor price scrape for an SKU.","input":{"sku_code":"string","competitor_set":"string[]"},"side_effects":"read_only","approval_required_from":"self"},
      {"name":"query_pos","description":"POS sales window for site × SKU.","input":{"site_id":"string","sku_code":"string","window":"string"},"side_effects":"read_only","approval_required_from":"self"},
      {"name":"query_weather","description":"MET Malaysia forecast incl. PM2.5 and rainfall.","input":{"site_id":"string","horizon_hours":"int"},"side_effects":"read_only","approval_required_from":"self"},
      {"name":"search_memory","description":"Hybrid retrieval over the shared Pinecone+Obsidian memory.","input":{"query":"string","agent_namespace":"string?","entity_id":"string?","top_k":"int=10"},"side_effects":"read_only","approval_required_from":"self"},
      {"name":"propose_decision","description":"Submit a pricing/promo proposal to CSOA for ranking.","input":"DDPA_output_schema","side_effects":"advisory_write","approval_required_from":"CSOA"}
    ],
    "ILA": [
      {"name":"query_dc_stock","description":"Real-time stock at a distribution centre.","input":{"dc_id":"string","sku_id":"string?"},"side_effects":"read_only","approval_required_from":"self"},
      {"name":"query_vendor_eta","description":"Latest vendor ship-to-DC ETA.","input":{"vendor_id":"string","sku_id":"string"},"side_effects":"read_only","approval_required_from":"self"},
      {"name":"query_halal_chain","description":"JAKIM halal lot traceability check.","input":{"sku_lot_id":"string"},"side_effects":"read_only","approval_required_from":"self"},
      {"name":"book_route","description":"Commit a DC→site route. Triggers TMS booking.","input":"route_payload","side_effects":"commit_write","approval_required_from":"CSOA"},
      {"name":"search_memory","description":"Hybrid retrieval over the shared memory.","input":{"query":"string"},"side_effects":"read_only","approval_required_from":"self"},
      {"name":"propose_decision","description":"Submit a replenishment/routing plan.","input":"ILA_output_schema","side_effects":"advisory_write","approval_required_from":"CSOA"}
    ],
    "HCOA": [
      {"name":"query_roster","description":"Read current roster for a site/shift.","input":{"site_id":"string","date":"string","shift":"string"},"side_effects":"read_only","approval_required_from":"self"},
      {"name":"query_skills","description":"Skill matrix lookup for a staff member.","input":{"staff_id":"string"},"side_effects":"read_only","approval_required_from":"self"},
      {"name":"propose_shift_swap","description":"Propose a swap on the voluntary marketplace.","input":"shift_swap_payload","side_effects":"advisory_write","approval_required_from":"self"},
      {"name":"propose_overtime","description":"Request OT within Employment Act caps.","input":"overtime_payload","side_effects":"advisory_write","approval_required_from":"CSOA"},
      {"name":"book_contingent_labour","description":"Call up vetted contingent labour.","input":"contingent_payload","side_effects":"commit_write","approval_required_from":"CSOA"},
      {"name":"search_memory","description":"Hybrid retrieval over the shared memory.","input":{"query":"string"},"side_effects":"read_only","approval_required_from":"self"},
      {"name":"propose_decision","description":"Submit a workforce plan to CSOA.","input":"HCOA_output_schema","side_effects":"advisory_write","approval_required_from":"CSOA"}
    ],
    "FOA": [
      {"name":"query_iot","description":"IoT telemetry for chillers, HVAC, gensets, POS.","input":{"site_id":"string","asset_type":"string","metric":"string"},"side_effects":"read_only","approval_required_from":"self"},
      {"name":"schedule_maintenance","description":"Book a predictive maintenance window.","input":"maintenance_payload","side_effects":"commit_write","approval_required_from":"self"},
      {"name":"propose_peak_shift","description":"Plan a TNB ToU peak-shift across sites.","input":"peak_shift_payload","side_effects":"advisory_write","approval_required_from":"CSOA"},
      {"name":"mobilise_service_team","description":"Call out the service team after hours.","input":"mobilisation_payload","side_effects":"commit_write","approval_required_from":"CSOA"},
      {"name":"search_memory","description":"Hybrid retrieval over the shared memory.","input":{"query":"string"},"side_effects":"read_only","approval_required_from":"self"},
      {"name":"propose_decision","description":"Submit a facility action plan.","input":"FOA_output_schema","side_effects":"advisory_write","approval_required_from":"CSOA"}
    ],
    "SPPA": [
      {"name":"query_site_pnl","description":"Site-level P&L for a period.","input":{"site_id":"string","period":"string"},"side_effects":"read_only","approval_required_from":"self"},
      {"name":"query_catchment","description":"Demographic catchment around a site.","input":{"site_id":"string"},"side_effects":"read_only","approval_required_from":"self"},
      {"name":"query_competitor_openings","description":"Competitor opening pipeline by state.","input":{"state":"string"},"side_effects":"read_only","approval_required_from":"self"},
      {"name":"propose_tier_change","description":"Move a site between Over/On/Under tiers.","input":"tier_change_payload","side_effects":"commit_write","approval_required_from":"self"},
      {"name":"propose_closure_diligence","description":"Open a closure-diligence pack.","input":"closure_payload","side_effects":"advisory_write","approval_required_from":"human_ceo"},
      {"name":"propose_replication_diligence","description":"Open a top-decile replication pack.","input":"replication_payload","side_effects":"advisory_write","approval_required_from":"CSOA"},
      {"name":"search_memory","description":"Hybrid retrieval over the shared memory.","input":{"query":"string"},"side_effects":"read_only","approval_required_from":"self"},
      {"name":"propose_decision","description":"Submit a portfolio recommendation.","input":"SPPA_output_schema","side_effects":"advisory_write","approval_required_from":"CSOA"}
    ],
    "CSOA": [
      {"name":"compose_daily_decision_list","description":"Compose the 06:00 MYT Daily Decision List.","input":{"date":"string"},"side_effects":"commit_write","approval_required_from":"self"},
      {"name":"route_approval","description":"Route a CEO approval back to the originating agent.","input":{"decision_id":"string","recipient_agent":"string"},"side_effects":"commit_write","approval_required_from":"self"},
      {"name":"trigger_nightly_retraining","description":"Pull yesterday's outcomes and write back to each agent.","input":{"date":"string"},"side_effects":"commit_write","approval_required_from":"self"},
      {"name":"notify_chief_of_staff","description":"Push a digest to the chief of staff's channel.","input":{"channel":"string","payload":"object"},"side_effects":"external_action","approval_required_from":"self"},
      {"name":"search_memory","description":"Hybrid retrieval over the shared memory.","input":{"query":"string"},"side_effects":"read_only","approval_required_from":"self"}
    ]
  }
}
