Skip to main content
Glama
seandavi

OLS MCP Server

by seandavi

get_term_info

Retrieve detailed information about biological and medical ontology terms from the Ontology Lookup Service to support accurate research and analysis.

Instructions

Get detailed information about a specific term.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes

Implementation Reference

  • The primary handler function for the 'get_term_info' MCP tool. Decorated with @mcp.tool() for registration. It queries the OLS API /api/terms endpoint with the provided term ID, extracts the first term from the embedded response, validates it against the DetailedTermInfo Pydantic model, and returns the validated object or an error message.
    @mcp.tool() async def get_term_info( id: Annotated[ str, ("Can be the IRI (Example : http://purl.obolibrary.org/obo/DUO_0000017)" ", short form (Example : DUO_0000017), or obo ID (Example: DUO:0000017) of the term") ], ) -> DetailedTermInfo | str: """Get detailed information about a specific term.""" url = f"{OLS_BASE_URL}/api/terms" try: response = await client.get(url, params={"id": id}) response.raise_for_status() data = response.json() embedded = data.get("_embedded", {}) if "terms" in embedded: terms = embedded["terms"] return DetailedTermInfo.model_validate(terms[0]) return f"Term with ID '{id}' not found in OLS." except httpx.HTTPError as e: return f"Error getting term info: {str(e)}"
  • Pydantic model used for output validation in the get_term_info tool. Extends TermInfo with additional fields for description and synonyms.
    class DetailedTermInfo(TermInfo): description: Optional[list[str]] = Field(None, description="Definition of the term") synonyms: Optional[list[str]] = Field(None, description="List of synonyms for the term")
  • Base Pydantic model for term information, extended by DetailedTermInfo for the get_term_info tool output schema.
    class TermInfo(BaseModel): iri: HttpUrl = Field(..., description="IRI of the term") ontology_name: str = Field(..., description="Name of the ontology containing the term") short_form: str = Field(..., description="Short form identifier for the term") label: str = Field(..., description="Human-readable label for the term") obo_id: Optional[str] = Field(None, description="OBOLibrary ID for the term", alias="oboId") is_obsolete: Optional[bool] = Field(False, description="Indicates if the term is obsolete")

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