Skip to main content
Glama
biocontext-ai

BioContextAI Knowledgebase MCP

Official

bc_get_alphafold_info_by_protein_symbol

Retrieve AlphaFold protein structure predictions by converting protein symbols to UniProt IDs and fetching detailed structural data including PDB/CIF files and confidence scores.

Instructions

Query AlphaFold database using protein name. First converts protein symbol to UniProt ID, then fetches structure predictions.

Returns: dict: AlphaFold prediction data including PDB/CIF file URLs, confidence scores, and metadata or error message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
protein_symbolYesGene/protein name (e.g., 'SYNPO')
speciesNoTaxonomy ID (e.g., '9606' for human)9606

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'bc_get_alphafold_info_by_protein_symbol' tool. It resolves the protein symbol to a UniProt ID using another tool, then fetches AlphaFold structure predictions. Includes input schema via Pydantic Annotated Fields.
    @core_mcp.tool()
    def get_alphafold_info_by_protein_symbol(
        protein_symbol: Annotated[str, Field(description="Gene/protein name (e.g., 'SYNPO')")],
        species: Annotated[
            str,
            Field(description="Taxonomy ID (e.g., '9606' for human)"),
        ] = "9606",
    ) -> dict:
        """Query AlphaFold database using protein name. First converts protein symbol to UniProt ID, then fetches structure predictions.
    
        Returns:
            dict: AlphaFold prediction data including PDB/CIF file URLs, confidence scores, and metadata or error message.
        """
        # Get the UniProt Id from the protein_symbol
        try:
            uniprot_id = get_uniprot_id_by_protein_symbol.fn(protein_symbol, species)
    
            if uniprot_id:
                result = get_alphafold_info_by_uniprot_id(uniprot_id)
                if isinstance(result, dict) and "error" in result:
                    return {"error": result["error"]}
                elif isinstance(result, list) and len(result) > 0:
                    # If result is a list, return the first item
                    return result[0]
                elif isinstance(result, dict):
                    # If result is a dict, return it directly
                    return result
                else:
                    return {"error": "Unexpected result format from AlphaFold query"}
            else:
                return {"error": "No results found for the given protein name"}
        except requests.exceptions.RequestException as e:
            return {"error": f"Failed to fetch AlphaFold info: {e!s}"}
  • Helper function called by the handler to query AlphaFold API directly using UniProt ID.
    def get_alphafold_info_by_uniprot_id(
        uniprot_id: Annotated[str, Field(description="UniProt protein ID (e.g., 'P62258')")],
    ) -> dict:
        """Query AlphaFold database for protein structure data.
    
        Returns:
            dict: AlphaFold prediction data including PDB/CIF file URLs, confidence scores, and metadata or error message.
        """
        # Ensure the UniProt ID is in uppercase
        uniprot_id = uniprot_id.upper()
    
        # Validate the UniProt ID format
        if not re.match(r"^[A-Z0-9]{6}$", uniprot_id):
            return {"error": "Invalid UniProt ID format"}
    
        # Construct the URL for AlphaFold database query
        url = f"https://alphafold.ebi.ac.uk/api/prediction/{uniprot_id}"
    
        try:
            # Make the request and get the response
            response = requests.get(url)
            response.raise_for_status()
            return response.json()
        except requests.exceptions.RequestException as e:
            return {"error": f"Failed to fetch AlphaFold info: {e!s}"}
  • Helper tool called by the main handler (via .fn()) to resolve protein symbol and species to UniProt ID using UniProt REST API.
    @core_mcp.tool()
    def get_uniprot_id_by_protein_symbol(
        protein_symbol: Annotated[str, Field(description="Gene or protein name to search for (e.g., 'SYNPO')")],
        species: Annotated[
            str,
            Field(description="Organism taxonomy ID (e.g., '9606' for human)"),
        ] = "9606",
    ) -> str | None:
        """Retrieve UniProt accession ID from protein name and species. Returns the primary accession or None if not found.
    
        Returns:
            str or None: UniProt accession ID string (e.g., 'P04637') or None if not found.
        """
        url = f"https://rest.uniprot.org/uniprotkb/search?query=protein_name:{protein_symbol}+AND+organism_id:{species}&format=json"
    
        response = requests.get(url)
        response.raise_for_status()
        data = response.json()
    
        if data["results"]:
            return data["results"][0]["primaryAccession"]
    
        return None
  • The FastMCP server instance 'core_mcp' with prefix 'BC' to which all tools including 'bc_get_alphafold_info_by_protein_symbol' are registered via decorators.
    core_mcp = FastMCP(  # type: ignore
        "BC",
        instructions="Provides access to biomedical knowledge bases.",
    )
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions the two-step process (conversion then fetch) which adds useful context, but doesn't disclose behavioral traits like error handling (beyond mentioning 'error message'), rate limits, authentication needs, or what happens if the protein symbol isn't found. For a tool with no annotations, this leaves significant gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized with three sentences: purpose statement, process explanation, and return format. It's front-loaded with the core functionality. The second sentence could be slightly more concise, but overall it's efficient with minimal waste.

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 parameters, 100% schema coverage, output schema exists), the description is reasonably complete. The output schema means the description doesn't need to detail return values, and it covers the key two-step process. However, with no annotations, it could better address behavioral aspects like error conditions or performance expectations.

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%, so the schema already documents both parameters thoroughly. The description doesn't add any parameter-specific information beyond what's in the schema (e.g., it doesn't explain format constraints or provide examples beyond the schema's 'e.g., SYNPO'). Baseline 3 is appropriate when 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 tool's purpose: 'Query AlphaFold database using protein name' with specific verbs ('converts', 'fetches') and resources (AlphaFold database, UniProt ID). It distinguishes from sibling tools like 'bc_get_uniprot_id_by_protein_symbol' by specifying the two-step conversion and structure prediction fetch.

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 context through 'First converts protein symbol to UniProt ID', suggesting this tool is for when you have a protein symbol rather than a direct UniProt ID. However, it doesn't explicitly state when to use this vs. alternatives like 'bc_get_uniprot_protein_info' or provide exclusion criteria.

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