Skip to main content
Glama

Check Medical Code

medcode_check_code
Read-onlyIdempotent

Validate whether a US medical code exists, is current, and is billable in the active bundled release. Returns a discriminated status — valid_billable, valid_not_billable, valid_header, valid, or terminated — with a whyNot explaining non-billable and terminated cases (e.g. "valid ICD-10-CM category but not billable — submit a more specific child code"). A HCPCS code is terminated once its last valid date has passed; before then it checks as billable, with that date in whyNot. This is the detail a coder needs before submitting a claim. RxNorm has no billing concept, so a current RxNorm concept is valid with billable: null and no billing verdict. Auto-detects the system from the code's shape, and a code written in ICD-10-CM dotted form (A01.00) resolves to ICD-10-CM; pass an explicit system to disambiguate. A non-billable or terminated code is a successful result with a whyNot, not an error — only a code absent from the named system, or with no system from every bundled system, raises unknown_code, which names the other bundled system that holds the code, or every system the code's shape fits. A dotted all-digit value in ICD-9-CM form (250.00) is never read as an RXCUI, and its miss says ICD-9-CM is not bundled; an ICD-10-PCS section value from medcode_browse_hierarchy (0) checked under system ICD10PCS is named as a section, not a code. A code string that also exists in another bundled system carries alsoInSystems naming it, since the verdict applies only to the system that answered.

Input Schema

NameRequiredDescriptionDefault
codeYesThe code to validate, with or without dots. Must not be blank or whitespace-only.
systemNoForce the lookup into this system. Omit to auto-detect from the code's shape.

Output Schema

NameRequiredDescriptionDefault
codeNoThe code in display form (ICD-10-CM carries the dot).
errorNoPresent when the call failed. Absent on success.
statusNoValidity status. valid_billable = submit as-is; valid_header/valid_not_billable = needs a more specific code; valid = exists and is current in a system with no billing concept (RxNorm), so there is no billing verdict; terminated = retired — its last valid date has passed.
systemNoThe system the code was resolved in, echoed for chaining.
whyNotNoExplanation for non-billable/terminated statuses. On valid_billable, null unless the code is scheduled for termination, when it names the last date the code may be used. Null when valid.
billableNoTrue only when status is valid_billable. Null when status is valid — the system has no billing concept.
alsoInSystemsNoOther bundled systems holding this same code string, present only when there is at least one. The verdict above is for the system this code resolved in; the code is a DIFFERENT code in each system listed here, with its own billability — "B00" is the ICD-10-CM category "Herpesviral [herpes simplex] infections" and also the ICD-10-PCS table row "Imaging, Central Nervous System, Plain Radiography". Re-call with `system` set to one of these values to validate it there.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • changedOutput schema / properties / error / properties / data / properties / reason / description
      Previous value: -"Machine-readable failure mode. Declared by this tool: `unknown_code`: The code does not exist in the named or detected system. `ambiguous_system`: The code is present in more than one bundled system and no `system` was given. Other values are possible when a failure originates below the handler."New value: +"Machine-readable failure mode. Declared by this tool: `unknown_code`: The code does not exist in the named system, or with no `system` in any bundled system. `ambiguous_system`: The code is present in more than one bundled system and no `system` was given. Other values are possible when a failure originates below the handler."
    • changedOutput schema / properties / status / description
      Previous value: -"Validity status. valid_billable = submit as-is; valid_header/valid_not_billable = needs a more specific code; valid = exists and is current in a system with no billing concept (RxNorm), so there is no billing verdict; terminated = retired."New value: +"Validity status. valid_billable = submit as-is; valid_header/valid_not_billable = needs a more specific code; valid = exists and is current in a system with no billing concept (RxNorm), so there is no billing verdict; terminated = retired — its last valid date has passed."
    • changedOutput schema / properties / whyNot / description
      Previous value: -"Explanation for non-billable/terminated statuses, or null when valid_billable or valid."New value: +"Explanation for non-billable/terminated statuses. On valid_billable, null unless the code is scheduled for termination, when it names the last date the code may be used. Null when valid."
  2. Changed5 schema fields changed
    • changedOutput schema / properties / billable / description
      Previous value: -"True only when status is valid_billable."New value: +"True only when status is valid_billable. Null when status is valid — the system has no billing concept."
    • changedOutput schema / properties / billable / type
      Previous value: -"boolean"New value: +[
      +  "boolean",
      +  "null"
      +]
    • changedOutput schema / properties / status / description
      Previous value: -"Validity status. valid_billable = submit as-is; valid_header/valid_not_billable = needs a more specific code; terminated = retired."New value: +"Validity status. valid_billable = submit as-is; valid_header/valid_not_billable = needs a more specific code; valid = exists and is current in a system with no billing concept (RxNorm), so there is no billing verdict; terminated = retired."
    • changedOutput schema / properties / status / enum
      Previous value: -[
      -  "valid_billable",
      -  "valid_not_billable",
      -  "valid_header",
      -  "terminated"
      -]New value: +[
      +  "valid_billable",
      +  "valid_not_billable",
      +  "valid_header",
      +  "valid",
      +  "terminated"
      +]
    • changedOutput schema / properties / whyNot / description
      Previous value: -"Explanation for non-billable/terminated statuses, or null when valid_billable."New value: +"Explanation for non-billable/terminated statuses, or null when valid_billable or valid."
  3. Changed2 schema fields changed
    • removedOutput schema / properties / whyNot / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / whyNot / type
      Added value: +[
      +  "string",
      +  "null"
      +]
  4. Changed6 schema fields changed
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • addedInput schema / additionalProperties
      Added value: +false
    • changedOutput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • addedOutput schema / anyOf
      Added value: +[
      +  {
      +    "not": {
      +      "required": [
      +        "error"
      +      ]
      +    },
      +    "required": [
      +      "system",
      +      "code",
      +      "status",
      +      "billable",
      +      "whyNot"
      +    ]
      +  },
      +  {
      +    "required": [
      +      "error"
      +    ]
      +  }
      +]
    • addedOutput schema / properties / error
      Added value: +{
      +  "additionalProperties": {},
      +  "description": "Present when the call failed. Absent on success.",
      +  "properties": {
      +    "code": {
      +      "description": "JSON-RPC error code for this failure.",
      +      "maximum": 9007199254740991,
      +      "minimum": -9007199254740991,
      +      "type": "integer"
      +    },
      +    "data": {
      +      "additionalProperties": {},
      +      "properties": {
      +        "reason": {
      +          "description": "Machine-readable failure mode. Declared by this tool: `unknown_code`: The code does not exist in the named or detected system. `ambiguous_system`: The code is present in more than one bundled system and no `system` was given. Other values are possible when a failure originates below the handler.",
      +          "examples": [
      +            "unknown_code",
      +            "ambiguous_system"
      +          ],
      +          "type": "string"
      +        },
      +        "recovery": {
      +          "additionalProperties": {},
      +          "description": "Actionable next step for the caller.",
      +          "properties": {
      +            "hint": {
      +              "type": "string"
      +            }
      +          },
      +          "required": [
      +            "hint"
      +          ],
      +          "type": "object"
      +        },
      +        "retryable": {
      +          "description": "Whether retrying may succeed.",
      +          "type": "boolean"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "message": {
      +      "description": "Human-readable description of what went wrong.",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "code",
      +    "message"
      +  ],
      +  "type": "object"
      +}
    • removedOutput schema / required
      Removed value: -[
      -  "system",
      -  "code",
      -  "status",
      -  "billable",
      -  "whyNot"
      -]
  5. Changed1 schema field changed
    • addedOutput schema / properties / alsoInSystems
      Added value: +{
      +  "description": "Other bundled systems holding this same code string, present only when there is at least one. The verdict above is for the system this code resolved in; the code is a DIFFERENT code in each system listed here, with its own billability — \"B00\" is the ICD-10-CM category \"Herpesviral [herpes simplex] infections\" and also the ICD-10-PCS table row \"Imaging, Central Nervous System, Plain Radiography\". Re-call with `system` set to one of these values to validate it there.",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
  6. Changed1 schema field changed
    • changedInput schema / properties / code / description
      Previous value: -"The code to validate, with or without dots."New value: +"The code to validate, with or without dots. Must not be blank or whitespace-only."
  7. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Goes well beyond the readOnly/idempotent annotations: it enumerates the discriminated status values, explains whyNot content per case, clarifies that non-billable/terminated is a successful result rather than an error, and specifies exactly when unknown_code is raised and what it contains. It also discloses the alsoInSystems caveat and RxNorm's null billing verdict — behavioral detail an agent cannot get anywhere else.

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

Conciseness3/5

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

Purpose and status semantics are front-loaded, but the body is a single dense paragraph mixing core contract with deep edge cases (ICD-9-CM dotted-form miss messaging, PCS section naming). Much of it earns its place, yet the lack of structure makes it hard to scan, and the ICD-9-CM aside is disproportionate to its likelihood.

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?

Though an output schema exists, the description still explains the meaningful return semantics (status discrimination, when whyNot is null, error-vs-success boundary), which is what an agent needs to interpret the result correctly. Nothing material about calling or reading the tool is missing.

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

Parameters5/5

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

Despite 100% schema coverage, the description adds genuine semantics the schema lacks: the shape-based auto-detection heuristic, that dotted ICD-10-CM form resolves correctly, that a dotted all-digit ICD-9-CM value is never misread as an RXCUI, and why an explicit system disambiguates. This is disambiguation logic, not restatement.

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 ('Validate whether a US medical code exists, is current, and is billable') and scopes it to a bundled release. It distinguishes itself from sibling tools by name (medcode_browse_hierarchy for PCS sections) and by framing ('the detail a coder needs before submitting a claim'), so an agent can tell it apart from medcode_get_code or medcode_search_codes.

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?

The pre-claim-validation framing gives clear context, and it names one sibling scenario explicitly ('an ICD-10-PCS section value from medcode_browse_hierarchy'). However, it never routes the agent between this and medcode_get_code or medcode_map_codes — no explicit 'use X instead when…' for the closest siblings.

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.