Skip to main content
Glama

Gas Prices API - US Gasoline & Diesel by State, Weekly History

us_gas_prices_api
Read-onlyIdempotent

Official US gas prices as JSON, no API key: weekly retail regular, midgrade, premium gasoline and diesel prices (USD/gallon) for the US, 10 PADD regions, 9 states and 10 cities from the EIA survey, with week-over-week and year-over-year change, 52-week high/low, history since 1990 (weekly, monthly or yearly averages) and a trip fuel cost calculator. Monitor mode returns only new weeks. Usable from AI agents via MCP. Free: 5 calls/day per IP. Paid: Radar API key (from €9/mo at https://radarbg.com/pricing#starter via X-API-Key) or $0.02/call via x402 at https://radarbg.com/x402/us-gas-prices-api.

Example tool call

This call uses example arguments supplied in the tool’s input schema.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "mode": "latest",
      "sort": "area",
      "areas": [
        "US",
        "CA",
        "TX",
        "NYC"
      ],
      "fuels": [
        "regular",
        "diesel"
      ]
    },
    "name": "us_gas_prices_api"
  }
}

Input Schema

NameRequiredDescriptionDefault
mpgNotrip mode: vehicle fuel economy in US mpg. Default 25 when litersPer100km is also empty.
modeNolatest = newest weekly price per area and fuel with weekly/yearly change and 52-week high/low; history = price series between startDate and endDate (weekly, or monthly/yearly averages); trip = fuel cost of a trip from distance and fuel econ
sortNolatest mode: area order (default), cheapest first, most expensive first, or biggest weekly rise first.
areasNoUS, PADD1..PADD5 (East Coast, Midwest, Gulf Coast, Rocky Mountain, West Coast), PADD1A/1B/1C, PADD5XCA, states CA CO FL MA MN NY OH TX WA, cities BOS CHI CLE DEN HOU LAX MIA NYC SFO SEA, or names like 'California' / 'New York City'. 'all' =
fuelsNoregular, midgrade, premium, allGrades, diesel ('all' = every fuel). Empty = regular + diesel for latest, regular for history and trip. Diesel is published for US, PADD regions, CA and PADD5XCA.
limitNoMaximum rows returned (1-20000). Default 1000.
endDateNohistory mode: last week, YYYY-MM-DD. Default latest.
intervalNohistory mode: weekly survey values, or monthly / yearly averages of the weekly values.
startDateNohistory mode: first week, YYYY-MM-DD (or YYYY / YYYY-MM). Default one year ago. Gasoline from 1990/1994, diesel from 1994.
distanceKmNotrip mode: trip distance in kilometers (used when distanceMiles is empty).
distanceMilesNotrip mode: trip distance in miles (or use distanceKm).
litersPer100kmNotrip mode: fuel economy in L/100 km (used when mpg is empty).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already declare readOnly/openWorld/idempotent, so safety is covered. The description goes further and discloses the true operational traits: free tier capped at 5 calls/day per IP, paid access via X-API-Key, and a $0.02/call x402 path with a pricing URL — exactly the kind of rate-limit/auth context annotations can't express. Slightly less than 5 because it never says what an agent sees when the 5/day cap is hit.

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

Conciseness4/5

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

Front-loaded with the core value proposition, then mode behavior, then access/pricing. The opening sentence is very dense with parenthetical lists, but every clause (fuels, coverage tiers, change metrics, history range, calculator) maps to an actual capability, so nothing is wasted.

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

Completeness4/5

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

For a 12-param, zero-required tool with no output schema, the description covers the data returned (weekly prices in USD/gallon, WoW/YoY change, 52-week high/low, 1990+ history), the mode set, and access constraints. The remaining gap is response shape/pagination detail (e.g., how 'limit' interacts with the result envelope), which matters more here since no output schema exists.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so all 12 parameters are already documented in the schema, including generous mode/areas/fuels detail. The description adds little parameter-specific meaning beyond echoing the feature set (which loosely supports the 'sort' by weekly change). Baseline 3 is appropriate when the schema carries the semantics.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb+resource+scope: official US weekly retail gasoline/diesel prices from the EIA survey, with named coverage (US, 10 PADD regions, 9 states, 10 cities), change metrics, history since 1990, and a trip cost calculator. The US geographic scope implicitly and cleanly separates it from the sibling europe_fuel_prices, so an agent can route without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives clear use context: three modes (latest/history/trip) implied by the feature list, and 'Monitor mode returns only new weeks' tells a polling agent when this is the right call. It does not explicitly state when NOT to use it or name an alternative tool, so it falls short of a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources