get_ontology_info
Retrieve detailed information about a specific ontology using the Ontology Lookup Service (OLS) API to support accurate biological and medical data retrieval.
Instructions
Get detailed information about a specific ontology.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ontology_id | Yes |
Implementation Reference
- src/ols_mcp_server/server.py:110-125 (handler)The async handler function implementing the 'get_ontology_info' MCP tool. It fetches ontology details from the OLS API using the provided ontology_id, validates the response with the OntologyInfo Pydantic model, and returns it or an error message. The @mcp.tool() decorator registers it as an MCP tool.@mcp.tool() async def get_ontology_info( ontology_id: Annotated[str, "Ontology identifier (e.g., 'efo', 'go', 'mondo')"] ) -> OntologyInfo | str: """Get detailed information about a specific ontology.""" url = f"{OLS_BASE_URL}/api/v2/ontologies/{ontology_id}" try: response = await client.get(url) response.raise_for_status() data = response.json() return OntologyInfo.model_validate(data) except httpx.HTTPError as e: return f"Error getting ontology info: {str(e)}"
- src/ols_mcp_server/models.py:4-15 (schema)Pydantic model (OntologyInfo) used for input/output schema validation of the ontology information returned by the get_ontology_info tool.class OntologyInfo(BaseModel): id: str = Field(..., description="Unique identifier for the ontology", alias="ontologyId") title: str = Field(..., description="Name of the ontology") version: Optional[str] = Field(None, description="Version of the ontology") description: Optional[str] = Field(None, description="Description of the ontology") domain: Optional[str] = Field(None, description="Domain of the ontology") homepage: Optional[HttpUrl] = Field(None, description="URL for the ontology") preferred_prefix: Optional[str] = Field(None, description="Preferred prefix for the ontology", alias="preferredPrefix") number_of_terms: Optional[int] = Field(None, description="Number of terms in the ontology") number_of_classes: Optional[int] = Field(None, description="Number of classes in the ontology", alias="numberOfClasses") repository: Optional[HttpUrl] = Field(None, description="Repository URL for the ontology")
- src/ols_mcp_server/server.py:110-110 (registration)The @mcp.tool() decorator that registers the get_ontology_info function as an MCP tool in the FastMCP server.@mcp.tool()