Skip to main content
Glama
geneontology

Noctua MCP Server

Official
by geneontology

get_annotations_for_bioentity

Retrieve Gene Ontology annotations and evidence for a specific biological entity, with options to filter by GO terms, evidence types, or functional aspects.

Instructions

Get all GO annotations (evidence) for a specific bioentity.

Args: bioentity_id: The bioentity ID (e.g., "UniProtKB:P12345") go_terms: Comma-separated GO terms to filter (includes child terms) evidence_types: Comma-separated evidence codes to filter (e.g., "IDA,IPI") aspect: GO aspect filter - "C", "F", or "P" limit: Maximum number of results (default: 100)

Returns: Dictionary containing: - bioentity_id: The queried bioentity - annotations: List of annotation results - summary: Count by aspect and evidence type

Examples: # Get all annotations for a protein get_annotations_for_bioentity("UniProtKB:P53762")

# Get only experimental evidence
get_annotations_for_bioentity(
    "UniProtKB:P53762",
    evidence_types="IDA,IPI,IMP"
)

# Get annotations for specific GO terms
get_annotations_for_bioentity(
    "UniProtKB:P53762",
    go_terms="GO:0005634,GO:0005737"
)

# Get only molecular function annotations
get_annotations_for_bioentity(
    "UniProtKB:P53762",
    aspect="F"
)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bioentity_idYes
go_termsNo
evidence_typesNo
aspectNo
limitNo

Implementation Reference

  • The primary handler function for the MCP tool 'get_annotations_for_bioentity'. It parses input parameters, queries the AmigoClient for GO annotations associated with a specific bioentity (with optional filters), computes summary statistics, and formats the response.
    async def get_annotations_for_bioentity(
        bioentity_id: str,
        go_terms: Optional[str] = None,
        evidence_types: Optional[str] = None,
        aspect: Optional[str] = None,
        limit: int = 100
    ) -> Dict[str, Any]:
        """
        Get all GO annotations (evidence) for a specific bioentity.
    
        Args:
            bioentity_id: The bioentity ID (e.g., "UniProtKB:P12345")
            go_terms: Comma-separated GO terms to filter (includes child terms)
            evidence_types: Comma-separated evidence codes to filter (e.g., "IDA,IPI")
            aspect: GO aspect filter - "C", "F", or "P"
            limit: Maximum number of results (default: 100)
    
        Returns:
            Dictionary containing:
            - bioentity_id: The queried bioentity
            - annotations: List of annotation results
            - summary: Count by aspect and evidence type
    
        Examples:
            # Get all annotations for a protein
            get_annotations_for_bioentity("UniProtKB:P53762")
    
            # Get only experimental evidence
            get_annotations_for_bioentity(
                "UniProtKB:P53762",
                evidence_types="IDA,IPI,IMP"
            )
    
            # Get annotations for specific GO terms
            get_annotations_for_bioentity(
                "UniProtKB:P53762",
                go_terms="GO:0005634,GO:0005737"
            )
    
            # Get only molecular function annotations
            get_annotations_for_bioentity(
                "UniProtKB:P53762",
                aspect="F"
            )
        """
        # Parse comma-separated lists
        go_terms_list = None
        if go_terms:
            go_terms_list = [t.strip() for t in go_terms.split(",")]
    
        evidence_list = None
        if evidence_types:
            evidence_list = [e.strip() for e in evidence_types.split(",")]
    
        try:
            with AmigoClient() as client:
                results = client.get_annotations_for_bioentity(
                    bioentity_id=bioentity_id,
                    go_terms_closure=go_terms_list,
                    evidence_types=evidence_list,
                    aspect=aspect,
                    limit=limit
                )
    
                # Calculate summary statistics
                aspect_counts: Dict[str, int] = {}
                evidence_counts: Dict[str, int] = {}
                for r in results:
                    aspect_counts[r.aspect] = aspect_counts.get(r.aspect, 0) + 1
                    evidence_counts[r.evidence_type] = evidence_counts.get(r.evidence_type, 0) + 1
    
                return {
                    "bioentity_id": bioentity_id,
                    "annotations": [
                        {
                            "go_term": r.annotation_class,
                            "go_term_label": r.annotation_class_label,
                            "aspect": r.aspect,
                            "evidence_type": r.evidence_type,
                            "evidence": r.evidence,
                            "evidence_label": r.evidence_label,
                            "reference": r.reference,
                            "assigned_by": r.assigned_by,
                            "date": r.date,
                            "qualifier": r.qualifier,
                            "annotation_extension": r.annotation_extension
                        }
                        for r in results
                    ],
                    "summary": {
                        "total": len(results),
                        "by_aspect": aspect_counts,
                        "by_evidence_type": evidence_counts
                    }
                }
    
        except Exception as e:
            return {
                "error": "Failed to get annotations",
                "message": str(e)
            }

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/geneontology/noctua-mcp'

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