Skip to main content
Glama
biocontext-ai

BioContextAI Knowledgebase MCP

Official

bc_get_panglaodb_marker_genes

Retrieve marker genes from PanglaoDB dataset with filters for species, scores, organ, cell type, or gene symbol to identify cell-specific genetic markers.

Instructions

Retrieve marker genes from PanglaoDB dataset with optional filters. Supports filtering by species, scores, organ, cell type, gene symbol.

Returns: dict: Markers array with gene symbols, cell types, organs, sensitivity/specificity scores or error message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
speciesYesSpecies: 'Hs' for Human or 'Mm' for Mouse
min_sensitivityNoMinimum sensitivity score (0-1), applied to species-specific column
min_specificityNoMinimum specificity score (0-1), applied to species-specific column
organNoOrgan filter (e.g., 'Brain', 'Lung'), case-insensitive
cell_typeNoCell type filter (e.g., 'Smooth muscle cells', 'T cells'), case-insensitive
gene_symbolNoGene symbol filter (e.g., 'MAFB', 'SYNPO'), case-insensitive

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Main handler for get_panglaodb_marker_genes tool (likely 'bc_get_panglaodb_marker_genes' under BC server namespace). Includes schema via Annotated Pydantic fields and full execution logic using pandas.
    @core_mcp.tool()
    def get_panglaodb_marker_genes(
        species: Annotated[str, Field(description="Species: 'Hs' for Human or 'Mm' for Mouse")],
        min_sensitivity: Annotated[
            Optional[float],
            Field(
                description="Minimum sensitivity score (0-1), applied to species-specific column",
                ge=0,
                le=1,
            ),
        ] = None,
        min_specificity: Annotated[
            Optional[float],
            Field(
                description="Minimum specificity score (0-1), applied to species-specific column",
                ge=0,
                le=1,
            ),
        ] = None,
        organ: Annotated[
            Optional[str],
            Field(description="Organ filter (e.g., 'Brain', 'Lung'), case-insensitive"),
        ] = None,
        cell_type: Annotated[
            Optional[str],
            Field(description="Cell type filter (e.g., 'Smooth muscle cells', 'T cells'), case-insensitive"),
        ] = None,
        gene_symbol: Annotated[
            Optional[str],
            Field(description="Gene symbol filter (e.g., 'MAFB', 'SYNPO'), case-insensitive"),
        ] = None,
    ) -> Dict[str, Any]:
        """Retrieve marker genes from PanglaoDB dataset with optional filters. Supports filtering by species, scores, organ, cell type, gene symbol.
    
        Returns:
            dict: Markers array with gene symbols, cell types, organs, sensitivity/specificity scores or error message.
        """
        panglao_db_df = get_panglaodb_df()
        if panglao_db_df is None:
            return {"error": "PanglaoDB data is not loaded. Check server logs."}
    
        # Make a copy to avoid modifying the original DataFrame
        filtered_df = panglao_db_df.copy()
    
        # Filter by species - properly handle NaN values
        if species == "Hs":
            filtered_df = filtered_df[filtered_df["species"].fillna("").str.contains("Hs", na=False)]
            sensitivity_col = "sensitivity_human"
            specificity_col = "specificity_human"
        elif species == "Mm":
            filtered_df = filtered_df[filtered_df["species"].fillna("").str.contains("Mm", na=False)]
            sensitivity_col = "sensitivity_mouse"
            specificity_col = "specificity_mouse"
        else:
            return {"error": "Invalid species. Use 'Hs' for Human or 'Mm' for Mouse."}
    
        # Filter by minimum sensitivity with NaN handling
        if min_sensitivity is not None:
            # Convert NaN values to appropriate defaults (e.g., 0)
            filtered_df = filtered_df[filtered_df[sensitivity_col].fillna(0) >= min_sensitivity]
    
        # Filter by minimum specificity with NaN handling
        if min_specificity is not None:
            filtered_df = filtered_df[filtered_df[specificity_col].fillna(0) >= min_specificity]
    
        # Filter by organ (case-insensitive)
        if organ is not None:
            filtered_df = filtered_df[filtered_df["organ"].fillna("").str.lower().str.contains(organ.lower(), na=False)]
    
        # Filter by cell type (case-insensitive)
        if cell_type is not None:
            filtered_df = filtered_df[
                filtered_df["cell type"].fillna("").str.lower().str.contains(cell_type.lower(), na=False)
            ]
    
        # Filter by gene symbols (case-insensitive)
        if gene_symbol is not None:
            filtered_df = filtered_df[
                filtered_df["official gene symbol"].fillna("").str.contains(gene_symbol, case=False, na=False)
            ]
    
        # Convert the filtered DataFrame to a list of dictionaries
        result = filtered_df.to_dict(orient="records")
    
        return {"markers": result}
  • Helper function that loads the PanglaoDB marker genes dataset from TSV file into a pandas DataFrame, used by the main handler.
    def get_panglaodb_df() -> pd.DataFrame | None:
        """Load the PanglaoDB dataset into a pandas DataFrame.
    
        Returns:
            pd.DataFrame | None: The loaded DataFrame or None if loading fails.
        """
        # Construct the path to the TSV file
        panglao_db_path = Path(__file__).parent / "data" / "PanglaoDB_markers_27_Mar_2020.tsv"
    
        # Load the database into a pandas DataFrame
        try:
            panglao_db_df = pd.read_csv(panglao_db_path, sep="\t", engine="python", header=0)
            # Replace empty strings and other potential non-values with NaN for consistency
            panglao_db_df = panglao_db_df.replace("", pd.NA)
            return panglao_db_df
        except FileNotFoundError:
            print(f"Error: PanglaoDB file not found at {panglao_db_path}")
            return None
        except Exception as e:
            print(f"Error loading PanglaoDB file: {e}")
            return None
  • MCP server initialization with name 'BC', where tools like get_panglaodb_marker_genes are registered via @core_mcp.tool() decorators (tools invoked without prefix in tests, possibly namespaced as bc_ in protocol).
    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?

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions filtering capabilities and the return format, but lacks critical details like whether this is a read-only operation, potential rate limits, error handling specifics beyond 'error message', or data freshness. For a data retrieval tool with 6 parameters, this is insufficient.

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 efficiently structured in two sentences: one stating purpose and filters, another describing returns. There's no wasted text, though it could be slightly more front-loaded with the core purpose. Overall, it's appropriately concise for the tool's complexity.

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 has an output schema (implied by 'Has output schema: true'), the description doesn't need to detail return values. However, with no annotations and moderate complexity (6 parameters, 1 required), the description should provide more behavioral context about the retrieval operation, such as data source characteristics or usage constraints, which are currently missing.

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?

The schema description coverage is 100%, so parameters are well-documented in the schema itself. The description adds minimal value by listing filter types ('species, scores, organ, cell type, gene symbol') but doesn't provide additional context beyond what's in the parameter descriptions. This meets the baseline for high schema coverage.

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 action ('Retrieve marker genes') and resource ('from PanglaoDB dataset'), making the purpose understandable. However, it doesn't explicitly differentiate this tool from its sibling 'bc_get_panglaodb_options', which appears related to the same dataset, so it doesn't achieve full sibling distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description mentions optional filters but provides no guidance on when to use this tool versus alternatives. There's no mention of prerequisites, typical use cases, or comparison with sibling tools like 'bc_get_panglaodb_options', leaving the agent with minimal context for selection.

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