Skip to main content
Glama
biocontext-ai

BioContextAI Knowledgebase MCP

Official

bc_get_term_details

Retrieve detailed information about biomedical ontology terms including definitions, synonyms, and hierarchical relationships from verified knowledge bases.

Instructions

Get comprehensive details about a specific ontology term including definition, synonyms, hierarchical relationships.

Returns: dict: Term details with id, label, definition, synonyms, hierarchical info, num_descendants or error message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
term_idYesTerm ID in CURIE format (e.g., 'EFO:0000001', 'GO:0008150')
ontology_idYesOntology ID where the term is defined (e.g., 'efo', 'go', 'chebi')

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function for bc_get_term_details tool. Decorated with @core_mcp.tool(), fetches term details from OLS API using the provided term_id (CURIE) and ontology_id, returns structured details or error.
    @core_mcp.tool()
    def get_term_details(
        term_id: Annotated[str, Field(description="Term ID in CURIE format (e.g., 'EFO:0000001', 'GO:0008150')")],
        ontology_id: Annotated[
            str, Field(description="Ontology ID where the term is defined (e.g., 'efo', 'go', 'chebi')")
        ],
    ) -> Dict[str, Any]:
        """Get comprehensive details about a specific ontology term including definition, synonyms, hierarchical relationships.
    
        Returns:
            dict: Term details with id, label, definition, synonyms, hierarchical info, num_descendants or error message.
        """
        if not term_id:
            return {"error": "term_id must be provided"}
        if not ontology_id:
            return {"error": "ontology_id must be provided"}
    
        # Double URL encode the term IRI
        import urllib.parse
    
        term_iri = f"http://purl.obolibrary.org/obo/{term_id.replace(':', '_')}"
        encoded_iri = urllib.parse.quote(urllib.parse.quote(term_iri, safe=""), safe="")
    
        url = f"https://www.ebi.ac.uk/ols4/api/v2/ontologies/{ontology_id}/entities/{encoded_iri}"
    
        try:
            response = requests.get(url)
            response.raise_for_status()
    
            data = response.json()
    
            if not data:
                return {"error": "Term not found"}
    
            # Extract comprehensive term information
            term_details = {
                "id": data.get("curie", "").replace(":", "_"),
                "curie": data.get("curie", ""),
                "label": data.get("label", ""),
                "definition": data.get("definition", ""),
                "synonyms": data.get("synonym", []),
                "ontology_name": data.get("ontologyName", ""),
                "ontology_prefix": data.get("ontologyPrefix", ""),
                "is_defining_ontology": data.get("isDefiningOntology", False),
                "is_obsolete": data.get("isObsolete", False),
                "is_preferred_root": data.get("isPreferredRoot", False),
                "has_hierarchical_children": data.get("hasHierarchicalChildren", False),
                "has_hierarchical_parents": data.get("hasHierarchicalParents", False),
                "has_direct_children": data.get("hasDirectChildren", False),
                "has_direct_parents": data.get("hasDirectParents", False),
                "num_descendants": data.get("numDescendants", 0),
                "num_hierarchical_descendants": data.get("numHierarchicalDescendants", 0),
                "appears_in": data.get("appearsIn", []),
                "defined_by": data.get("definedBy", []),
                "imported": data.get("imported", False),
            }
    
            return {"term_details": term_details}
    
        except requests.exceptions.RequestException as e:
            return {"error": f"Failed to fetch term details: {e!s}"}
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the return structure ('dict: Term details with id, label...') and potential error handling ('or error message'), which adds useful context beyond basic functionality. However, it lacks details on permissions, rate limits, or data freshness that would be helpful for a read operation.

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 key return elements, the second specifies the return type and structure. Every word earns its place with zero redundancy, making it easy to parse quickly.

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 moderate complexity (2 required parameters), 100% schema coverage, and presence of an output schema (implied by the return description), the description is reasonably complete. It covers purpose, return structure, and error handling, though additional behavioral context (like rate limits) would enhance completeness for a tool with no annotations.

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

Parameters3/5

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

Schema description coverage is 100%, providing clear descriptions for both parameters (term_id and ontology_id) with format examples. The description adds no additional parameter semantics beyond what the schema already documents, so it meets the baseline of 3 where the schema does the heavy lifting.

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 ('Get comprehensive details') and resource ('about a specific ontology term'), listing key return fields like definition, synonyms, and hierarchical relationships. It distinguishes from sibling tools like 'bc_search_ontology_terms' (search) and 'bc_get_term_hierarchical_children' (children only) by focusing on comprehensive term details.

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

Usage Guidelines3/5

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

The description implies usage for retrieving detailed term information, but does not explicitly state when to use this tool versus alternatives like 'bc_search_ontology_terms' for searching or 'bc_get_term_hierarchical_children' for hierarchical data. No exclusions or prerequisites are mentioned, leaving usage context somewhat implicit.

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