Skip to main content
Glama

Search Medical Codes

medcode_search_codes
Read-onlyIdempotent

Find 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.

Input Schema

NameRequiredDescriptionDefault
limitNoMax codes per page. Defaults to the server's MEDCODE_MAX_RESULTS (50), ceiling 200.
queryYesClinical description to match, e.g. "type 2 diabetes with neuropathy". Must not be blank or whitespace-only.
cursorNoOpaque continuation token from a previous response's `nextCursor`, to fetch the next page of the same ranked result set. Omit for the first page.
systemNoRestrict results to one system. Omit to search all bundled systems.
chapterNoRestrict 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. A blank or whitespace-only value carries no filtering intent and is treated as omitted, which the response discloses as `appliedFilters.chapter: null`.
billableOnlyNoWhen 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

NameRequiredDescriptionDefault
capNoThe page size that was applied.
codesNoMatching codes, ranked by full-text relevance.
errorNoPresent when the call failed. Absent on success.
shownNoNumber of codes returned on this page.
noticeNoGuidance when nothing matched — echoes the query and suggests how to broaden, or names `billableOnly` as the cause when the searched system has no billing concept.
truncatedNoTrue when more matches exist beyond this page.
nextCursorNoOpaque token to pass back as `cursor` for the next page. Present only when more matches exist beyond this page.
appliedFiltersNoFilters the server applied to the search.
effectiveQueryNoThe query as the server parsed it for matching.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / properties / billableOnly / description
      Previous value: -"When true, return only billable leaf codes (exclude headers/categories). RxNorm has no billing concept, so this excludes every RxNorm concept."New value: +"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."
    • changedOutput schema / properties / codes / items / properties / billable / description
      Previous value: -"True when the code is a billable leaf. Null when the system has no billing concept (RxNorm)."New value: +"True when the code is a billable leaf. False for headers/categories, non-billable codes, and HCPCS codes whose last valid date has passed. Null when the system has no billing concept (RxNorm)."
  2. Changed6 schema fields changed
    • changedInput schema / properties / billableOnly / description
      Previous value: -"When true, return only billable leaf codes (exclude headers/categories)."New value: +"When true, return only billable leaf codes (exclude headers/categories). RxNorm has no billing concept, so this excludes every RxNorm concept."
    • changedOutput schema / properties / codes / items / properties / billable / description
      Previous value: -"True when the code is a billable leaf."New value: +"True when the code is a billable leaf. Null when the system has no billing concept (RxNorm)."
    • changedOutput schema / properties / codes / items / properties / billable / type
      Previous value: -"boolean"New value: +[
      +  "boolean",
      +  "null"
      +]
    • changedOutput schema / properties / codes / items / properties / chapter / description
      Previous value: -"Chapter/range bucket, or null."New value: +"Chapter/range bucket, or null. For RxNorm, the concept term type (IN, PIN, MIN, BN, SCD, SBD, GPCK, BPCK)."
    • changedOutput schema / properties / codes / items / properties / shortDescription / description
      Previous value: -"Official short description, or null when none is on record."New value: +"Official short description, or null when none is on record. Always null for RxNorm, which publishes a single name."
    • changedOutput schema / properties / notice / description
      Previous value: -"Guidance when nothing matched — echoes the query and suggests how to broaden."New value: +"Guidance when nothing matched — echoes the query and suggests how to broaden, or names `billableOnly` as the cause when the searched system has no billing concept."
  3. Changed10 schema fields changed
    • removedOutput schema / properties / appliedFilters / properties / chapter / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / appliedFilters / properties / chapter / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / appliedFilters / properties / system / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / appliedFilters / properties / system / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / codes / items / properties / chapter / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / codes / items / properties / chapter / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / codes / items / properties / description / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / codes / items / properties / description / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / codes / items / properties / shortDescription / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / codes / items / properties / shortDescription / type
      Added value: +[
      +  "string",
      +  "null"
      +]
  4. 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": [
      +      "codes",
      +      "effectiveQuery",
      +      "appliedFilters",
      +      "truncated",
      +      "shown",
      +      "cap"
      +    ]
      +  },
      +  {
      +    "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.",
      +          "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: -[
      -  "codes",
      -  "effectiveQuery",
      -  "appliedFilters",
      -  "truncated",
      -  "shown",
      -  "cap"
      -]
  5. Changed1 schema field changed
    • changedInput schema / properties / chapter / description
      Previous value: -"Restrict to a chapter/range bucket (the value from a code's `chapter` field)."New value: +"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. A blank or whitespace-only value carries no filtering intent and is treated as omitted, which the response discloses as `appliedFilters.chapter: null`."
  6. Changed1 schema field changed
    • changedInput schema / properties / query / description
      Previous value: -"Clinical description to match, e.g. \"type 2 diabetes with neuropathy\"."New value: +"Clinical description to match, e.g. \"type 2 diabetes with neuropathy\". Must not be blank or whitespace-only."
  7. Changed6 schema fields changed
    • addedInput schema / properties / cursor
      Added value: +{
      +  "description": "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.",
      +  "type": "string"
      +}
    • changedInput schema / properties / limit / description
      Previous value: -"Max codes to return. Defaults to the server's MEDCODE_MAX_RESULTS (50), ceiling 200."New value: +"Max codes per page. Defaults to the server's MEDCODE_MAX_RESULTS (50), ceiling 200."
    • changedOutput schema / properties / cap / description
      Previous value: -"The limit that was applied."New value: +"The page size that was applied."
    • addedOutput schema / properties / nextCursor
      Added value: +{
      +  "description": "Opaque token to pass back as `cursor` for the next page. Present only when more matches exist beyond this page.",
      +  "type": "string"
      +}
    • changedOutput schema / properties / shown / description
      Previous value: -"Number of codes returned."New value: +"Number of codes returned on this page."
    • changedOutput schema / properties / truncated / description
      Previous value: -"True when results were capped at the limit."New value: +"True when more matches exist beyond this page."
  8. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Beyond the annotations, the description discloses important search behavior: all terms must appear, prefix matches are attempted before substring matches, inflected/compound forms are surfaced, RxNorm matches on drug name alone and never term type, billableOnly excludes all RxNorm concepts and terminated HCPCS codes, and truncation is exposed via nextCursor. These details materially affect how an agent interprets and invokes the tool.

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 description is dense but front-loaded with the core purpose and search behavior. It is longer than typical, and some filter details overlap with the schema, but nearly every sentence adds operational information rather than filler.

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?

Although an output schema exists, the description still usefully explains result behavior: per-row resolved system for chaining, exact-prefix ranking, deterministic tie-breaking, and nextCursor pagination. Combined with the schema and annotations, an agent has everything needed to call this tool correctly.

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?

Schema coverage is already 100%, but the description adds meaningful semantics about the query parameter's matching algorithm and about the RxNorm interaction with chapter and billableOnly filtering. It does not add much beyond the schema for cursor and limit, but the added query behavior is valuable.

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?

The description states a specific verb and resource—find US medical codes by matching official descriptions via full-text search—and clearly distinguishes the tool from medcode_get_code as its reverse operation. An agent can tell exactly what this tool does without inspecting the schema.

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?

It gives a clear use case: 'Use when you have a clinical description and need the code' and explicitly contrasts this with medcode_get_code. However, it does not mention when to prefer other siblings such as medcode_map_codes or medcode_check_code, so the routing guidance is useful but incomplete.

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.