Back to Blog
Engineering9 min read

Why Claude Hallucinates Your Electricity Rate (and How We Fixed It)

Paul Mangiamele
Paul Mangiamele
Co-Founder

Ask Claude what you pay per kilowatt-hour on PG&E. Go ahead. The answer will be wrong — and the scary part is it'll sound completely confident.


We built an MCP server with 28 domain-informed tools to fix this. Here's why it was harder than it sounds.


Nobody Knows What They Actually Pay


PG&E billing is extraordinarily complex. Your effective rate depends on your rate schedule, provider (bundled PG&E vs. Community Choice Aggregation), PCIA vintage year, NEM version, time-of-use period, and income tier. Rates change roughly twice a year, and CCA rates change independently.


The same kilowatt-hour costs 2-3x more during peak than off-peak. Most customers have no idea.


What Claude Gets Wrong


Without domain-specific tools, Claude makes specific, confident errors:


  • Hallucinated rates: It doesn't know that EV2-A winter off-peak is $0.20635 for a Peninsula Clean Energy 2016-vintage customer
  • Confused CCA vs. bundled billing: PG&E bills show delivery rates, not the total. The real formula is delivery + CCA generation + PCIA
  • Guessed NEM 3 export values: The Avoided Cost Calculator has 288 hourly values ranging from $0.025 to $0.28. Claude guesses "$0.08"
  • Wrong TOU windows: EV2-A peak is every day; E-TOU-D is weekdays only. Wrong windows means wrong math
  • Broken true-up math: NEM credits accumulate monthly and settle annually. The true-up IS the bill

  • These aren't edge cases. They're the core of every energy cost question a solar customer asks.


    Built from Personal Frustration


    This project started when I realized I had no idea what I was actually paying per kilowatt-hour — and neither did my solar installer. I read every PG&E tariff sheet, decoded the CCA billing structure, mapped the PCIA vintage system, and built the rate engine to make sure nobody else has to do the same detective work.


    How It Works


    Upload your PG&E data. Have a conversation about it. Get real answers.


  • Download your Green Button data (hourly usage) and latest bill from PG&E
  • Upload both to Claude
  • The tool detects your rate schedule, solar exports, provider, NEM version, PCIA vintage, and billing structure
  • 4. Ask any question about your energy costs


    The tool walks you through everything — rate plan comparison, usage profiling, true-up projection, battery optimization — personalized to your actual data.


    28 Tools, Four Layers


    Data Ingestion (5 tools)


    Parse every data format a PG&E solar customer might have:


  • Green Button hourly: PG&E interval data with TOU classification and solar export detection
  • Green Button billing: Monthly bill totals with true-up detection and year-over-year comparison
  • Tesla monthly export: Tesla app CSV with auto-detected MWh/kWh unit normalization
  • Tesla 5-min power: Granular power data with battery efficiency and cycle counting
  • Bill detail extraction: Validates rate schedule, provider, NEM version, vintage, and income tier against the rate engine

  • Analysis (8 tools)


  • Rate plan comparison: Annual cost across EV2-A, E-ELEC, E-TOU-C, E-TOU-D with TOU period breakdown
  • Usage profiling: Peak exposure, overnight baseload, seasonal patterns, worst import days
  • True-up projection: Monthly NEM balance accumulation and annual bill forecast
  • NEM 2 vs 3 comparison: Transition impact, credit loss by TOU period, worst months
  • Battery optimization: Mathematically optimal charge/discharge schedule using Pyomo MILP solver
  • System simulator: Model adding panels, batteries, or changing dispatch strategy
  • Seasonal strategy: Season-specific recommendations for TOU shifting and battery use
  • Solar forecast: Production forecast via Solcast API for planning

  • Powerwall Control (6 tools)


    If you have a Tesla Powerwall, the tool reads live status and controls your battery directly through the Tesla FleetAPI:


  • Live status: Real-time power flow, battery percentage, grid status
  • Set mode: Self-consumption, autonomous, or backup
  • Set reserve: Adjust backup reserve 0-100%
  • Grid charging: Enable or disable charging from the grid
  • Grid export: Battery+solar, solar only, or never

  • The Powerwall control layer came from wanting to actually act on the analysis — not just know the optimal dispatch schedule, but execute it.


    The Rate Engine: The Hard Part


    All rates are verified against PG&E tariff sheets. The engine encodes:


  • 4 rate schedules: EV2-A, E-ELEC, E-TOU-C, E-TOU-D with correct TOU windows
  • CCA vs. bundled: Provider rates — Peninsula Clean Energy fully supported, others in progress
  • 20+ PCIA vintages: $0.030-$0.054/kWh charge, or credit for 2025+
  • NEM 2.0: Full retail export credits
  • NEM 3.0: 288 hourly Avoided Cost Calculator values
  • Income tiers: Base service charges $0.20-$0.79/day

  • Getting a rate schedule comparison right means knowing that EV2-A peak is 4-9 PM every day, while E-TOU-D peak is 5-8 PM weekdays only. That single difference changes the math for every solar customer with a battery.


    Battery Optimization with Real Math


    The battery optimizer uses mixed-integer linear programming (Pyomo + CBC solver) because energy arbitrage with TOU rates, NEM credits, and reserve constraints is genuinely a hard optimization problem. This isn't a heuristic — it finds the mathematically optimal charge/discharge schedule given your actual rate plan, usage pattern, and battery constraints.


    Try It Live


    PG&E Energy MCP runs as a live server. Connect it to Claude:


  • Open claude.ai
  • Go to Settings > Connectors
  • Click "Add custom connector"
  • 4. Paste the server URL: https://pge-energy-mcp.up.railway.app/mcp


    Then upload your Green Button data and latest bill, and ask: "What are the best ways to optimize my energy costs?"


    The Design Philosophy


    Like our PocketScout MCP server, the design philosophy is the same: the gap in the MCP ecosystem isn't more API wrappers. It's domain expertise encoded into tool design — the rate engine that knows your exact per-kWh cost for every hour of the day, the battery optimizer that understands NEM credits accumulate monthly and settle annually.


    The best tools don't just expose APIs. They encode domain knowledge into the interface between human intent and machine capability.




    PG&E Energy MCP is open source. View on GitHub or connect it to Claude right now.

    Share this article
    More articles
    Proprius Labs - AI-First Personal Identity Infrastructure