Skip to main content
Glama

score_genes_cell_cycle

Analyze single-cell RNA sequencing data to score cell cycle genes and assign S and G2M phases using provided gene lists.

Instructions

Score cell cycle genes and assign cell cycle phases

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
s_genesYesList of genes associated with S phase.
g2m_genesYesList of genes associated with G2M phase.
gene_poolNoGenes for sampling the reference set. Default is all genes.
n_binsNoNumber of expression level bins for sampling.
score_nameNoName of the field to be added in .obs. If None, the scores are added as 'S_score' and 'G2M_score'.
random_stateNoThe random seed for sampling.
use_rawNoWhether to use raw attribute of adata. Defaults to True if .raw is present.

Implementation Reference

  • Generic handler function for all tl tools, including score_genes_cell_cycle. It retrieves the Scanpy function from tl_func dict using the tool name, inspects parameters, passes matching arguments, executes on active adata, logs the operation, and handles errors.
    def run_tl_func(ads, func, arguments):
        adata = ads.adata_dic[ads.active]
        if func not in tl_func:
            raise ValueError(f"Unsupported function: {func}")
        run_func = tl_func[func]
        parameters = inspect.signature(run_func).parameters
        kwargs = {k: arguments.get(k) for k in parameters if k in arguments}    
        try:
            res = run_func(adata, **kwargs)
            add_op_log(adata, run_func, kwargs)
        except Exception as e:
            logger.error(f"Error running function {func}: {e}")
            raise
        return 
  • Pydantic model defining the input schema for the score_genes_cell_cycle tool, including required S and G2M gene lists, optional parameters like gene_pool, n_bins, score_name, random_state, use_raw, with validators.
    class ScoreGenesCellCycleModel(JSONParsingModel):
        """Input schema for the score_genes_cell_cycle tool that scores cell cycle genes."""
        
        s_genes: List[str] = Field(
            ...,  # Required field
            description="List of genes associated with S phase."
        )
        g2m_genes: List[str] = Field(
            ...,  # Required field
            description="List of genes associated with G2M phase."
        )
        gene_pool: Optional[List[str]] = Field(
            default=None,
            description="Genes for sampling the reference set. Default is all genes."
        )
        n_bins: int = Field(
            default=25,
            description="Number of expression level bins for sampling.",
            gt=0
        )
        score_name: Optional[str] = Field(
            default=None,
            description="Name of the field to be added in .obs. If None, the scores are added as 'S_score' and 'G2M_score'."
        )
        random_state: int = Field(
            default=0,
            description="The random seed for sampling."
        )
        use_raw: Optional[bool] = Field(
            default=None,
            description="Whether to use raw attribute of adata. Defaults to True if .raw is present."
        )
        
        @field_validator('s_genes', 'g2m_genes')
        def validate_gene_lists(cls, v: List[str]) -> List[str]:
            """Validate gene lists are not empty"""
            if len(v) == 0:
                raise ValueError("Gene list cannot be empty")
            return v
        
        @field_validator('n_bins')
        def validate_positive_integers(cls, v: int) -> int:
            """Validate positive integers"""
            if v <= 0:
                raise ValueError("n_bins must be a positive integer")
            return v
  • Creates the MCP Tool object for score_genes_cell_cycle, specifying name, description, and input schema from ScoreGenesCellCycleModel.
    # Add score_genes_cell_cycle tool
    score_genes_cell_cycle_tool = types.Tool(
        name="score_genes_cell_cycle",
        description="Score cell cycle genes and assign cell cycle phases",
        inputSchema=ScoreGenesCellCycleModel.model_json_schema(),
    )
  • Maps the tool name 'score_genes_cell_cycle' to the underlying Scanpy function sc.tl.score_genes_cell_cycle in the tl_func dictionary used by the handler.
    tl_func = {
        "tsne": sc.tl.tsne,
        "umap": sc.tl.umap,
        "draw_graph": sc.tl.draw_graph,
        "diffmap": sc.tl.diffmap,
        "embedding_density": sc.tl.embedding_density,
        "leiden": sc.tl.leiden,
        "louvain": sc.tl.louvain,
        "dendrogram": sc.tl.dendrogram,
        "dpt": sc.tl.dpt,
        "paga": sc.tl.paga,
        "ingest": sc.tl.ingest,
        "rank_genes_groups": sc.tl.rank_genes_groups,
        "filter_rank_genes_groups": sc.tl.filter_rank_genes_groups,
        "marker_gene_overlap": sc.tl.marker_gene_overlap,
        "score_genes": sc.tl.score_genes,
        "score_genes_cell_cycle": sc.tl.score_genes_cell_cycle,
    }
  • Registers the score_genes_cell_cycle_tool in the tl_tools dictionary, which is exposed via list_tools() in the MCP server.
    tl_tools = {
        "tsne": tsne_tool,
        "umap": umap_tool,
        "draw_graph": draw_graph_tool,
        "diffmap": diffmap_tool,
        "embedding_density": embedding_density_tool,
        "leiden": leiden_tool,
        "louvain": louvain_tool,
        "dendrogram": dendrogram_tool,
        "dpt": dpt_tool,
        "paga": paga_tool,
        "ingest": ingest_tool,
        "rank_genes_groups": rank_genes_groups_tool,
        "filter_rank_genes_groups": filter_rank_genes_groups_tool,
        "marker_gene_overlap": marker_gene_overlap_tool,
        "score_genes": score_genes_tool,
        "score_genes_cell_cycle": score_genes_cell_cycle_tool,
    }
Behavior2/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 states the tool 'scores' and 'assigns' phases, implying a computational analysis that likely modifies or adds data, but it doesn't specify whether this is a read-only operation, what data structures are affected (e.g., modifies an 'adata' object), or any side effects like performance considerations. For a tool with 7 parameters and no annotations, this is insufficient detail.

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?

The description is extremely concise with a single sentence: 'Score cell cycle genes and assign cell cycle phases.' It is front-loaded and wastes no words, making it easy to parse quickly. Every word contributes directly to stating the tool's purpose without redundancy.

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

Completeness2/5

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

Given the complexity of a 7-parameter tool with no annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., scores, phase assignments, or modified data), how results are structured, or any behavioral nuances. For a computational biology tool likely operating on complex data like 'adata', this leaves significant gaps in understanding.

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 description adds no parameter-specific information beyond what the input schema provides. Since schema description coverage is 100%, the schema already fully documents all 7 parameters with clear descriptions and defaults. The description doesn't compensate by explaining interactions between parameters or high-level usage patterns, so it 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 tool's purpose: 'Score cell cycle genes and assign cell cycle phases.' It specifies the action ('score' and 'assign') and the domain ('cell cycle genes' and 'cell cycle phases'), making the intent unambiguous. However, it doesn't differentiate from sibling tools like 'score_genes' or 'ccc', which might have overlapping functionality, preventing a perfect score.

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 provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, such as requiring specific data formats or preprocessing steps, nor does it compare to sibling tools like 'score_genes' or 'ccc' that might handle similar tasks. This lack of context leaves the agent without usage direction.

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/huang-sh/scmcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server