Code Clinical Text to ICD-10/ICD-11
code_diagnosisExtract medical diagnoses from clinical text and map them to ICD-10 or ICD-11 codes. Identify conditions, negations, and severity with ranked confidence scores.
Instructions
Extract medical diagnoses from clinical text and map them to ICD-10-CM or ICD-11 codes. Identifies conditions, negations, historical mentions, family history, and severity. Returns ranked code candidates with confidence scores.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | Clinical text to process (progress notes, discharge summaries, etc.) | |
| top_k | No | Number of top code candidates per entity (1-25, default: 5) | |
| include_negated | No | Include negated entities in results (default: true) | |
| output_system | No | Output coding system: 'icd10' (default) or 'icd11' | icd10 |
Implementation Reference
- src/tools.ts:58-69 (handler)The handler function for the `code_diagnosis` tool, which calls the client's `code` method and formats the response.
async (args) => { try { const result = await client.code(args.text, { topK: args.top_k, includeNegated: args.include_negated, outputSystem: args.output_system, }); return ok(formatCodingResponse(result)); } catch (error) { return fail(error); } } - src/tools.ts:31-51 (schema)The input schema definition for the `code_diagnosis` tool.
inputSchema: { text: z .string() .min(1) .describe("Clinical text to process (progress notes, discharge summaries, etc.)"), top_k: z .number() .int() .min(1) .max(25) .default(5) .describe("Number of top code candidates per entity (1-25, default: 5)"), include_negated: z .boolean() .default(true) .describe("Include negated entities in results (default: true)"), output_system: z .enum(["icd10", "icd11"]) .default("icd10") .describe("Output coding system: 'icd10' (default) or 'icd11'"), }, - src/tools.ts:22-57 (registration)The registration block for the `code_diagnosis` tool within `registerTools`.
export function registerTools(server: McpServer, client: AutoICD): void { server.registerTool( "code_diagnosis", { title: "Code Clinical Text to ICD-10/ICD-11", description: "Extract medical diagnoses from clinical text and map them to ICD-10-CM or ICD-11 codes. " + "Identifies conditions, negations, historical mentions, family history, and severity. " + "Returns ranked code candidates with confidence scores.", inputSchema: { text: z .string() .min(1) .describe("Clinical text to process (progress notes, discharge summaries, etc.)"), top_k: z .number() .int() .min(1) .max(25) .default(5) .describe("Number of top code candidates per entity (1-25, default: 5)"), include_negated: z .boolean() .default(true) .describe("Include negated entities in results (default: true)"), output_system: z .enum(["icd10", "icd11"]) .default("icd10") .describe("Output coding system: 'icd10' (default) or 'icd11'"), }, annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false, }, },