bc_get_interpro_entry
Retrieve comprehensive details about InterPro entries, including protein families, domains, and functional sites, with options to include interactions, pathways, and cross-references for enhanced protein analysis.
Instructions
Get detailed information about a specific InterPro entry.
InterPro entries represent protein families, domains, and functional sites. Each entry integrates information from multiple member databases.
Args: interpro_id (str): The InterPro entry identifier (e.g., "IPR000001"). include_interactions (bool, optional): Whether to include protein-protein interactions data. Defaults to False. include_pathways (bool, optional): Whether to include pathway information. Defaults to False. include_cross_references (bool, optional): Whether to include cross-references to other databases. Defaults to False.
Returns: dict: InterPro entry data including description, type, member databases, and optional additional data
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| include_cross_references | No | Whether to include cross-references to other databases | |
| include_interactions | No | Whether to include protein-protein interactions data | |
| include_pathways | No | Whether to include pathway information | |
| interpro_id | Yes | The InterPro entry identifier (e.g., 'IPR000001') |
Implementation Reference
- Main handler for the get_interpro_entry tool (likely 'bc_get_interpro_entry' under 'BC' MCP server). Fetches InterPro entry details from EBI API with optional features. Includes inline Pydantic schema via Annotated Fields.@core_mcp.tool() def get_interpro_entry( interpro_id: Annotated[ str, Field(description="InterPro ID (e.g., 'IPR000001')"), ], include_interactions: Annotated[ bool, Field(description="Include protein-protein interactions data"), ] = False, include_pathways: Annotated[ bool, Field(description="Include pathway information"), ] = False, include_cross_references: Annotated[ bool, Field(description="Include cross-references to other databases"), ] = False, ) -> dict: """Get InterPro entry details (family, domain, or functional site). Returns metadata from member databases like PFAM, PROSITE. Returns: dict: Entry metadata including name, type, description, member databases, optionally interactions/pathways/cross-references or error message. """ # Validate InterPro ID format interpro_id = interpro_id.upper().strip() if not interpro_id.startswith("IPR") or len(interpro_id) != 9: return {"error": "Invalid InterPro ID format. Expected format: IPR000001"} base_url = f"https://www.ebi.ac.uk/interpro/api/entry/interpro/{interpro_id}" # Build query parameters for additional data params = {} extra_fields = [] if include_cross_references: extra_fields.append("cross_references") if extra_fields: params["extra_fields"] = ",".join(extra_fields) try: # Get basic entry information response = requests.get(base_url, params=params) response.raise_for_status() entry_data = response.json() if not entry_data.get("metadata"): return {"error": f"No data found for InterPro entry {interpro_id}"} result = entry_data["metadata"] # Optionally fetch interactions data if include_interactions: try: interactions_url = f"{base_url}?interactions" interactions_response = requests.get(interactions_url) if interactions_response.status_code == 200: interactions_data = interactions_response.json() result["interactions"] = interactions_data.get("results", []) except Exception: result["interactions"] = {"error": "Could not fetch interactions data"} # Optionally fetch pathways data if include_pathways: try: pathways_url = f"{base_url}?pathways" pathways_response = requests.get(pathways_url) if pathways_response.status_code == 200: pathways_data = pathways_response.json() result["pathways"] = pathways_data.get("results", []) except Exception: result["pathways"] = {"error": "Could not fetch pathways data"} return result except requests.exceptions.HTTPError as e: if e.response.status_code == 404: return {"error": f"InterPro entry {interpro_id} not found"} return {"error": f"HTTP error: {e}"} except Exception as e: return {"error": f"Exception occurred: {e!s}"}
- Input schema defined via Pydantic Annotated types and Field descriptions in the tool function signature.@core_mcp.tool() def get_interpro_entry( interpro_id: Annotated[ str, Field(description="InterPro ID (e.g., 'IPR000001')"), ], include_interactions: Annotated[ bool, Field(description="Include protein-protein interactions data"), ] = False, include_pathways: Annotated[ bool, Field(description="Include pathway information"), ] = False, include_cross_references: Annotated[ bool, Field(description="Include cross-references to other databases"), ] = False, ) -> dict: """Get InterPro entry details (family, domain, or functional site). Returns metadata from member databases like PFAM, PROSITE. Returns: dict: Entry metadata including name, type, description, member databases, optionally interactions/pathways/cross-references or error message. """ # Validate InterPro ID format interpro_id = interpro_id.upper().strip() if not interpro_id.startswith("IPR") or len(interpro_id) != 9: return {"error": "Invalid InterPro ID format. Expected format: IPR000001"} base_url = f"https://www.ebi.ac.uk/interpro/api/entry/interpro/{interpro_id}" # Build query parameters for additional data params = {} extra_fields = [] if include_cross_references: extra_fields.append("cross_references") if extra_fields: params["extra_fields"] = ",".join(extra_fields) try: # Get basic entry information response = requests.get(base_url, params=params) response.raise_for_status() entry_data = response.json() if not entry_data.get("metadata"): return {"error": f"No data found for InterPro entry {interpro_id}"} result = entry_data["metadata"] # Optionally fetch interactions data if include_interactions: try: interactions_url = f"{base_url}?interactions" interactions_response = requests.get(interactions_url) if interactions_response.status_code == 200: interactions_data = interactions_response.json() result["interactions"] = interactions_data.get("results", []) except Exception: result["interactions"] = {"error": "Could not fetch interactions data"} # Optionally fetch pathways data if include_pathways: try: pathways_url = f"{base_url}?pathways" pathways_response = requests.get(pathways_url) if pathways_response.status_code == 200: pathways_data = pathways_response.json() result["pathways"] = pathways_data.get("results", []) except Exception: result["pathways"] = {"error": "Could not fetch pathways data"} return result except requests.exceptions.HTTPError as e: if e.response.status_code == 404: return {"error": f"InterPro entry {interpro_id} not found"} return {"error": f"HTTP error: {e}"} except Exception as e: return {"error": f"Exception occurred: {e!s}"}
- src/biocontext_kb/core/interpro/__init__.py:1-1 (registration)Imports the tool function, triggering registration via @core_mcp.tool() decorator.from ._get_interpro_entry import get_interpro_entry
- src/biocontext_kb/core/__init__.py:11-11 (registration)Wildcard import from interpro module, ensuring all interpro tools including get_interpro_entry are imported and registered.from .interpro import *
- src/biocontext_kb/core/_server.py:3-6 (registration)Defines the FastMCP server instance 'BC' where all tools are registered via decorators.core_mcp = FastMCP( # type: ignore "BC", instructions="Provides access to biomedical knowledge bases.", )