Skip to main content
Glama
seandavi

OLS MCP Server

by seandavi

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
NameRequiredDescriptionDefault
ontology_idYes

Implementation Reference

  • 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)}"
  • 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")

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