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 value in ICD-9-CM form — a dotted all-digit code (250.00, 00.1) or an external-cause code (E880.9) — resolves in no bundled system, with or without system, 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.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "code": "<code>"
    },
    "name": "medcode_check_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesThe code to validate, with or without dots. Must not be blank or whitespace-only. A value longer than 64 characters once trimmed is longer than any bundled code, so it is not looked up and fails with unknown_code, which echoes its first 64 trimmed characters and "…" with its length.
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. Changed1 schema field changed
    • changedInput schema / properties / code / description
      Previous value: -"The code to validate, with or without dots. Must not be blank or whitespace-only."New value: +"The code to validate, with or without dots. Must not be blank or whitespace-only. A value longer than 64 characters once trimmed is longer than any bundled code, so it is not looked up and fails with unknown_code, which echoes its first 64 trimmed characters and \"…\" with its length."
  2. 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."
  3. 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."
  4. Changed2 schema fields changed
    • removedOutput schema / properties / whyNot / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / whyNot / type
      Added value: +[
      +  "string",
      +  "null"
      +]
  5. 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"
      -]
  6. 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"
      +}
  7. 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."
  8. First observed

TDQS

A4.5/5.0
Behavior5/5

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

Extensive disclosure beyond the readOnly/idempotent annotations: non-billable or terminated results are successful outcomes, not errors; unknown_code is raised only when a code is absent from the named system or undetectable; the response echoes alsoInSystems and truncation of over-64-char input. It also explains terminated HCPCS timing and the RxNorm billing-null case, which annotations could never convey.

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 statuses are front-loaded, but the single dense paragraph packs in edge cases with repeated phrasing ("with or without `system`"). The clause about ICD-10-PCS section values from medcode_browse_hierarchy is useful but buried, making the run-on harder to parse than necessary.

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?

Given an output schema exists, the description still delivers the decision-relevant detail an agent needs: failure modes, the success-but-nonbillable nuance, system detection rules, and cross-system name echoes. Nothing material is missing for correct invocation.

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?

With 100% schema coverage the baseline is 3, but the description adds real meaning: auto-detection from the code's shape, dotted ICD-10-CM form resolving to ICD10CM, explicit `system` to disambiguate, and ICD-9-CM forms resolving in no bundled system. These extend well beyond what the schema's parameter descriptions state.

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 in the active bundled release." It also enumerates the discriminated outcomes and clarifies scope (US, active bundled release), so an agent can distinguish it from lookup siblings like medcode_get_code.

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 when-to-use framing ("This is the detail a coder needs before submitting a claim") and guidance on when to pass an explicit `system` versus relying on auto-detection. It does not explicitly compare itself against siblings such as medcode_get_code or medcode_search_codes, so it falls short of explicit alternatives routing.

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.