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

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",

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