Search Medical Codes
medcode_search_codesFind US medical codes whose official descriptions match a described concept, via full-text search over the bundled index. Every search term must appear — matched first as a token prefix, then as a substring so inflected and compound forms are also found (a "neuropathy" search surfaces "mononeuropathy"/"polyneuropathy" siblings too, not only a standalone "neuropathy" token). An RxNorm concept matches on its drug name alone, never its term type (SBD, IN, …) — narrow by type with chapter. Filter by system (ICD10CM/ICD10PCS/HCPCS/RXNORM), billableOnly to exclude headers/categories and terminated HCPCS codes, and chapter. Use when you have a clinical description and need the code — the reverse of medcode_get_code. Results echo the resolved system per row for chaining, rank exact prefix matches ahead of substring-only matches with a deterministic tie-break, and disclose truncation with a nextCursor: pass it back as cursor to page through the full ranked set.
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": {
"query": "<query>"
},
"name": "medcode_search_codes"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Max codes per page. Defaults to the server's MEDCODE_MAX_RESULTS (50), ceiling 200. | |
| query | Yes | Clinical description to match, e.g. "type 2 diabetes with neuropathy". Must not be blank or whitespace-only. A search applies at most its first 1,000 distinct terms (a repeated term counts once); past that, `notice` says how many distinct terms the query carried and that the rest were not applied. | |
| cursor | No | Opaque continuation token from a previous response's `nextCursor`, to fetch the next page of the same ranked result set. Omit for the first page. | |
| system | No | Restrict results to one system. Omit to search all bundled systems. | |
| chapter | No | Restrict to a chapter/range bucket (the value from a code's `chapter` field). Case-insensitive: surrounding whitespace is trimmed and the value is upper-cased to match how chapters are stored, and `appliedFilters.chapter` echoes the upper-cased value that actually ran, cut to its first 64 characters and "…" past that length. A blank or whitespace-only value carries no filtering intent and is treated as omitted, which the response discloses as `appliedFilters.chapter: null`. | |
| billableOnly | No | When true, return only billable leaf codes (exclude headers/categories and HCPCS codes whose last valid date has passed). RxNorm has no billing concept, so this excludes every RxNorm concept. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cap | No | The page size that was applied. | |
| codes | No | Matching codes, ranked by full-text relevance. | |
| error | No | Present when the call failed. Absent on success. | |
| shown | No | Number of codes returned on this page. | |
| notice | No | Guidance whenever a page returns no codes, naming which cause applies: nothing matched — it echoes the query and suggests how to broaden, or names `billableOnly` as the cause when the searched system has no billing concept — or the `cursor` starts past the last page of a query that does match. When the query carried more than 1,000 distinct terms, it leads with that limit and says the terms past it were not applied. | |
| truncated | No | True when more matches exist beyond this page. | |
| nextCursor | No | Opaque token to pass back as `cursor` for the next page. Present only when more matches exist beyond this page. | |
| appliedFilters | No | Filters the server applied to the search. | |
| effectiveQuery | No | The query as the server parsed it for matching. |