search_medical_concept
Search a medical term across multiple ontology systems (SNOMED CT, MeSH, LOINC, NCI Thesaurus) to retrieve concept definitions and cross-system identifiers.
Instructions
Search for a medical concept across terminology systems (SNOMED CT, MeSH, LOINC, NCI Thesaurus) using the NIH UMLS Metathesaurus. Returns concept definitions and cross-system identifiers.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| term | Yes | Medical term to search (e.g. 'schizophrenia', 'EGFR mutation', 'HbA1c') | |
| vocabulary | No | Terminology system to search within | all |
Implementation Reference
- index.js:426-493 (registration)Registration of the 'search_medical_concept' tool via server.tool() with name, description, Zod schema for parameters, and the async handler function.
server.tool( "search_medical_concept", "Search for a medical concept across terminology systems (SNOMED CT, MeSH, LOINC, NCI Thesaurus) using the NIH UMLS Metathesaurus. Returns concept definitions and cross-system identifiers.", { term: z .string() .describe("Medical term to search (e.g. 'schizophrenia', 'EGFR mutation', 'HbA1c')"), vocabulary: z .enum(["all", "SNOMEDCT_US", "MSH", "NCI", "LNC", "ICD10CM"]) .default("all") .describe("Terminology system to search within"), }, async ({ term, vocabulary }) => { // Use NLM clinical tables for broad concept search const icdUrl = `${ICD_BASE}/search?sf=code,name&terms=${encodeURIComponent(term)}&maxList=5`; const rxUrl = `${RXNAV_BASE}/approximateTerm.json?term=${encodeURIComponent(term)}&maxEntries=3`; const [icdData, rxData] = await Promise.all([ apiFetch(icdUrl).catch(() => null), apiFetch(rxUrl).catch(() => null), ]); const icdResults = icdData?.[3] || []; const rxCandidates = rxData?.approximateGroup?.candidate || []; const meddra = MEDDRA_PT_SOC[term.toLowerCase()]; let text = `## Medical Concept: "${term}"\n\n`; text += `### ICD-10-CM (Diagnosis Coding)\n`; if (icdResults.length) { text += icdResults.map(([c, n]) => `- **${c}** — ${n}`).join("\n") + "\n\n"; } else { text += `_No direct ICD-10-CM match found._\n\n`; } text += `### MedDRA (Safety Reporting)\n`; if (meddra) { text += `- **PT:** ${term.charAt(0).toUpperCase() + term.slice(1)}\n`; text += `- **SOC:** ${meddra}\n\n`; } else { text += `_Not in curated MedDRA index. Verify at meddra.org._\n\n`; } text += `### RxNorm (Drug Concepts)\n`; if (rxCandidates.length) { text += rxCandidates.slice(0, 3).map( c => `- **RxCUI ${c.rxcui}** (score: ${c.score})` ).join("\n") + "\n\n"; } else { text += `_Not a drug concept or no RxNorm match found._\n\n`; } text += `### Terminology System Reference\n`; text += `| System | Domain | Use Case |\n`; text += `|--------|--------|----------|\n`; text += `| **ICD-10-CM** | Diagnoses | Billing, epidemiology, EHR |\n`; text += `| **MedDRA** | AEs & conditions | Pharmacovigilance, regulatory |\n`; text += `| **RxNorm** | Drugs | Prescribing, interoperability |\n`; text += `| **SNOMED CT** | Clinical concepts | EHR, clinical decision support |\n`; text += `| **LOINC** | Lab & obs | Lab results, vital signs |\n`; text += `| **NCI Thesaurus** | Oncology | Cancer trials, FDA submissions |\n`; text += `| **CTCAE** | AE grading | Oncology trial safety |\n\n`; text += `_Source: NIH NLM APIs (ICD-10-CM, RxNav). Full UMLS access at uts.nlm.nih.gov._`; return { content: [{ type: "text", text }] }; } ); - index.js:429-437 (schema)Input schema defining 'term' (string) and 'vocabulary' (enum: all, SNOMEDCT_US, MSH, NCI, LNC, ICD10CM, default: 'all') parameters.
{ term: z .string() .describe("Medical term to search (e.g. 'schizophrenia', 'EGFR mutation', 'HbA1c')"), vocabulary: z .enum(["all", "SNOMEDCT_US", "MSH", "NCI", "LNC", "ICD10CM"]) .default("all") .describe("Terminology system to search within"), }, - index.js:438-492 (handler)Handler function that fetches ICD-10-CM codes from NLM clinical tables and RxNorm candidates from RxNav API, looks up MedDRA PT-to-SOC mapping, and compiles a cross-terminology result with ICD-10, MedDRA, RxNorm plus a terminology reference table.
async ({ term, vocabulary }) => { // Use NLM clinical tables for broad concept search const icdUrl = `${ICD_BASE}/search?sf=code,name&terms=${encodeURIComponent(term)}&maxList=5`; const rxUrl = `${RXNAV_BASE}/approximateTerm.json?term=${encodeURIComponent(term)}&maxEntries=3`; const [icdData, rxData] = await Promise.all([ apiFetch(icdUrl).catch(() => null), apiFetch(rxUrl).catch(() => null), ]); const icdResults = icdData?.[3] || []; const rxCandidates = rxData?.approximateGroup?.candidate || []; const meddra = MEDDRA_PT_SOC[term.toLowerCase()]; let text = `## Medical Concept: "${term}"\n\n`; text += `### ICD-10-CM (Diagnosis Coding)\n`; if (icdResults.length) { text += icdResults.map(([c, n]) => `- **${c}** — ${n}`).join("\n") + "\n\n"; } else { text += `_No direct ICD-10-CM match found._\n\n`; } text += `### MedDRA (Safety Reporting)\n`; if (meddra) { text += `- **PT:** ${term.charAt(0).toUpperCase() + term.slice(1)}\n`; text += `- **SOC:** ${meddra}\n\n`; } else { text += `_Not in curated MedDRA index. Verify at meddra.org._\n\n`; } text += `### RxNorm (Drug Concepts)\n`; if (rxCandidates.length) { text += rxCandidates.slice(0, 3).map( c => `- **RxCUI ${c.rxcui}** (score: ${c.score})` ).join("\n") + "\n\n"; } else { text += `_Not a drug concept or no RxNorm match found._\n\n`; } text += `### Terminology System Reference\n`; text += `| System | Domain | Use Case |\n`; text += `|--------|--------|----------|\n`; text += `| **ICD-10-CM** | Diagnoses | Billing, epidemiology, EHR |\n`; text += `| **MedDRA** | AEs & conditions | Pharmacovigilance, regulatory |\n`; text += `| **RxNorm** | Drugs | Prescribing, interoperability |\n`; text += `| **SNOMED CT** | Clinical concepts | EHR, clinical decision support |\n`; text += `| **LOINC** | Lab & obs | Lab results, vital signs |\n`; text += `| **NCI Thesaurus** | Oncology | Cancer trials, FDA submissions |\n`; text += `| **CTCAE** | AE grading | Oncology trial safety |\n\n`; text += `_Source: NIH NLM APIs (ICD-10-CM, RxNav). Full UMLS access at uts.nlm.nih.gov._`; return { content: [{ type: "text", text }] }; } - index.js:28-34 (helper)Utility function apiFetch() used by the handler to make HTTP GET requests to NIH NLM 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(); } - index.js:69-116 (helper)MEDDRA_PT_SOC lookup table used by the handler to map MedDRA Preferred Terms to System Organ Classes.
// Common MedDRA PT → SOC mappings for fast lookup (curated subset) const MEDDRA_PT_SOC = { "nausea": "Gastrointestinal disorders", "vomiting": "Gastrointestinal disorders", "diarrhoea": "Gastrointestinal disorders", "diarrhea": "Gastrointestinal disorders", "constipation": "Gastrointestinal disorders", "abdominal pain": "Gastrointestinal disorders", "headache": "Nervous system disorders", "dizziness": "Nervous system disorders", "tremor": "Nervous system disorders", "somnolence": "Nervous system disorders", "seizure": "Nervous system disorders", "insomnia": "Psychiatric disorders", "depression": "Psychiatric disorders", "anxiety": "Psychiatric disorders", "agitation": "Psychiatric disorders", "hallucination": "Psychiatric disorders", "suicidal ideation": "Psychiatric disorders", "rash": "Skin and subcutaneous tissue disorders", "pruritus": "Skin and subcutaneous tissue disorders", "alopecia": "Skin and subcutaneous tissue disorders", "fatigue": "General disorders and administration site conditions", "pyrexia": "General disorders and administration site conditions", "oedema": "General disorders and administration site conditions", "edema": "General disorders and administration site conditions", "dyspnoea": "Respiratory, thoracic and mediastinal disorders", "dyspnea": "Respiratory, thoracic and mediastinal disorders", "cough": "Respiratory, thoracic and mediastinal disorders", "pneumonia": "Infections and infestations", "neutropenia": "Blood and lymphatic system disorders", "thrombocytopenia": "Blood and lymphatic system disorders", "anaemia": "Blood and lymphatic system disorders", "anemia": "Blood and lymphatic system disorders", "hypertension": "Vascular disorders", "hypotension": "Vascular disorders", "tachycardia": "Cardiac disorders", "qt prolongation": "Cardiac disorders", "myocardial infarction": "Cardiac disorders", "alanine aminotransferase increased": "Investigations", "aspartate aminotransferase increased": "Investigations", "weight decreased": "Investigations", "weight increased": "Investigations", "creatinine increased": "Investigations", "renal failure": "Renal and urinary disorders", "hepatotoxicity": "Hepatobiliary disorders", "liver injury": "Hepatobiliary disorders", };