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"). 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; 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 or detected system raises unknown_code, which names the other bundled system when one holds the 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

TableJSON 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

TableJSON 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.
systemNoThe system the code was resolved in, echoed for chaining.
whyNotNoExplanation for non-billable/terminated statuses, or null when valid_billable or 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. 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."
  2. Changed2 schema fields changed
    • removedOutput schema / properties / whyNot / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / whyNot / type
      Added value: +[
      +  "string",
      +  "null"
      +]
  3. 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"
      -]
  4. 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"
      +}
  5. 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."
  6. First observed

TDQS

A4.4/5.0
Behavior5/5

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

Beyond readOnly/idempotent annotations, it discloses error semantics (unknown_code only for absent code), successful non-billable results, whyNot, RxNorm null billable behavior, and alsoInSystems cross-system behavior. These are non-obvious behavioral traits an agent could not infer from annotations or schema.

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?

The definition is dense but front-loaded: core purpose first, then return statuses, then usage, then edge cases. Every sentence adds meaningful operational detail, but several clauses are packed into long sentences and some explanations add complexity that could be streamlined.

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?

For a read-only validation tool with an output schema, the description covers invocation, system resolution, error behavior, and special cases completely. No critical operational fact needed to call it correctly is missing.

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 the schema already describes both parameters, including 'Omit to auto-detect from the code's shape.' The description adds helpful behavioral context around system detection and cross-system results, but it does not substantially redefine parameter meanings beyond what the schema gives.

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?

First sentence uses a specific action ('Validate whether') against a specific resource ('US medical code') with three concrete criteria: exists, current, billable. The rest details the discriminated statuses in a way that distinguishes it from sibling tools like search_codes or browse_hierarchy without needing to see their schemas.

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 a clear use context: 'detail a coder needs before submitting a claim.' It also explains when auto-detection is sufficient versus when to pass an explicit system to disambiguate. However, it does not explicitly name sibling tools or state when not to use this tool versus medcode_get_code or medcode_map_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.