get_annotations_for_bioentity
Retrieve Gene Ontology annotations for a specific biological entity with filtering options for GO terms, evidence types, and 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")
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bioentity_id | Yes | ||
| go_terms | No | ||
| evidence_types | No | ||
| aspect | No | ||
| limit | No |
Input Schema (JSON Schema)
Implementation Reference
- src/noctua_mcp/mcp_server.py:1667-1769 (handler)Primary handler implementation for the 'get_annotations_for_bioentity' MCP tool. Decorated with @mcp.tool() for automatic registration. Fetches GO annotations using AmigoClient, processes results into structured format with summary statistics by aspect and evidence type. Handles parsing of comma-separated filters and error cases.@mcp.tool() 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) }
- src/noctua_mcp/mcp_server.py:1667-1667 (registration)The @mcp.tool() decorator registers the get_annotations_for_bioentity function as an MCP tool with FastMCP, making it available via list_tools() and callable through the MCP protocol.@mcp.tool()