Skip to main content
Glama

List billing codes for a code type

list_codes
Read-only

Returns every distinct code catalogued under a given code_type, paginated, with each code's raw chargemaster description and the number of hospitals reporting it. Use this to discover which codes exist under a code system (e.g. all CPT codes) before looking up prices with get_hospital_chargemaster_cost or list_hospital_code_costs. Pass query to text-search codes/descriptions instead of listing a whole code_type. Pass hospital_id to restrict results to codes that one hospital actually reports.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "list_codes"
  }
}

Input Schema

NameRequiredDescriptionDefault
sortNoOrdering for the returned codes. CODE_SORT_UNSPECIFIED (default) sorts code-alphabetical. CODE_SORT_HOSPITAL_COUNT_DESC sorts most-hospitals-reporting first, for pre-sorted 'top codes' pages. CODE_SORT_SAMPLE_COUNT_DESC sorts by largest network-wide pricing sample size first (sample_count_max, always network-wide regardless of hospital_id) - ranks by how many billing records actually back a code's pricing, rather than by how many hospitals merely report it. CODE_SORT_CODE_DESC is code-alphabetical, reverse order. CODE_SORT_RELEVANCE ranks best text match first (exact code, then code prefix, then description word-start, then description substring), ties broken by network-wide sample count descending, and is only meaningful - and the default - when query is set; without a query it behaves like CODE_SORT_SAMPLE_COUNT_DESC. CODE_SORT_HOSPITAL_COUNT_ASC / CODE_SORT_SAMPLE_COUNT_ASC surface rare codes (fewest hospitals / smallest network-wide sample first; zero counts sort last). CODE_SORT_MEDIAN_PRICE_DESC/ASC order by the network-wide median price (CodeSummary.median_price) and CODE_SORT_PRICE_SPREAD_DESC by the widest hospital-to-hospital spread (price_spread); codes with no price sort last in every price order. Price figures are network-wide even when hospital_id is set, and blend billing classes, methodologies and settings.
queryNoCase-insensitive text search: matches the code as a prefix, and substrings of the raw and AI-generated descriptions. Descriptions are only searched for queries of 4+ characters; shorter queries match the code prefix only. When set, code_type may be left empty to search across code types.
code_typeNoCode system to list codes for, e.g. "CPT". From list_code_types. May be left empty when query is set, to search across code types (excluding hospital-specific CDM and LOCAL codes) - CodeSummary.code_type tells the hits apart in that case.
page_sizeNoMaximum number of results to return. Defaults to 500, capped at 500.
page_tokenNoOpaque token from a previous list_codes response. Omit for the first page. Only valid with the same query/code_type/sort it was issued for.
hospital_idNoOptional hospital scoping (a hospital_id from list_hospitals): restricts results to codes that hospital actually reports on its latest revision, and makes sample_count_min/max/exact that hospital's own sample size for the code rather than the network-wide total. Unset (default) is network-wide. page_token is only valid with the same hospital_id it was issued for, same as query/code_type/sort.

Output Schema

NameRequiredDescriptionDefault
codesNo
total_countNoTotal number of matching codes across all pages.
next_page_tokenNoOpaque pagination token, empty when there are no more results.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changed
    • changedInput schema / properties / sort / description
      Previous value: -"Ordering for the returned codes. CODE_SORT_UNSPECIFIED (default) sorts code-alphabetical. CODE_SORT_HOSPITAL_COUNT_DESC sorts most-hospitals-reporting first, for pre-sorted 'top codes' pages. CODE_SORT_SAMPLE_COUNT_DESC sorts by largest network-wide pricing sample size first (sample_count_max, always network-wide regardless of hospital_id) - ranks by how many billing records actually back a code's pricing, rather than by how many hospitals merely report it. CODE_SORT_CODE_DESC is code-alphabetical, reverse order. CODE_SORT_RELEVANCE ranks best text match first (exact code, then code prefix, then description word-start, then description substring), ties broken by network-wide sample count descending, and is only meaningful - and the default - when query is set; without a query it behaves like CODE_SORT_SAMPLE_COUNT_DESC."New value: +"Ordering for the returned codes. CODE_SORT_UNSPECIFIED (default) sorts code-alphabetical. CODE_SORT_HOSPITAL_COUNT_DESC sorts most-hospitals-reporting first, for pre-sorted 'top codes' pages. CODE_SORT_SAMPLE_COUNT_DESC sorts by largest network-wide pricing sample size first (sample_count_max, always network-wide regardless of hospital_id) - ranks by how many billing records actually back a code's pricing, rather than by how many hospitals merely report it. CODE_SORT_CODE_DESC is code-alphabetical, reverse order. CODE_SORT_RELEVANCE ranks best text match first (exact code, then code prefix, then description word-start, then description substring), ties broken by network-wide sample count descending, and is only meaningful - and the default - when query is set; without a query it behaves like CODE_SORT_SAMPLE_COUNT_DESC. CODE_SORT_HOSPITAL_COUNT_ASC / CODE_SORT_SAMPLE_COUNT_ASC surface rare codes (fewest hospitals / smallest network-wide sample first; zero counts sort last). CODE_SORT_MEDIAN_PRICE_DESC/ASC order by the network-wide median price (CodeSummary.median_price) and CODE_SORT_PRICE_SPREAD_DESC by the widest hospital-to-hospital spread (price_spread); codes with no price sort last in every price order. Price figures are network-wide even when hospital_id is set, and blend billing classes, methodologies and settings."
    • changedInput schema / properties / sort / enum
      Previous value: -[
      -  "CODE_SORT_UNSPECIFIED",
      -  "CODE_SORT_HOSPITAL_COUNT_DESC",
      -  "CODE_SORT_SAMPLE_COUNT_DESC",
      -  "CODE_SORT_CODE_DESC",
      -  "CODE_SORT_RELEVANCE"
      -]New value: +[
      +  "CODE_SORT_UNSPECIFIED",
      +  "CODE_SORT_HOSPITAL_COUNT_DESC",
      +  "CODE_SORT_SAMPLE_COUNT_DESC",
      +  "CODE_SORT_CODE_DESC",
      +  "CODE_SORT_RELEVANCE",
      +  "CODE_SORT_HOSPITAL_COUNT_ASC",
      +  "CODE_SORT_SAMPLE_COUNT_ASC",
      +  "CODE_SORT_MEDIAN_PRICE_DESC",
      +  "CODE_SORT_MEDIAN_PRICE_ASC",
      +  "CODE_SORT_PRICE_SPREAD_DESC"
      +]
    • addedOutput schema / properties / codes / items / properties / median_price
      Added value: +{
      +  "description": "Network-wide price: the median of the hospitals' average prices for this code, taken over all billing classes, methodologies and settings (so facility and professional fees are blended). Unset when no hospital has a positive average price. Always network-wide, even when hospital_id is set.",
      +  "type": "number"
      +}
    • addedOutput schema / properties / codes / items / properties / price_spread
      Added value: +{
      +  "description": "p90 / p10 of the hospitals' average prices for this code. Unset when median_price is.",
      +  "type": "number"
      +}
    • addedOutput schema / properties / codes / items / properties / priced_at
      Added value: +{
      +  "description": "When the snapshot the price figures come from was published (protobuf Timestamp: seconds, nanos); recomputed with each snapshot.",
      +  "properties": {
      +    "nanos": {
      +      "type": "integer"
      +    },
      +    "seconds": {
      +      "type": "string"
      +    }
      +  },
      +  "type": "object"
      +}
    • addedOutput schema / properties / codes / items / properties / priced_hospital_count
      Added value: +{
      +  "description": "Hospitals with a positive average price behind median_price and price_spread.",
      +  "type": "integer"
      +}
  2. Changed3 schema fields changed
    • changedInput schema / properties / query / description
      Previous value: -"Case-insensitive text search: matches the code as a prefix, and substrings of the raw and friendly descriptions. Descriptions are only searched for queries of 4+ characters; shorter queries match the code prefix only. When set, code_type may be left empty to search across code types."New value: +"Case-insensitive text search: matches the code as a prefix, and substrings of the raw and AI-generated descriptions. Descriptions are only searched for queries of 4+ characters; shorter queries match the code prefix only. When set, code_type may be left empty to search across code types."
    • addedOutput schema / properties / codes / items / properties / ai_description
      Added value: +{
      +  "description": "LLM-normalized, human-readable description. Empty when not yet backfilled - fall back to raw_description.",
      +  "type": "string"
      +}
    • removedOutput schema / properties / codes / items / properties / friendly_description
      Removed value: -{
      -  "description": "LLM-normalized, human-readable description. Empty when not yet backfilled - fall back to raw_description.",
      -  "type": "string"
      -}
  3. Changed4 schema fields changed
    • changedOutput schema / properties / codes / items / properties / sample_count_max / description
      Previous value: -"Upper bound on the CMS sample-remittance count, same network-wide-vs-hospital-scoped convention as sample_count_min. Equal to sample_count_min unless a de-identified '1 through 10' row narrowed it to a range."New value: +"Upper bound on the CMS sample-remittance count, as a decimal string (int64 - see protoLoaderOptions.longs), same network-wide-vs-hospital-scoped convention as sample_count_min. Equal to sample_count_min unless a de-identified '1 through 10' row narrowed it to a range."
    • changedOutput schema / properties / codes / items / properties / sample_count_max / type
      Previous value: -"integer"New value: +"string"
    • changedOutput schema / properties / codes / items / properties / sample_count_min / description
      Previous value: -"Lower bound on the CMS sample-remittance count. By default (no hospital_id in the request) this sums every reporting hospital's contributing payer rows, network-wide; when the request scopes to a hospital_id, it's that one hospital's own sample count for this code instead. Equal to sample_count_max unless a de-identified '1 through 10' row narrowed it to a range."New value: +"Lower bound on the CMS sample-remittance count, as a decimal string (int64 - see protoLoaderOptions.longs). By default (no hospital_id in the request) this sums every reporting hospital's contributing payer rows, network-wide; when the request scopes to a hospital_id, it's that one hospital's own sample count for this code instead. Equal to sample_count_max unless a de-identified '1 through 10' row narrowed it to a range."
    • changedOutput schema / properties / codes / items / properties / sample_count_min / type
      Previous value: -"integer"New value: +"string"
  4. Changed15 schema fields changed
    • changedInput schema / properties / code_type / description
      Previous value: -"Code system to list codes for, e.g. \"CPT\". From list_code_types."New value: +"Code system to list codes for, e.g. \"CPT\". From list_code_types. May be left empty when query is set, to search across code types (excluding hospital-specific CDM and LOCAL codes) - CodeSummary.code_type tells the hits apart in that case."
    • addedInput schema / properties / hospital_id
      Added value: +{
      +  "description": "Optional hospital scoping (a hospital_id from list_hospitals): restricts results to codes that hospital actually reports on its latest revision, and makes sample_count_min/max/exact that hospital's own sample size for the code rather than the network-wide total. Unset (default) is network-wide. page_token is only valid with the same hospital_id it was issued for, same as query/code_type/sort.",
      +  "type": "string"
      +}
    • changedInput schema / properties / page_token / description
      Previous value: -"Opaque token from a previous list_codes response. Omit for the first page."New value: +"Opaque token from a previous list_codes response. Omit for the first page. Only valid with the same query/code_type/sort it was issued for."
    • addedInput schema / properties / query
      Added value: +{
      +  "description": "Case-insensitive text search: matches the code as a prefix, and substrings of the raw and friendly descriptions. Descriptions are only searched for queries of 4+ characters; shorter queries match the code prefix only. When set, code_type may be left empty to search across code types.",
      +  "type": "string"
      +}
    • changedInput schema / properties / sort / description
      Previous value: -"Ordering for the returned codes. CODE_SORT_UNSPECIFIED (default) sorts code-alphabetical. CODE_SORT_HOSPITAL_COUNT_DESC sorts most-hospitals-reporting first, for pre-sorted 'top codes' pages. CODE_SORT_SAMPLE_COUNT_DESC sorts by largest pricing sample size first (total_sample_count_max) - ranks by how many billing records actually back a code's pricing, rather than by how many hospitals merely report it. CODE_SORT_CODE_DESC is code-alphabetical, reverse order."New value: +"Ordering for the returned codes. CODE_SORT_UNSPECIFIED (default) sorts code-alphabetical. CODE_SORT_HOSPITAL_COUNT_DESC sorts most-hospitals-reporting first, for pre-sorted 'top codes' pages. CODE_SORT_SAMPLE_COUNT_DESC sorts by largest network-wide pricing sample size first (sample_count_max, always network-wide regardless of hospital_id) - ranks by how many billing records actually back a code's pricing, rather than by how many hospitals merely report it. CODE_SORT_CODE_DESC is code-alphabetical, reverse order. CODE_SORT_RELEVANCE ranks best text match first (exact code, then code prefix, then description word-start, then description substring), ties broken by network-wide sample count descending, and is only meaningful - and the default - when query is set; without a query it behaves like CODE_SORT_SAMPLE_COUNT_DESC."
    • changedInput schema / properties / sort / enum
      Previous value: -[
      -  "CODE_SORT_UNSPECIFIED",
      -  "CODE_SORT_HOSPITAL_COUNT_DESC",
      -  "CODE_SORT_SAMPLE_COUNT_DESC",
      -  "CODE_SORT_CODE_DESC"
      -]New value: +[
      +  "CODE_SORT_UNSPECIFIED",
      +  "CODE_SORT_HOSPITAL_COUNT_DESC",
      +  "CODE_SORT_SAMPLE_COUNT_DESC",
      +  "CODE_SORT_CODE_DESC",
      +  "CODE_SORT_RELEVANCE"
      +]
    • changedInput schema / required
      Previous value: -[
      -  "code_type"
      -]New value: +[]
    • addedOutput schema / properties / codes / items / properties / code_type
      Added value: +{
      +  "description": "This code's type, e.g. \"CPT\". Always set - distinguishes hits when query was searched across code types (code_type left empty in the request).",
      +  "type": "string"
      +}
    • addedOutput schema / properties / codes / items / properties / friendly_description
      Added value: +{
      +  "description": "LLM-normalized, human-readable description. Empty when not yet backfilled - fall back to raw_description.",
      +  "type": "string"
      +}
    • addedOutput schema / properties / codes / items / properties / sample_count_exact
      Added value: +{
      +  "description": "True iff sample_count_min == sample_count_max, i.e. no contributing row was a de-identified '1 through 10' range.",
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / codes / items / properties / sample_count_max
      Added value: +{
      +  "description": "Upper bound on the CMS sample-remittance count, same network-wide-vs-hospital-scoped convention as sample_count_min. Equal to sample_count_min unless a de-identified '1 through 10' row narrowed it to a range.",
      +  "type": "integer"
      +}
    • addedOutput schema / properties / codes / items / properties / sample_count_min
      Added value: +{
      +  "description": "Lower bound on the CMS sample-remittance count. By default (no hospital_id in the request) this sums every reporting hospital's contributing payer rows, network-wide; when the request scopes to a hospital_id, it's that one hospital's own sample count for this code instead. Equal to sample_count_max unless a de-identified '1 through 10' row narrowed it to a range.",
      +  "type": "integer"
      +}
    • removedOutput schema / properties / codes / items / properties / total_sample_count_exact
      Removed value: -{
      -  "description": "True iff total_sample_count_min == total_sample_count_max, i.e. no contributing hospital's sample_count was a de-identified '1 through 10' range.",
      -  "type": "boolean"
      -}
    • removedOutput schema / properties / codes / items / properties / total_sample_count_max
      Removed value: -{
      -  "description": "Upper bound on the summed CMS sample-remittance count across every reporting hospital's contributing payer rows. Equal to total_sample_count_min unless a de-identified '1 through 10' row narrowed it to a range.",
      -  "type": "integer"
      -}
    • removedOutput schema / properties / codes / items / properties / total_sample_count_min
      Removed value: -{
      -  "description": "Lower bound on the summed CMS sample-remittance count across every reporting hospital's contributing payer rows. Equal to total_sample_count_max unless a de-identified '1 through 10' row narrowed it to a range.",
      -  "type": "integer"
      -}
  5. Changed5 schema fields changed
    • changedInput schema / properties / sort / description
      Previous value: -"Ordering for the returned codes. CODE_SORT_UNSPECIFIED (default) sorts code-alphabetical. CODE_SORT_HOSPITAL_COUNT_DESC sorts most-hospitals-reporting first, for pre-sorted 'top codes' pages."New value: +"Ordering for the returned codes. CODE_SORT_UNSPECIFIED (default) sorts code-alphabetical. CODE_SORT_HOSPITAL_COUNT_DESC sorts most-hospitals-reporting first, for pre-sorted 'top codes' pages. CODE_SORT_SAMPLE_COUNT_DESC sorts by largest pricing sample size first (total_sample_count_max) - ranks by how many billing records actually back a code's pricing, rather than by how many hospitals merely report it. CODE_SORT_CODE_DESC is code-alphabetical, reverse order."
    • changedInput schema / properties / sort / enum
      Previous value: -[
      -  "CODE_SORT_UNSPECIFIED",
      -  "CODE_SORT_HOSPITAL_COUNT_DESC"
      -]New value: +[
      +  "CODE_SORT_UNSPECIFIED",
      +  "CODE_SORT_HOSPITAL_COUNT_DESC",
      +  "CODE_SORT_SAMPLE_COUNT_DESC",
      +  "CODE_SORT_CODE_DESC"
      +]
    • addedOutput schema / properties / codes / items / properties / total_sample_count_exact
      Added value: +{
      +  "description": "True iff total_sample_count_min == total_sample_count_max, i.e. no contributing hospital's sample_count was a de-identified '1 through 10' range.",
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / codes / items / properties / total_sample_count_max
      Added value: +{
      +  "description": "Upper bound on the summed CMS sample-remittance count across every reporting hospital's contributing payer rows. Equal to total_sample_count_min unless a de-identified '1 through 10' row narrowed it to a range.",
      +  "type": "integer"
      +}
    • addedOutput schema / properties / codes / items / properties / total_sample_count_min
      Added value: +{
      +  "description": "Lower bound on the summed CMS sample-remittance count across every reporting hospital's contributing payer rows. Equal to total_sample_count_max unless a de-identified '1 through 10' row narrowed it to a range.",
      +  "type": "integer"
      +}
  6. Changed1 schema field changed
    • addedInput schema / properties / sort
      Added value: +{
      +  "description": "Ordering for the returned codes. CODE_SORT_UNSPECIFIED (default) sorts code-alphabetical. CODE_SORT_HOSPITAL_COUNT_DESC sorts most-hospitals-reporting first, for pre-sorted 'top codes' pages.",
      +  "enum": [
      +    "CODE_SORT_UNSPECIFIED",
      +    "CODE_SORT_HOSPITAL_COUNT_DESC"
      +  ],
      +  "type": "string"
      +}
  7. Added

TDQS

A4.7/5.0
Behavior4/5

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

Annotations already certify readOnly/destructive=false and a closed world, so the safety profile is covered. The description adds genuinely useful behavior beyond that: it returns distinct codes with descriptions and hospital counts, results are paginated, and hospital_id changes scoping semantics for the whole result set. It stops short of discussing result-size limits or failure modes, which are left to the schema.

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

Conciseness5/5

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

Four sentences, each doing distinct work: what it returns, why to call it, when to prefer query, when to scope by hospital_id. The highest-value information (return contents and purpose) is front-loaded with no filler or restated title.

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

Completeness5/5

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

The tool has an output schema, so return-field documentation is not required, yet the description still names the key fields an agent will reason about. With annotations covering safety and a fully documented schema, an agent has everything needed to select and invoke this tool correctly.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, but the description adds cross-parameter meaning the schema cannot convey: query may be used in place of code_type to search across systems, and hospital_id narrows results to codes that hospital actually reports. This clarifies intent for the most ambiguous parameters rather than restating their text.

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 and resource ('Returns every distinct code catalogued under a given code_type') plus the payload (raw chargemaster description, hospital reporting count) and pagination. It also distinguishes itself from sibling lookup tools by name, so an agent can separate discovery from pricing retrieval without opening schemas.

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

Usage Guidelines5/5

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

Gives explicit when-to-use ('discover which codes exist under a code system ... before looking up prices') and names the downstream alternatives get_hospital_chargemaster_cost and list_hospital_code_costs. It also states two mode switches: use query instead of listing a whole code_type, and use hospital_id to restrict to one hospital's reported codes.

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.