Get Medical Code
medcode_get_codeDecode one or more US medical codes to their official descriptions across ICD-10-CM (diagnoses), ICD-10-PCS (inpatient procedures), HCPCS Level II (supplies/drugs/services), and RxNorm (drugs, by RXCUI). Also decodes a National Drug Code (NDC) directly to its RxNorm product offline, tagged source: "NDC" — hyphenated in an FDA segment configuration (4-4-2, 5-3-2, 5-4-1, or the 11-digit 5-4-2) or as bare 10/11 digits; any other segment widths are malformed and stay unresolved. Auto-detects the system from each code's shape, and a code written in ICD-10-CM dotted form (A01.00) resolves to ICD-10-CM; pass an explicit system only when a value is genuinely ambiguous. Accepts 1–50 codes and returns partial success: resolved codes in found, unresolved in notFound with a per-code reason, so one bad code never fails the batch. Each reply holds structuredContent and the text to 24,000 bytes apiece: codes are decoded in request order, and once one has resolved, a code that would carry the reply past that budget is returned unprocessed in deferred with every code after it, each as sent — trimmed when its padding alone carries it past 64 characters, and cut to its first 64 trimmed characters and … when it is longer than that once trimmed — re-call with codes set to deferred and the same system and includeHierarchy until no deferred comes back. Three kinds of code are never deferred and can carry a reply past the budget: the first code that resolves, returned whole; the codes before it; and the unresolved codes after the last one that resolves, so a re-call always holds a code that resolves. Only a batch where nothing resolves fails: with ambiguous_system and candidateSystems when every code exists in more than one bundled system, otherwise with no_codes_found. Set includeHierarchy to attach each code's parent and immediate children (with a childrenTruncated flag when a code has more children than the cap returns — walk the full set via medcode_map_codes, or medcode_browse_hierarchy outside ICD-10-PCS); an ICD-10-PCS table row's children are the complete codes that begin with it. The resolved system is echoed on every result for chaining into a billability check or a medcode_map_codes parents/children walk; a bare integer that resolves nowhere is named as a possible CPT / HCPCS Level I code, which is out of scope, except a bare 10/11-digit one, which is named as an NDC no bundled drug maps to; 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 and is named as ICD-9-CM, which is not bundled; an ICD-10-PCS section value from medcode_browse_hierarchy (0) looked up 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, so a single answer to a colliding code is never mistaken for the only one.
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": {
"codes": "<codes>"
},
"name": "medcode_get_code"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| codes | Yes | Codes to decode (1–50). Mixed systems are fine — each is detected independently. An NDC decodes to its RxNorm product: hyphenated as 4-4-2, 5-3-2, 5-4-1, or 5-4-2, or as bare 10/11 digits. | |
| system | No | Force every code to be looked up in this system, which also skips the NDC decode. Omit to auto-detect per code. | |
| includeHierarchy | No | When true, attach each found code's parent and immediate children. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| error | No | Present when the call failed. Absent on success. | |
| found | No | Successfully decoded codes, in request order. | |
| deferred | No | Input codes not processed because the reply reached its byte budget, in request order, each as sent — trimmed when its padding alone carries it past 64 characters, and its first 64 trimmed characters and "…" when it is longer than that once trimmed, which a re-call misses with the notFound entry this call would have given it. Re-call with these as codes and the same system and includeHierarchy, until no deferred comes back. Absent when every code was processed. | |
| notFound | No | Codes that did not resolve, with per-code reasons. |