Skip to main content
Glama
seandavi

OLS MCP Server

by seandavi

get_term_children

Retrieve direct child terms of a specific ontology term using its IRI and ontology identifier, with options to include obsolete entities and limit results. Outputs in JSON.

Instructions

Get direct children of a specific term.

Args: term_iri: The IRI of the term ontology: The ontology identifier include_obsolete: Include obsolete entities size: Maximum number of results

Returns: JSON formatted list of child terms

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
include_obsoleteNo
ontologyYes
sizeNo
term_iriYes

Implementation Reference

  • The primary handler function for the 'get_term_children' tool. It is decorated with @mcp.tool(), which registers it with the FastMCP server. The function makes an API call to the Ontology Lookup Service (OLS) to retrieve direct children of a specified term IRI within an ontology, formats the response, and handles errors.
    async def get_term_children( term_iri: str, ontology: str, include_obsolete: bool = False, size: int = 20 ) -> str: """Get direct children of a specific term. Args: term_iri: The IRI of the term ontology: The ontology identifier include_obsolete: Include obsolete entities size: Maximum number of results Returns: JSON formatted list of child terms """ encoded_iri = url_encode_iri(term_iri) params: dict[str, Any] = { "page": 0, "size": size, "includeObsoleteEntities": include_obsolete } url = f"{OLS_BASE_URL}/api/v2/ontologies/{ontology}/classes/{encoded_iri}/children" try: response = await client.get(url, params=params) response.raise_for_status() data = response.json() return format_response(data, size) except httpx.HTTPError as e: return f"Error getting term children: {str(e)}"

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/seandavi/ols-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server