Skip to main content
Glama
biocontext-ai

BioContextAI Knowledgebase MCP

Official

bc_get_available_ontologies

Discover available biomedical ontologies with metadata to identify relevant terminology resources for research and data integration.

Instructions

Query OLS for all available ontologies with their metadata. Use this first to discover available ontologies.

Returns: dict: Ontologies list with id, name, description, prefix, homepage, number of terms, status or error message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that implements the logic to retrieve all available ontologies from the OLS API, paginating through results and extracting metadata. Registered as an MCP tool via @core_mcp.tool() decorator.
    @core_mcp.tool()
    def get_available_ontologies() -> Dict[str, Any]:
        """Query OLS for all available ontologies with their metadata. Use this first to discover available ontologies.
    
        Returns:
            dict: Ontologies list with id, name, description, prefix, homepage, number of terms, status or error message.
        """
        url = "https://www.ebi.ac.uk/ols4/api/v2/ontologies"
    
        try:
            # First request to get total count
            params = {
                "size": "100",  # OLS now limits to 100 elements per page
                "page": "0",
                "lang": "en",
            }
    
            response = requests.get(url, params=params)
            response.raise_for_status()
    
            data = response.json()
    
            if not data.get("elements"):
                return {"error": "No ontologies found"}
    
            ontologies: list[Dict[str, Any]] = []
            total_elements = data.get("totalElements", 0)
            total_pages = (total_elements + 99) // 100  # Ceiling division
    
            # Iterate through all pages
            for page in range(total_pages):
                params["page"] = str(page)
                response = requests.get(url, params=params)
                response.raise_for_status()
    
                data = response.json()
    
                # Extract ontology information
                page_ontologies = [
                    {
                        "id": element.get("ontologyId", ""),
                        "name": element.get("label", ""),
                        "description": element.get("definition", ""),
                        "prefix": element.get("ontologyPrefix", ""),
                        "base_uri": element.get("baseUri", ""),
                        "homepage": element.get("homepage", ""),
                        "mailing_list": element.get("mailingList", ""),
                        "number_of_terms": element.get("numberOfTerms", 0),
                        "number_of_properties": element.get("numberOfProperties", 0),
                        "number_of_individuals": element.get("numberOfIndividuals", 0),
                        "last_loaded": element.get("lastLoaded", ""),
                        "status": element.get("status", ""),
                    }
                    for element in data.get("elements", [])
                ]
    
                ontologies.extend(page_ontologies)
    
            # Sort by ontology ID for consistency
            ontologies.sort(key=lambda x: x["id"])
    
            return {
                "ontologies": ontologies,
                "total_ontologies": total_elements,
                "page_info": {
                    "total_pages": total_pages,
                    "num_elements": len(ontologies),
                },
            }
    
        except requests.exceptions.RequestException as e:
            return {"error": f"Failed to fetch available ontologies: {e!s}"}
  • Defines the core_mcp FastMCP server instance named 'BC', to which all core tools including get_available_ontologies are registered via decorators.
    from fastmcp import FastMCP
    
    core_mcp = FastMCP(  # type: ignore
        "BC",
        instructions="Provides access to biomedical knowledge bases.",
    )
  • Registers the core_mcp server (containing get_available_ontologies) into the main BioContextAI MCP app with prefix 'bc' (slugify('BC')), making the tool available as 'bc_get_available_ontologies'.
    logger.info("Setting up MCP server...")
    for mcp in [core_mcp, *(await get_openapi_mcps())]:
        await mcp_app.import_server(
            mcp,
            slugify(mcp.name),
        )
    logger.info("MCP server setup complete.")
  • Re-exports the get_available_ontologies function for convenient import in core/__init__.py.
    from ._get_available_ontologies import get_available_ontologies
    from ._get_cell_ontology_terms import get_cell_ontology_terms
    from ._get_chebi_terms_by_chemical import get_chebi_terms_by_chemical
    from ._get_efo_id_by_disease_name import get_efo_id_by_disease_name
    from ._get_go_terms_by_gene import get_go_terms_by_gene
    from ._get_term_details import get_term_details
    from ._get_term_hierarchical_children import get_term_hierarchical_children
    from ._search_ontology_terms import search_ontology_terms
    
    __all__ = [
        "get_available_ontologies",
        "get_cell_ontology_terms",
        "get_chebi_terms_by_chemical",
        "get_efo_id_by_disease_name",
        "get_go_terms_by_gene",
        "get_term_details",
        "get_term_hierarchical_children",
        "search_ontology_terms",
    ]
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It describes the action ('Query OLS') and return format ('dict: Ontologies list with id, name, description, prefix, homepage, number of terms, status or error message'), which adds useful context. However, it lacks details on potential behavioral traits such as rate limits, authentication needs, or error handling specifics, leaving some gaps in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured in two sentences: the first states the purpose and usage guideline, and the second specifies the return format. Every sentence adds essential information without waste, making it highly concise and well-organized.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (0 parameters) and the presence of an output schema, the description is largely complete. It clearly explains what the tool does, when to use it, and the return format. However, without annotations, it could benefit from more behavioral details (e.g., error conditions or performance notes) to achieve full completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately focuses on the tool's purpose and output without redundant parameter details, earning a high score for adding value beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Query OLS for all available ontologies with their metadata') and distinguishes this tool from its siblings by focusing on ontology discovery rather than querying specific ontologies or other data types. It explicitly mentions 'Use this first to discover available ontologies,' which highlights its unique role in the workflow.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool: 'Use this first to discover available ontologies.' This indicates it should be used as an initial step before other ontology-related operations, distinguishing it from sibling tools like 'bc_search_ontology_terms' or 'bc_get_term_details' that likely require prior knowledge of ontologies.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/biocontext-ai/knowledgebase-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server