Skip to main content
Glama
seandavi

OLS MCP Server

by seandavi

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

Implementation Reference

  • 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)}"
  • 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")
  • The @mcp.tool() decorator that registers the get_ontology_info function as an MCP tool in the FastMCP server.
    @mcp.tool()

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