Check Medical Code
medcode_check_codeValidate 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
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | 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. | |
| system | No | Force the lookup into this system. Omit to auto-detect from the code's shape. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | The code in display form (ICD-10-CM carries the dot). | |
| error | No | Present when the call failed. Absent on success. | |
| status | No | 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. | |
| system | No | The system the code was resolved in, echoed for chaining. | |
| whyNot | No | 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. | |
| billable | No | True only when status is valid_billable. Null when status is valid — the system has no billing concept. | |
| alsoInSystems | No | 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. |