Skip to main content
Glama

icd11_hierarchy

Read-onlyIdempotent

Explore the ICD-11 classification by retrieving parent categories or child subcategories for any given code. Understand the hierarchical structure of medical conditions.

Instructions

Navigate the ICD-11 hierarchy to find parent or child entities.

Use this tool to:

  • Find broader categories (parents) of a condition

  • Find specific subtypes (children) of a condition

  • Understand the classification structure

Direction 'parents' returns ancestor categories, 'children' returns subcategories.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesICD-11 code to get hierarchy for
directionYesDirection: "parents" for ancestors, "children" for subtypes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes
directionYes
entitiesYes

Implementation Reference

  • Handler function for icd11_hierarchy. Parses params (code, direction), calls WHO client getParents or getChildren, builds structured output and formatted text response.
    async function handleICD11Hierarchy(args: Record<string, unknown>): Promise<CallToolResult> {
      try {
        const params = ICD11HierarchyParamsSchema.parse(args);
        const client = getWHOClient();
    
        const entities =
          params.direction === 'parents'
            ? await client.getParents(params.code)
            : await client.getChildren(params.code);
    
        const structured: ICD11HierarchyOutput = {
          code: params.code,
          direction: params.direction,
          entities: entities.map((e) => ({
            code: e.code ?? null,
            code_range: e.codeRange ?? null,
            title: e.title?.['@value'] ?? 'Unknown',
            uri: e['@id'],
          })),
        };
    
        const formatted = formatHierarchyList(entities, params.direction);
    
        return {
          content: [{
            type: 'text',
            text: `## ICD-11 Hierarchy for ${params.code}\n\n${formatted}`,
          }],
          structuredContent: structured,
        };
      } catch (error) {
        return handleToolError(error);
      }
    }
  • Output schema (ICD11HierarchyOutputSchema) defining the structured content shape: code, direction, and entities array with code, code_range, title, uri.
    export const ICD11HierarchyOutputSchema = z.object({
      code: z.string(),
      direction: z.enum(['parents', 'children']),
      entities: z.array(
        z.object({
          code: z.string().nullable(),
          code_range: z.string().nullable(),
          title: z.string(),
          uri: z.string(),
        }),
      ),
    });
  • Input schema (ICD11HierarchyParamsSchema) with required 'code' (string) and 'direction' (enum: parents/children).
    export const ICD11HierarchyParamsSchema = z.object({
      code: z.string().min(1).describe('ICD-11 code to get hierarchy for'),
      direction: z
        .enum(['parents', 'children'])
        .describe('Direction: "parents" for ancestors, "children" for subtypes'),
    });
  • Registration of icd11HierarchyTool with handleICD11Hierarchy via toolRegistry.
    toolRegistry.register(icd11HierarchyTool, handleICD11Hierarchy);
  • Helper function formatHierarchyList that formats entities into a user-readable bullet list.
    function formatHierarchyList(entities: ICD11EntityResponse[], direction: string): string {
      if (entities.length === 0) {
        return `No ${direction} found for this entity.`;
      }
    
      const lines: string[] = [];
      lines.push(`## ${direction.charAt(0).toUpperCase() + direction.slice(1)} (${entities.length})`);
      lines.push('');
    
      for (const entity of entities) {
        const title = entity.title?.['@value'] || 'Unknown';
        const code = entity.code || entity.codeRange || 'No code';
        lines.push(`- **${code}** - ${title}`);
      }
    
      return lines.join('\n');
    }
Behavior4/5

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

Annotations already declare readOnlyHint true, destructiveHint false, idempotentHint true, and openWorldHint true. The description adds context about the direction parameter and what it returns (ancestors vs. subcategories). No contradictions or missing critical behavioral details beyond what annotations cover.

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 very concise, front-loading the main purpose and using bullet points for usage cases. Every sentence adds value, with no redundancy or fluff.

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 simplicity, the description covers all necessary aspects: purpose, direction semantics, and usage cases. Since an output schema exists (not shown but indicated), return values need not be explained further.

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% description coverage for both parameters. The description adds slight extra meaning by explaining the effect of the direction enum values ('parents' returns ancestors, 'children' returns subtypes), which goes beyond the schema's enumeration labels.

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 clearly states it navigates the ICD-11 hierarchy to find parent or child entities. It uses specific verbs ('navigate', 'find') and identifies the resource ('ICD-11 hierarchy'). This distinguishes it from sibling tools like icd11_lookup or icd11_search, which serve different purposes.

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?

The description explicitly lists when to use the tool: to find broader categories (parents), specific subtypes (children), and understand classification structure. While it does not explicitly state when not to use it or name alternatives, the context and sibling names imply that other tools handle queries and lookups, so this guidance is sufficient.

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