Skip to main content
Glama
biocontext-ai

BioContextAI Knowledgebase MCP

Official

bc_get_reactome_info_by_identifier

Retrieve biological pathways associated with a specific identifier from the Reactome database, with filtering options for species, significance, and pathway characteristics.

Instructions

Query the Reactome API identifier endpoint.

Use this endpoint to retrieve pathways associated with a given identifier. Always provide the species parameter to ensure the correct protein is returned.

Args: identifier (str): The identifier of the element to be retrieved base_url (str): Base URL for the Reactome API interactors (bool): Include interactors species (str or list): List of species to filter the result (accepts taxonomy ids, species names and dbId) page_size (int): Pathways per page page (int): Page number sort_by (str): Field to sort results by (e.g., "ENTITIES_PVALUE", "ENTITIES_FDR") order (str): Sort order ("ASC" or "DESC") resource (str): Resource to filter by (TOTAL includes all molecule types) p_value (float): P-value threshold (only pathways with p-value <= threshold will be returned) include_disease (bool): Set to False to exclude disease pathways min_entities (int): Minimum number of contained entities per pathway max_entities (int): Maximum number of contained entities per pathway importable_only (bool): Filter to only include importable resources timeout (int): Request timeout in seconds

Returns: dict: API response data or error information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
identifierYesThe identifier of the element to be retrieved
base_urlNoBase URL for the Reactome APIhttps://reactome.org/AnalysisService
interactorsNoInclude interactors
speciesNoList of species to filter the result (accepts taxonomy ids, species names and dbId)
page_sizeNoPathways per page
pageNoPage number
sort_byNoField to sort results by (e.g., 'ENTITIES_PVALUE', 'ENTITIES_FDR')ENTITIES_PVALUE
orderNoSort order ('ASC' or 'DESC')ASC
resourceNoResource to filter by (TOTAL includes all molecule types)TOTAL
p_valueNoP-value threshold (only pathways with p-value <= threshold will be returned)
include_diseaseNoSet to False to exclude disease pathways
min_entitiesNoMinimum number of contained entities per pathway
max_entitiesNoMaximum number of contained entities per pathway
importable_onlyNoFilter to only include importable resources
timeoutNoRequest timeout in seconds

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the tool. It is decorated with @core_mcp.tool() and implements the logic to query the Reactome API's identifier endpoint for pathways associated with the given identifier, with extensive parameter support for filtering and pagination.
    @core_mcp.tool()
    def get_reactome_info_by_identifier(
        identifier: Annotated[str, Field(description="The identifier of the element to be retrieved")],
        base_url: Annotated[
            str, Field(description="Base URL for the Reactome API")
        ] = "https://reactome.org/AnalysisService",
        interactors: Annotated[bool, Field(description="Include interactors")] = False,
        species: Annotated[
            Optional[Union[str, List[str]]],
            Field(description="List of species to filter the result (accepts taxonomy ids, species names and dbId)"),
        ] = None,
        page_size: Annotated[int, Field(description="Pathways per page", ge=1)] = 20,
        page: Annotated[int, Field(description="Page number", ge=1)] = 1,
        sort_by: Annotated[
            str,
            Field(description="Field to sort results by (e.g., 'ENTITIES_PVALUE', 'ENTITIES_FDR')"),
        ] = "ENTITIES_PVALUE",
        order: Annotated[str, Field(description="Sort order ('ASC' or 'DESC')")] = "ASC",
        resource: Annotated[
            str,
            Field(description="Resource to filter by (TOTAL includes all molecule types)"),
        ] = "TOTAL",
        p_value: Annotated[
            float,
            Field(
                description="P-value threshold (only pathways with p-value <= threshold will be returned)",
                ge=0,
                le=1,
            ),
        ] = 1.0,
        include_disease: Annotated[bool, Field(description="Set to False to exclude disease pathways")] = True,
        min_entities: Annotated[
            Optional[int],
            Field(description="Minimum number of contained entities per pathway"),
        ] = None,
        max_entities: Annotated[
            Optional[int],
            Field(description="Maximum number of contained entities per pathway"),
        ] = None,
        importable_only: Annotated[bool, Field(description="Filter to only include importable resources")] = False,
        timeout: Annotated[int, Field(description="Request timeout in seconds", ge=1)] = 30,
    ) -> Dict[str, Any]:
        """Query the Reactome API identifier endpoint.
    
        Use this endpoint to retrieve pathways associated with a given identifier.
        Always provide the species parameter to ensure the correct protein is returned.
    
        Args:
            identifier (str): The identifier of the element to be retrieved
            base_url (str): Base URL for the Reactome API
            interactors (bool): Include interactors
            species (str or list): List of species to filter the result (accepts taxonomy ids, species names and dbId)
            page_size (int): Pathways per page
            page (int): Page number
            sort_by (str): Field to sort results by (e.g., "ENTITIES_PVALUE", "ENTITIES_FDR")
            order (str): Sort order ("ASC" or "DESC")
            resource (str): Resource to filter by (TOTAL includes all molecule types)
            p_value (float): P-value threshold (only pathways with p-value <= threshold will be returned)
            include_disease (bool): Set to False to exclude disease pathways
            min_entities (int): Minimum number of contained entities per pathway
            max_entities (int): Maximum number of contained entities per pathway
            importable_only (bool): Filter to only include importable resources
            timeout (int): Request timeout in seconds
    
        Returns:
            dict: API response data or error information
        """
        # Input validation
        if not identifier:
            return {"error": "Identifier cannot be empty"}
    
        if order not in ["ASC", "DESC"]:
            return {"error": "Order must be either 'ASC' or 'DESC'"}
    
        if p_value < 0 or p_value > 1:
            return {"error": "P-value must be between 0 and 1"}
    
        # Build endpoint URL
        endpoint = f"{base_url.rstrip('/')}/identifier/{identifier}"
    
        # Prepare parameters
        params: dict[str, Union[str, int, float]] = {
            "interactors": str(interactors).lower(),
            "pageSize": page_size,
            "page": page,
            "sortBy": sort_by,
            "order": order,
            "resource": resource,
            "pValue": p_value,
            "includeDisease": str(include_disease).lower(),
            "importableOnly": str(importable_only).lower(),
        }
    
        # Add optional parameters if provided
        if species:
            if isinstance(species, list):
                params["species"] = ",".join(str(s) for s in species)
            else:
                params["species"] = species
    
        if min_entities is not None:
            params["min"] = min_entities
    
        if max_entities is not None:
            params["max"] = max_entities
    
        try:
            # Make the request
            response = requests.get(endpoint, params=params, timeout=timeout)
    
            # Return the JSON response if successful
            if response.status_code == 200:
                return response.json()
            elif response.status_code == 404:
                return {"error": f"Identifier '{identifier}' not found"}
            elif response.status_code == 400:
                return {"error": f"Invalid parameters: {response.text}"}
            else:
                return {
                    "error": f"HTTP error occurred: {response.status_code}",
                    "details": response.text,
                }
    
        except requests.exceptions.ConnectionError as conn_err:
            return {"error": f"Connection error: {conn_err!s}"}
        except requests.exceptions.Timeout:
            return {"error": f"Request timed out after {timeout} seconds"}
        except requests.exceptions.RequestException as req_err:
            return {"error": f"Request error: {req_err!s}"}
        except Exception as err:
            return {"error": f"Unexpected error: {err!s}"}
  • Imports all from reactome module, which triggers the registration of the get_reactome_info_by_identifier tool into core_mcp via its @tool decorator.
    from .reactome import *
  • Imports the core_mcp (named 'BC') into the main mcp_app with slugified prefix 'bc', effectively registering all core tools with 'bc_' prefix, e.g., 'bc_get_reactome_info_by_identifier'.
    for mcp in [core_mcp, *(await get_openapi_mcps())]:
        await mcp_app.import_server(
            mcp,
            slugify(mcp.name),
        )
  • Defines the core_mcp FastMCP server instance named 'BC', into which individual tools are registered via decorators.
    core_mcp = FastMCP(  # type: ignore
        "BC",
        instructions="Provides access to biomedical knowledge bases.",
    )
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes the tool as a query/retrieval operation, implying it's read-only and non-destructive, but doesn't explicitly state this. It mentions 'API response data or error information' for returns, adding some context, but lacks details on rate limits, authentication needs, or error handling. The description adds moderate value but leaves gaps for a tool with 15 parameters.

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

Conciseness3/5

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

The description is structured with a purpose statement, usage note, parameter list, and return info, but it's verbose due to the lengthy parameter repetition. The 'Args:' section is redundant with the schema and could be condensed. While front-loaded with key info, the bulk of the text doesn't earn its place efficiently, reducing conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (15 parameters, no annotations, but with output schema), the description is moderately complete. It covers purpose, key usage note, and parameters, and the output schema handles return values. However, for a query tool with many filtering options, it lacks behavioral details like pagination behavior, error cases, or performance considerations, leaving room for improvement.

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 all 15 parameters thoroughly. The description lists parameters in an 'Args:' section, but this largely repeats what's in the schema (e.g., 'identifier (str): The identifier of the element to be retrieved' mirrors the schema). It adds minimal semantic value beyond the schema, such as emphasizing the species parameter, but doesn't provide additional context like examples or interdependencies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/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 the Reactome API identifier endpoint' and 'retrieve pathways associated with a given identifier.' It specifies the verb ('query'), resource ('Reactome API identifier endpoint'), and outcome ('retrieve pathways'), distinguishing it from sibling tools that query different biological databases or endpoints. However, it doesn't explicitly differentiate from hypothetical similar Reactome query tools.

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 provides some usage guidance with 'Always provide the species parameter to ensure the correct protein is returned,' which implies a best practice. However, it lacks explicit when-to-use vs. alternatives, prerequisites, or comparisons with sibling tools (e.g., when to use this over bc_get_go_terms_by_gene). The guidance is implied but not comprehensive.

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