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

TableJSON 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). RxNorm has no billing concept, so this excludes every RxNorm concept.

Output Schema

TableJSON 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. 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."
  2. 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"
      +]
  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": [
      +      "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"
      -]
  4. 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`."
  5. 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."
  6. 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."
  7. First observed

TDQS

A4.9/5.0
Behavior5/5

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

The description goes far beyond the readOnly/idempotent annotations by disclosing token-prefix-then-substring matching, the neuropathy example, RxNorm's drug-name-only matching, ranking order, deterministic tie-break, truncation via nextCursor, and echoed resolved system. It adds substantial behavioral context without contradicting the annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is dense but every sentence earns its place: purpose, matching semantics, parameter guidance, usage context, and pagination/ranking behavior. The core purpose is front-loaded in the first sentence, and there is no filler or repetition of schema details.

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?

Given the tool's complexity, the description covers matching semantics, filter behavior, ranking, pagination, and output echoes. An output schema exists, so not explaining return shape is acceptable. The only external nuance, chapter values, is available via sibling tools and the schema, so nothing critical is missing.

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 100%, so baseline 3 applies, but the description adds meaning beyond the schema: billableOnly excludes all RxNorm concepts, chapter can narrow term-type matches, and cursor should receive nextCursor from a prior response. This enriches the parameter semantics.

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 opens with a specific verb and resource: 'Find US medical codes whose official descriptions match a described concept...' It also states the search mechanism (full-text over bundled index). It clearly distinguishes itself from medcode_get_code by framing this as the reverse operation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It explicitly says 'Use when you have a clinical description and need the code — the reverse of medcode_get_code,' providing an explicit when-to-use and naming the key alternative. It also explains how to narrow with system, billableOnly, and chapter, giving actionable selection guidance.

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.