icd11_postcoordination
Retrieve available postcoordination axes for ICD-11 codes to build composite codes with severity, laterality, and anatomy modifiers.
Instructions
Get postcoordination information for an ICD-11 code.
Use this tool to:
Find available axes for building composite codes
Check required vs optional postcoordination
Understand code extension possibilities
Postcoordination allows adding severity, laterality, anatomy, etc.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ICD-11 code to get postcoordination info for |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| axes | Yes |
Implementation Reference
- src/tools/icd11.ts:425-476 (handler)Handler function that executes the icd11_postcoordination tool logic: parses input, calls WHO API via getPostcoordination, maps response to structured output, and returns formatted text.
async function handleICD11Postcoordination(args: Record<string, unknown>): Promise<CallToolResult> { try { const params = ICD11PostcoordinationParamsSchema.parse(args); const client = getWHOClient(); const postcoord = await client.getPostcoordination(params.code); const scales = postcoord.postcoordinationScale ?? []; const structured: ICD11PostcoordinationOutput = { code: params.code, axes: scales.map((s) => ({ axis_name: s.axisName, required: Boolean(s.requiredPostcoordination), allow_multiple: s.allowMultipleValues === 'true', value_count: s.scaleEntity ? s.scaleEntity.length : null, })), }; const lines: string[] = []; lines.push(`# Postcoordination for ${params.code}`); lines.push(''); if (scales.length === 0) { lines.push('This entity does not have postcoordination axes available.'); } else { lines.push('**Available Postcoordination Axes:**'); lines.push(''); for (const scale of scales) { const required = scale.requiredPostcoordination ? '(Required)' : '(Optional)'; const multiple = scale.allowMultipleValues === 'true' ? 'Multiple values allowed' : 'Single value only'; lines.push(`### ${scale.axisName} ${required}`); lines.push(`- ${multiple}`); if (scale.scaleEntity && scale.scaleEntity.length > 0) { lines.push(`- ${scale.scaleEntity.length} possible values`); } lines.push(''); } } return { content: [{ type: 'text', text: lines.join('\n') }], structuredContent: structured, }; } catch (error) { if (error instanceof ApiError && error.code === 'NOT_FOUND') { return { content: [{ type: 'text', text: `No postcoordination info found for code: ${args.code}` }], }; } return handleToolError(error); } } - src/types/index.ts:70-72 (schema)Input schema for icd11_postcoordination: requires a 'code' string parameter.
export const ICD11PostcoordinationParamsSchema = z.object({ code: z.string().min(1).describe('ICD-11 code to get postcoordination info for'), }); - src/types/index.ts:148-158 (schema)Output schema for icd11_postcoordination: contains code and axes array (each with axis_name, required, allow_multiple, value_count).
export const ICD11PostcoordinationOutputSchema = z.object({ code: z.string(), axes: z.array( z.object({ axis_name: z.string(), required: z.boolean(), allow_multiple: z.boolean(), value_count: z.number().int().nullable(), }), ), }); - src/tools/icd11.ts:486-486 (registration)Registration of icd11_postcoordination tool with the toolRegistry.
toolRegistry.register(icd11PostcoordinationTool, handleICD11Postcoordination); - src/clients/who-client.ts:404-417 (helper)WHO API client method getPostcoordination that fetches postcoordination axes from the WHO ICD-11 API endpoint.
async getPostcoordination(code: string, language: string = 'en'): Promise<ICD11PostcoordinationResponse> { const cacheKey = `postcoord:${code}:${language}`; return cache.getOrSet( CACHE_PREFIX.ICD11, cacheKey, () => this.request<ICD11PostcoordinationResponse>( `/release/11/${WHO_CONFIG.releaseId}/${WHO_CONFIG.linearization}/codeinfo/${code}/postcoordination`, {}, language ), DEFAULT_TTL.LOOKUP ); }