Skip to main content
Glama
pubspro

medterms-mcp

lookup_icd10

Search ICD-10-CM codes by diagnosis name or code. Returns the code, full description, and category for clinical documentation.

Instructions

Search ICD-10-CM codes by diagnosis name or look up a specific code. Returns code, full description, and category. Essential for clinical documentation agents.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesDiagnosis name (e.g. 'major depressive disorder') or ICD-10 code (e.g. 'F33.1')
limitNoNumber of results to return

Implementation Reference

  • index.js:120-165 (registration)
    The tool 'lookup_icd10' is registered with the MCP server on line 120 using server.tool(). It is the first tool registered.
    server.tool(
      "lookup_icd10",
      "Search ICD-10-CM codes by diagnosis name or look up a specific code. Returns code, full description, and category. Essential for clinical documentation agents.",
      {
        query: z
          .string()
          .describe("Diagnosis name (e.g. 'major depressive disorder') or ICD-10 code (e.g. 'F33.1')"),
        limit: z
          .number()
          .int()
          .min(1)
          .max(20)
          .default(10)
          .describe("Number of results to return"),
      },
      async ({ query, limit }) => {
        const url = `${ICD_BASE}/search?sf=code,name&terms=${encodeURIComponent(query)}&maxList=${limit}`;
        const data = await apiFetch(url);
    
        // Response: [total, codes[], null, [code, name][]]
        const total = data[0] || 0;
        const entries = data[3] || [];
    
        if (!entries.length) {
          return {
            content: [{
              type: "text",
              text: `No ICD-10-CM codes found for "${query}".`
            }]
          };
        }
    
        const rows = entries.map(([code, name]) => `- **${code}** — ${name}`);
    
        const text = [
          `## ICD-10-CM Results for "${query}"`,
          `Found ${total} total matches, showing ${entries.length}:`,
          "",
          ...rows,
          "",
          "_Source: NIH National Library of Medicine ICD-10-CM API_"
        ].join("\n");
    
        return { content: [{ type: "text", text }] };
      }
    );
  • The Zod schema defines two input parameters: 'query' (string, diagnosis name or ICD-10 code) and 'limit' (number, 1-20, default 10).
    "Search ICD-10-CM codes by diagnosis name or look up a specific code. Returns code, full description, and category. Essential for clinical documentation agents.",
    {
      query: z
        .string()
        .describe("Diagnosis name (e.g. 'major depressive disorder') or ICD-10 code (e.g. 'F33.1')"),
      limit: z
        .number()
        .int()
        .min(1)
        .max(20)
        .default(10)
        .describe("Number of results to return"),
    },
  • The handler function fetches from the NIH ICD-10-CM API (clinicaltables.nlm.nih.gov), parses the response, formats results as markdown, and returns them as text content.
      async ({ query, limit }) => {
        const url = `${ICD_BASE}/search?sf=code,name&terms=${encodeURIComponent(query)}&maxList=${limit}`;
        const data = await apiFetch(url);
    
        // Response: [total, codes[], null, [code, name][]]
        const total = data[0] || 0;
        const entries = data[3] || [];
    
        if (!entries.length) {
          return {
            content: [{
              type: "text",
              text: `No ICD-10-CM codes found for "${query}".`
            }]
          };
        }
    
        const rows = entries.map(([code, name]) => `- **${code}** — ${name}`);
    
        const text = [
          `## ICD-10-CM Results for "${query}"`,
          `Found ${total} total matches, showing ${entries.length}:`,
          "",
          ...rows,
          "",
          "_Source: NIH National Library of Medicine ICD-10-CM API_"
        ].join("\n");
    
        return { content: [{ type: "text", text }] };
      }
    );
  • The apiFetch() utility function used by the handler to make HTTP requests to external APIs.
    async function apiFetch(url) {
      const res = await fetch(url, {
        headers: { "Accept": "application/json" }
      });
      if (!res.ok) throw new Error(`API error ${res.status}: ${url}`);
      return res.json();
    }
Behavior3/5

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

No annotations are provided, so the description carries the burden. It describes expected returns but does not explicitly declare read-only or non-destructive behavior. The actions 'search' and 'look up' imply safety, but explicit confirmation would improve clarity.

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?

Two sentences effectively convey purpose, expected output, and usage context with no redundancy. The core action is front-loaded in the first sentence.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description covers input format, output fields, and high-level context (clinical documentation). While it lacks edge-case details (e.g., partial matching, empty results), it is sufficient for a simple lookup tool given no output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the input schema already describes both parameters adequately. The tool description restates the query purpose but adds no new parameter-level detail beyond what the schema provides.

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 explicitly states the tool searches and looks up ICD-10-CM codes by diagnosis name or code, and returns code, description, and category. This clearly distinguishes it from sibling tools like lookup_meddra which cover other terminologies.

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 notes the tool is 'essential for clinical documentation agents,' implying its primary context. However, it does not explicitly state when not to use it (e.g., for other code systems), though sibling tool names provide some implicit guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pubspro/medterms-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server