Skip to main content
Glama

Get price distribution for a billing code

get_code_price_distribution
Read-only

Returns the distribution of every hospital's price for a code_type/code, computed server-side: min/p10/q1/median/q3/p90/max, standard deviation, a histogram, and the real hospital nearest each percentile. Use this instead of paging through list_hospital_code_costs when you want to know how prices spread across hospitals (e.g. "is $12k high for MS-DRG 788?" - pass reference_price to get the number of hospitals priced below it). All figures are in terms of the chosen statistic (default: each hospital's average price).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes
bin_countNoNumber of histogram bars. Defaults to 16, capped at 200 (larger values are rejected).
code_typeYesCode system the billing code belongs to, e.g. APR-DRG, CDM, CPT, HCPCS, MS-DRG, RC.
statisticNoWhich per-hospital figure to distribute: each hospital's average (default), median, lowest filed price, or highest filed price.
methodologyNoPricing methodology. Omit to aggregate across all methodologies.
reference_priceNoOptional price to place on the distribution. When positive, hospitals_below_reference counts hospitals priced strictly below it. Negative values are rejected.
min_sample_countNoMinimum pricing sample size: only include hospitals whose price is backed by at least this many billing records (same semantics as list_hospital_code_costs). 0 (default) disables the filter. Negative values are rejected.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
q1No25th percentile.
q3No75th percentile.
maxNo
minNo
p10No
p90No
meanNoMean across hospitals of the request's statistic (a national average). 0 when hospital_count is 0.
medianNo
std_devNoPopulation standard deviation of the per-hospital values.
q1_hospitalNoA real hospital and its price for the code, used to name a hospital at a percentile. Unset (absent or empty hospital_id) when hospital_count is 0.
q3_hospitalNoA real hospital and its price for the code, used to name a hospital at a percentile. Unset (absent or empty hospital_id) when hospital_count is 0.
histogram_hiNoUpper edge of the last bar: min(max, 1.35 * p90), or min + 1 when that is not above the minimum. Hospitals priced above this are counted in overflow_count.
histogram_loNoLower edge of the first histogram bar (the minimum).
max_hospitalNoA real hospital and its price for the code, used to name a hospital at a percentile. Unset (absent or empty hospital_id) when hospital_count is 0.
min_hospitalNoA real hospital and its price for the code, used to name a hospital at a percentile. Unset (absent or empty hospital_id) when hospital_count is 0.
p10_hospitalNoA real hospital and its price for the code, used to name a hospital at a percentile. Unset (absent or empty hospital_id) when hospital_count is 0.
p90_hospitalNoA real hospital and its price for the code, used to name a hospital at a percentile. Unset (absent or empty hospital_id) when hospital_count is 0.
mean_hospitalNoA real hospital and its price for the code, used to name a hospital at a percentile. Unset (absent or empty hospital_id) when hospital_count is 0.
histogram_binsNoHospital count per equal-width bar from histogram_lo to histogram_hi; the last bar includes its upper edge.
hospital_countNoHospitals with a positive value for the code on their latest revision (and at least min_sample_count samples, if set). 0 means every other field is unset.
overflow_countNoHospitals priced above histogram_hi.
median_hospitalNoA real hospital and its price for the code, used to name a hospital at a percentile. Unset (absent or empty hospital_id) when hospital_count is 0.
hospitals_below_referenceNoHospitals priced strictly below the request's reference_price; 0 when it was not set.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedOutput schema / properties / mean
      Added value: +{
      +  "description": "Mean across hospitals of the request's statistic (a national average). 0 when hospital_count is 0.",
      +  "type": "number"
      +}
    • addedOutput schema / properties / mean_hospital
      Added value: +{
      +  "description": "A real hospital and its price for the code, used to name a hospital at a percentile. Unset (absent or empty hospital_id) when hospital_count is 0.",
      +  "properties": {
      +    "hospital_id": {
      +      "description": "Opaque handle - pass back as hospital_id to other tools.",
      +      "type": "string"
      +    },
      +    "hospital_name": {
      +      "type": "string"
      +    },
      +    "location": {
      +      "type": "string"
      +    },
      +    "price": {
      +      "description": "This hospital's value of the requested statistic.",
      +      "type": "number"
      +    }
      +  },
      +  "type": [
      +    "object",
      +    "null"
      +  ]
      +}
  2. Added

TDQS

Score is being calculated.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.