Skip to main content
Glama

cid10_search

Read-onlyIdempotent

Search Brazilian CID-10 codes by Portuguese text for SUS/ANVISA contexts, billing, and epidemiology. Returns diacritic-insensitive matches from categories and subcategories.

Instructions

Search the Brazilian CID-10 (Classificação Estatística Internacional de Doenças, 10ª Revisão) by Portuguese text.

Use this tool to:

  • Find CID-10 codes for Brazilian SUS / ANVISA contexts ("infarto", "diabetes", "tuberculose")

  • Look up the official Portuguese (CBCD/USP) translation of a clinical term

  • Locate codes for billing, epidemiology, and clinical documentation in Brazil

Returns matches from CID-10 categories (3-char) and/or subcategories (4-char). Search is diacritic-insensitive: typing "infeccoes" matches "infecções". This tool searches the Brazilian Portuguese CID-10 V2008 — for the international ICD-11 (current WHO revision, in English by default), use icd11_search.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch term in Portuguese (e.g., "diabetes", "infarto", "tuberculose")
levelNoRestrict search to 3-char categories, 4-char subcategories, or both. Default: allall
max_resultsNoMaximum number of results (1-100). Default: 25

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
levelYes
total_countYes
shown_countYes
hitsYes

Implementation Reference

  • The main handler function for cid10_search. It parses the input params using CID10SearchParamsSchema, calls client.search() with the query, level, and max_results, formats results using formatHit(), and returns both text and structured content. On error, delegates to handleToolError().
    async function handleCID10Search(args: Record<string, unknown>): Promise<CallToolResult> {
      try {
        const params = CID10SearchParamsSchema.parse(args);
        const client = getCID10Client();
        const { totalCount, hits } = client.search(
          params.query,
          params.level,
          params.max_results,
        );
    
        const structured: CID10SearchOutput = {
          query: params.query,
          level: params.level,
          total_count: totalCount,
          shown_count: hits.length,
          hits,
        };
    
        if (hits.length === 0) {
          return {
            content: [
              {
                type: 'text',
                text: `Nenhum código CID-10 encontrado para "${params.query}".`,
              },
            ],
            structuredContent: structured,
          };
        }
    
        const header =
          `## Resultados CID-10 para "${params.query}"\n\n` +
          `Total: ${totalCount} (mostrando ${hits.length}, escopo: ${params.level}).\n\n`;
        const body = hits.map((h, i) => `${i + 1}. ${formatHit(h)}`).join('\n\n');
    
        return {
          content: [{ type: 'text', text: header + body }],
          structuredContent: structured,
        };
      } catch (error) {
        return handleToolError(error);
      }
    }
  • Input validation schema (CID10SearchParamsSchema) for cid10_search. Defines: query (string, min 2 chars), level (enum: categories/subcategories/all, default: all), and max_results (1-100, default: 25).
    export const CID10SearchParamsSchema = z.object({
      query: z
        .string()
        .min(2)
        .describe('Search term in Portuguese (e.g., "diabetes", "infarto", "tuberculose")'),
      level: z
        .enum(['categories', 'subcategories', 'all'])
        .optional()
        .default('all')
        .describe(
          'Restrict search to 3-char categories, 4-char subcategories, or both. Default: all',
        ),
      max_results: maxResults(25),
    });
  • Registration of the cid10_search tool via toolRegistry.register(cid10SearchTool, handleCID10Search) at the bottom of src/tools/cid10.ts.
    toolRegistry.register(cid10SearchTool, handleCID10Search);
  • The CID10SearchHit interface — the return type for search results, containing level, code, display, title, chapter_num, group_range, and other metadata fields.
    export interface CID10SearchHit {
      level: 'category' | 'subcategory';
      code: string;
      display: string;
      classif: string;
      title: string;
      title_short: string;
      refer: string;
      excluidos: string;
      restr_sexo: string;
      causa_obito: string;
      chapter_num: number | null;
      group_range: string | null;
    }
  • The client.search() method on CID10Client. Performs diacritic-insensitive substring matching across categories and/or subcategories by title and title_short. Returns totalCount and hits (sliced to maxResults).
    search(
      query: string,
      level: 'categories' | 'subcategories' | 'all',
      maxResults: number,
    ): { totalCount: number; hits: CID10SearchHit[] } {
      const needle = deburr(query);
      if (needle.length === 0) {
        return { totalCount: 0, hits: [] };
      }
    
      const all: CID10SearchHit[] = [];
    
      if (level === 'categories' || level === 'all') {
        for (const c of categories()) {
          if (
            deburr(c.title).includes(needle) ||
            deburr(c.title_short).includes(needle)
          ) {
            all.push(categoryToHit(c));
          }
        }
      }
    
      if (level === 'subcategories' || level === 'all') {
        for (const s of subcategories()) {
          if (
            deburr(s.title).includes(needle) ||
            deburr(s.title_short).includes(needle)
          ) {
            all.push(subcategoryToHit(s));
          }
        }
      }
    
      return { totalCount: all.length, hits: all.slice(0, maxResults) };
    }
Behavior5/5

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

Annotations already provide readOnlyHint, destructiveHint, idempotentHint, openWorldHint. Description adds significant behavioral context: returns categories/subcategories, diacritic-insensitive, uses V2008 Brazilian version. No contradiction with 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?

Two well-structured paragraphs, front-loaded with purpose. Every sentence adds necessary information. Efficient at ~85 words with no fluff.

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?

With output schema present, return values need not be detailed. Description covers search behavior, version, and sibling differentiation. Could mention empty result handling, but overall complete given annotations and schema.

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?

Input schema has 100% coverage with descriptions for all parameters. Description adds extra value by detailing diacritic-insensitivity for the query parameter and explaining the level parameter restrictions. Use-case examples further clarify parameter usage.

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?

Description clearly states it searches Brazilian CID-10 by Portuguese text. It specifies concrete use cases (SUS/ANVISA, billing, epidemiology) and distinguishes from sibling icd11_search by noting the international ICD-11 is a different tool.

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?

Explicitly states when to use (finding Brazil-specific codes, official translations) and when not to use (international ICD-11, directing to icd11_search). Also mentions diacritic-insensitivity for search behavior.

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/SidneyBissoli/medical-terminologies-mcp'

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