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.

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

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. 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.
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, 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`.
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 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.
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. Changed4 schema fields changed
    • changedInput schema / properties / chapter / description
      Previous 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`."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, 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`."
    • changedInput schema / properties / query / description
      Previous value: -"Clinical description to match, e.g. \"type 2 diabetes with neuropathy\". Must not be blank or whitespace-only."New value: +"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."
    • changedOutput schema / properties / appliedFilters / properties / chapter / description
      Previous value: -"Chapter filter applied, or null."New value: +"Chapter filter applied, or null — its first 64 characters and \"…\" when it is longer than that, though the whole value ran."
    • changedOutput schema / properties / notice / description
      Previous 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."New value: +"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."
  2. 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)."
  3. 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."
  4. 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"
      +]
  5. 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"
      -]
  6. 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`."
  7. 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."
  8. 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."
  9. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations only declare readOnly/idempotent/closed-world; the description goes well past them by disclosing AND-semantics across terms, prefix-then-substring matching with a concrete 'neuropathy' example, the RxNorm name-only matching rule, ranking and deterministic tie-break behavior, and truncation signaled via `nextCursor`. These are exactly the execution traits an agent cannot infer from structured fields.

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?

Front-loaded with the core purpose and matching model, then filters, then result shape — a sensible ordering with no filler sentences. It is a dense single paragraph with stacked parentheticals, which slightly raises reading cost, but nearly every clause carries distinct information.

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?

For a six-parameter search tool with an output schema, the definition covers everything the agent needs before calling: matching semantics, filter interactions, tie-break determinism, and the paging contract. Return values are correctly left to the output schema rather than duplicated.

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%, so baseline is 3, but the description adds real semantics: all query terms must appear, `chapter` is the lever for narrowing RxNorm term type, and `billableOnly` also drops terminated HCPCS codes and eliminates all RxNorm concepts. `limit` is left entirely to the schema, which keeps it short of a 5.

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?

States a specific verb (find), resource (US medical codes), and mechanism (full-text search over the bundled index matching official descriptions to a described concept). It also explicitly positions itself against a named sibling: 'the reverse of medcode_get_code', so an agent can route without opening either schema.

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?

Gives an explicit trigger ('Use when you have a clinical description and need the code') and names the alternative that covers the inverse direction (medcode_get_code). Filter guidance for `system`, `billableOnly`, and `chapter` adds the secondary routing decisions an agent would otherwise have to guess.

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.