Skip to main content
Glama
biocontext-ai

BioContextAI Knowledgebase MCP

Official

bc_get_interpro_entry

Retrieve detailed metadata for InterPro entries including family, domain, or functional site information from member databases like PFAM and PROSITE, with optional protein interactions, pathways, and cross-references.

Instructions

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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
interpro_idYesInterPro ID (e.g., 'IPR000001')
include_interactionsNoInclude protein-protein interactions data
include_pathwaysNoInclude pathway information
include_cross_referencesNoInclude cross-references to other databases

Implementation Reference

  • Handler function decorated with @core_mcp.tool() implementing the logic to fetch InterPro entry details from EBI API, including optional interactions, pathways, and cross-references. The tool is named 'get_interpro_entry' in core_mcp but prefixed to 'bc_get_interpro_entry' in the main server.
    @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}"}
  • Registers tools from core_mcp (named 'BC', slugified to 'bc') into the main mcp_app by importing the server with prefix 'bc', resulting in tool name 'bc_get_interpro_entry'.
    for mcp in [core_mcp, *(await get_openapi_mcps())]:
        await mcp_app.import_server(
            mcp,
            slugify(mcp.name),
        )
    logger.info("MCP server setup complete.")
  • Defines core_mcp FastMCP server instance named 'BC', which provides the namespace for tool registration via @core_mcp.tool(). Tools are later prefixed with 'bc_'.
    core_mcp = FastMCP(  # type: ignore
        "BC",
        instructions="Provides access to biomedical knowledge bases.",
    )
  • Exports the get_interpro_entry tool function for use in the module namespace.
    from ._get_interpro_entry import get_interpro_entry
    from ._get_protein_domains import get_protein_domains
    from ._search_interpro_entries import search_interpro_entries
    
    __all__ = [
        "get_interpro_entry",
        "get_protein_domains",
        "search_interpro_entries",
    ]

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