Skip to main content
Glama
OMOPHub MCP Server

OMOPHub MCP Server

Official
by OMOPHub

List descendants or ancestors of an OMOP concept

get_hierarchy
Read-only

Retrieve ancestors or descendants of an OMOP concept to navigate its vocabulary hierarchy, with direction filters and pagination for multi-page traversal.

Instructions

List descendants of a known OMOP concept using direction='down', or ancestors using 'up'. Use page=1 and the requested page_size. While has_more is true, set the next call’s page argument to the returned next_page and keep the same page size and filters. Read truncated to determine whether the upstream row cap was reached. A combined view cannot establish exhaustive coverage.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "concept_id": "<concept_id>"
    },
    "name": "get_hierarchy"
  }
}

Input Schema

NameRequiredDescriptionDefault
pageNoPage of ancestors or descendants. Combined views support only the first page.
directionNoHierarchy direction: 'up' for ancestors, 'down' for descendants, 'both' for full context (default: 'both')both
page_sizeNoNodes per direction or page. Overrides max_results.
concept_idYesThe OMOP concept_id
max_levelsNoMaximum levels to traverse (default 5 for 'up', 10 for 'down', 5/3 for 'both')
max_resultsNoMaximum number of nodes to return (1-200, default 200). Use a smaller value for broad concepts.
vocabulary_idsNoComma-separated vocabulary IDs to filter results. Leave empty for all.

Output Schema

NameRequiredDescriptionDefault
has_moreNo
ancestorsNo
directionYes
next_pageNo
truncatedNo
concept_idYes
descendantsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed12 schema fields changedv1.7.0
    • addedInput schema / properties / concept_id / anyOf
      Added value: +[
      +  {
      +    "type": "number"
      +  },
      +  {
      +    "pattern": "^[0-9]{1,16}$",
      +    "type": "string"
      +  }
      +]
    • removedInput schema / properties / concept_id / type
      Removed value: -"number"
    • addedInput schema / properties / max_levels / anyOf
      Added value: +[
      +  {
      +    "type": "number"
      +  },
      +  {
      +    "pattern": "^[0-9]{1,16}$",
      +    "type": "string"
      +  }
      +]
    • removedInput schema / properties / max_levels / type
      Removed value: -"number"
    • addedInput schema / properties / max_results / anyOf
      Added value: +[
      +  {
      +    "maximum": 200,
      +    "minimum": 1,
      +    "type": "number"
      +  },
      +  {
      +    "pattern": "^[0-9]{1,16}$",
      +    "type": "string"
      +  }
      +]
    • removedInput schema / properties / max_results / default
      Removed value: -200
    • removedInput schema / properties / max_results / maximum
      Removed value: -200
    • removedInput schema / properties / max_results / minimum
      Removed value: -1
    • removedInput schema / properties / max_results / type
      Removed value: -"number"
    • addedInput schema / properties / page
      Added value: +{
      +  "anyOf": [
      +    {
      +      "maximum": 9007199254740991,
      +      "minimum": 1,
      +      "type": "integer"
      +    },
      +    {
      +      "pattern": "^[0-9]{1,16}$",
      +      "type": "string"
      +    }
      +  ],
      +  "description": "Page of ancestors or descendants. Combined views support only the first page."
      +}
    • addedInput schema / properties / page_size
      Added value: +{
      +  "anyOf": [
      +    {
      +      "maximum": 200,
      +      "minimum": 1,
      +      "type": "integer"
      +    },
      +    {
      +      "pattern": "^[0-9]{1,16}$",
      +      "type": "string"
      +    }
      +  ],
      +  "description": "Nodes per direction or page. Overrides max_results."
      +}
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": {},
      +  "properties": {
      +    "ancestors": {
      +      "items": {
      +        "additionalProperties": {},
      +        "propertyNames": {
      +          "type": "string"
      +        },
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "concept_id": {
      +      "type": "number"
      +    },
      +    "descendants": {
      +      "items": {
      +        "additionalProperties": {},
      +        "propertyNames": {
      +          "type": "string"
      +        },
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "direction": {
      +      "enum": [
      +        "up",
      +        "down",
      +        "both"
      +      ],
      +      "type": "string"
      +    },
      +    "has_more": {
      +      "type": "boolean"
      +    },
      +    "next_page": {
      +      "exclusiveMinimum": 0,
      +      "maximum": 9007199254740991,
      +      "type": "integer"
      +    },
      +    "truncated": {
      +      "type": "boolean"
      +    }
      +  },
      +  "required": [
      +    "concept_id",
      +    "direction"
      +  ],
      +  "type": "object"
      +}
  2. Changed3 schema fields changedv1.6.0
    • changedInput schema / properties / max_results / default
      Previous value: -500New value: +200
    • changedInput schema / properties / max_results / description
      Previous value: -"Maximum number of nodes to return (1-500, default 500). Use a smaller value for broad concepts."New value: +"Maximum number of nodes to return (1-200, default 200). Use a smaller value for broad concepts."
    • changedInput schema / properties / max_results / maximum
      Previous value: -500New value: +200
  3. First observedv1.5.0

TDQS

A3.7/5.0
Behavior4/5

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

Annotations already establish read-only, non-destructive, closed-world behavior, so the description's real contribution is the paging protocol (advance page to next_page while has_more is true) and the disclosure of an upstream row cap signaled by 'truncated'. The warning that a combined view cannot establish exhaustive coverage is meaningful behavioral context beyond the annotations, though traversal cost/latency is not mentioned.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose is front-loaded in the first sentence and the remaining sentences form a coherent iteration recipe with no filler. It is dense but every sentence carries operational content; minor cost is that the reading order jumps from direction to paging to a caveat without headings.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a read-only, 7-parameter traversal tool with a full output schema, the description covers the calling loop and the truncation signal that an agent must act on. Gaps are the unaddressed traversal-depth and vocabulary filter parameters and no stated prerequisite that concept_id must already be known.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description adds operational meaning for page and page_size (start at page=1, hold page size and filters constant across calls) but says nothing about max_levels, vocabulary_ids, max_results, or why direction='both' differs, leaving those entirely to the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb+resource: listing descendants/ancestors of a known OMOP concept, keyed on the direction argument. It implicitly distinguishes itself from concept-lookup siblings like get_concept by operating on hierarchy traversal, but never names a sibling or states the boundary explicitly, so it falls short of a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives directional usage for 'down' and 'up' and a clear paging procedure, which is genuinely actionable. However, it is silent on when to choose this over explore_concept or get_concept, and the default direction='both' is only hinted at via the closing caveat rather than given explicit when-to-use guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.