get_ontology_info
Retrieve detailed information about a specific biological or medical ontology from the Ontology Lookup Service to understand its structure and content.
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-124 (handler)The handler function for the get_ontology_info tool. It makes an API request to the OLS API using the ontology_id parameter, parses the response, validates it against the OntologyInfo Pydantic model, and returns the validated data or an error message.@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 BaseModel defining the structure and validation for the OntologyInfo response 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")