Skip to main content
Glama
biocontext-ai

BioContextAI Knowledgebase MCP

Official

bc_get_uniprot_id_by_protein_symbol

Find UniProt accession IDs using protein names and species taxonomy IDs to identify proteins in biological databases.

Instructions

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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
protein_symbolYesGene or protein name to search for (e.g., 'SYNPO')
speciesNoOrganism taxonomy ID (e.g., '9606' for human)9606

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function implementing the tool logic: queries UniProtKB search API with protein name and species to retrieve the primary UniProt accession ID.
    @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
  • Pydantic schema defined via Annotated Field for input parameters: protein_symbol (str) and species (str, default '9606'), output str|None.
    @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
  • Registers the core_mcp server (with this tool) into the main FastMCP app using slugify('BC')='bc' prefix, making the tool available as 'bc_get_uniprot_id_by_protein_symbol'.
    for mcp in [core_mcp, *(await get_openapi_mcps())]:
        await mcp_app.import_server(
            mcp,
            slugify(mcp.name),
        )
  • Creates the core_mcp FastMCP instance named 'BC' where tools are registered via @core_mcp.tool() decorators.
    core_mcp = FastMCP(  # type: ignore
        "BC",
        instructions="Provides access to biomedical knowledge bases.",
    )
  • Imports and uses this tool function (via .fn()) as a helper to resolve protein_symbol to uniprot_id before querying AlphaFold.
    from biocontext_kb.core.uniprot._get_uniprot_id_by_protein_symbol import (
        get_uniprot_id_by_protein_symbol,
    )
Behavior4/5

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

With no annotations provided, the description carries full burden and does well: it discloses the return behavior (primary accession or None), gives an example format ('P04637'), and clarifies the 'not found' case. It doesn't mention rate limits, authentication needs, or whether this is a read-only operation, but covers the core behavioral outcome adequately.

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

Conciseness5/5

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

Two sentences with zero waste: the first states purpose and inputs, the second clarifies return values. Every word earns its place, and information is front-loaded appropriately. No redundant or verbose phrasing.

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, lookup operation), no annotations, but with an output schema (implied by 'Returns' section), the description is mostly complete. It covers purpose, inputs, and return behavior. The output schema handles return values, so the description doesn't need to duplicate that. Minor gap: no mention of error cases beyond 'not found'.

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 fully documents both parameters. The description adds no additional parameter semantics beyond what's in the schema (e.g., no extra format details, validation rules, or examples). This meets the baseline 3 for high schema coverage.

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 specific action ('Retrieve UniProt accession ID'), the target resource ('from protein name and species'), and distinguishes it from sibling tools like 'bc_get_uniprot_protein_info' (which returns detailed protein info) and 'bc_get_ensembl_id_from_gene_symbol' (which returns Ensembl IDs). It explicitly defines the verb+resource+scope combination.

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 when needing a UniProt ID from protein/species data, but doesn't explicitly state when to use this tool versus alternatives like 'bc_get_string_id' or 'bc_get_kegg_id_by_gene_symbol'. It provides context about what it returns but lacks explicit when/when-not guidance or named alternatives.

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