Skip to main content
Glama
biocontext-ai

BioContextAI Knowledgebase MCP

Official

bc_get_string_id

Convert protein identifiers to STRING database IDs for reliable biomedical data integration. Maps gene names, synonyms, or UniProt IDs to standardized STRING identifiers.

Instructions

Map protein identifiers (gene names, synonyms, UniProt IDs) to STRING database IDs. Using STRING IDs improves reliability.

Returns: str or dict: STRING ID string (e.g., '9606.ENSP00000269305') or dict with error message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
protein_symbolYesProtein name or identifier (e.g., 'TP53')
speciesNoSpecies taxonomy ID (e.g., '9606' for human)
return_fieldNoField to return: 'stringId' or 'preferredName'stringId
limitNoMaximum number of matches to return

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The core handler function for the tool. Decorated with @core_mcp.tool(), it queries the STRING-DB API to retrieve STRING IDs for given protein symbols and species. This function implements the logic of the 'bc_get_string_id' tool (prefixed upon server import).
    @core_mcp.tool()
    def get_string_id(
        protein_symbol: Annotated[str, Field(description="Protein name or identifier (e.g., 'TP53')")],
        species: Annotated[str, Field(description="Species taxonomy ID (e.g., '9606' for human)")] = "",
        return_field: Annotated[str, Field(description="Field to return: 'stringId' or 'preferredName'")] = "stringId",
        limit: Annotated[int, Field(description="Maximum number of matches to return")] = 1,
    ) -> Union[dict, str]:
        """Map protein identifiers (gene names, synonyms, UniProt IDs) to STRING database IDs. Using STRING IDs improves reliability.
    
        Returns:
            str or dict: STRING ID string (e.g., '9606.ENSP00000269305') or dict with error message.
        """
        url = f"https://string-db.org/api/json/get_string_ids?identifiers={protein_symbol}&echo_query=1&limit={limit}"
    
        if species:
            url += f"&species={species}"
    
        try:
            response = requests.get(url)
            response.raise_for_status()
    
            data = response.json()
    
            if isinstance(data, dict) and "error" in data:
                return data
    
            if not data:
                return {"error": f"No STRING ID found for protein: {protein_symbol}"}
    
            return data[0].get(return_field)
        except requests.exceptions.RequestException as e:
            return {"error": f"Failed to fetch STRING ID: {e!s}"}
  • Defines the core_mcp FastMCP server instance named 'BC'. Tools decorated with @core_mcp.tool() are registered here and later prefixed with 'bc_' when imported into the main app.
    core_mcp = FastMCP(  # type: ignore
        "BC",
        instructions="Provides access to biomedical knowledge bases.",
    )
  • Star import of the stringdb module in core/__init__.py, which imports and exposes the get_string_id function, triggering its registration in core_mcp due to the decorator.
    from .stringdb import *
  • Imports the core_mcp server into the main mcp_app with prefix slugify('BC')='bc', making the tool available as 'bc_get_string_id'.
    for mcp in [core_mcp, *(await get_openapi_mcps())]:
        await mcp_app.import_server(
            mcp,
            slugify(mcp.name),
        )
  • Exports the get_string_id function from its implementation module for use in other modules and core imports.
    from ._get_string_id import get_string_id
    from ._get_string_interactions import get_string_interactions
    from ._get_string_network_image import get_string_network_image
    from ._get_string_similarity_scores import get_string_similarity_scores
    
    __all__ = [
        "get_string_id",
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It mentions the return types (str or dict with error) and the reliability benefit, but lacks details on error conditions, rate limits, authentication needs, or side effects. It adds some context but is incomplete for behavioral disclosure.

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 front-loaded with the core purpose in the first sentence, followed by return details. It is efficient with two sentences, but the second sentence could be more integrated or omitted if output schema covers returns, though no output schema is indicated in context signals.

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 4 parameters with 100% schema coverage and no annotations, the description is reasonably complete for a mapping tool. It covers purpose and returns, but lacks output schema details (context signals indicate no output schema, so description should explain returns more fully). It could benefit from more behavioral context but is adequate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/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 all parameters well. The description adds value by explaining the purpose of mapping identifiers and the reliability improvement, but does not provide additional syntax or format details beyond the schema. With 0 parameters, baseline would be 4, but here it's slightly above baseline due to contextual enhancement.

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 verb ('Map') and resource ('protein identifiers to STRING database IDs'), specifying the input types (gene names, synonyms, UniProt IDs) and the benefit ('improves reliability'). It distinguishes from siblings like bc_get_uniprot_id_by_protein_symbol by focusing on STRING IDs rather than UniProt IDs.

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 for mapping protein identifiers to STRING IDs to improve reliability, but does not explicitly state when to use this tool versus alternatives like bc_get_ensembl_id_from_gene_symbol or bc_get_uniprot_id_by_protein_symbol. No exclusions or prerequisites are mentioned.

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