get_hierarchy
Navigate the vocabulary hierarchy for a medical concept to find broader ancestors or narrower descendants, essential for building phenotype concept sets.
Instructions
Navigate the vocabulary hierarchy for a concept. Use direction='up' for ancestors (broader terms like 'Diabetes mellitus' → 'Metabolic disease'), direction='down' for descendants (narrower terms, essential for building concept sets in phenotype definitions), or direction='both' for full hierarchical context. Results are capped at max_results nodes (default 500). If truncated, the response will indicate total available count so you can narrow with vocabulary_ids or reduce max_levels.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| concept_id | Yes | The OMOP concept_id | |
| direction | No | Hierarchy direction: 'up' for ancestors, 'down' for descendants, 'both' for full context (default: 'both') | both |
| max_levels | No | Maximum levels to traverse (default 5 for 'up', 10 for 'down', 5/3 for 'both') | |
| max_results | No | Maximum number of nodes to return (1-500, default 500). Use a smaller value for broad concepts. | |
| vocabulary_ids | No | Comma-separated vocabulary IDs to filter results. Leave empty for all. |