Skip to main content
Glama

dpt

Analyze single-cell RNA sequencing data to compute diffusion pseudotime, revealing cellular trajectories and branching patterns in development or disease progression.

Instructions

Diffusion Pseudotime (DPT) analysis

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
n_dcsNoThe number of diffusion components to use.
n_branchingsNoNumber of branchings to detect.
min_group_sizeNoDuring recursive splitting of branches, do not consider groups that contain less than min_group_size data points. If a float, refers to a fraction of the total number of data points.
allow_kendall_tau_shiftNoIf a very small branch is detected upon splitting, shift away from maximum correlation in Kendall tau criterion to stabilize the splitting.
neighbors_keyNoIf specified, dpt looks .uns[neighbors_key] for neighbors settings and uses the corresponding connectivities and distances.

Implementation Reference

  • Handler function that executes all tl tools, including 'dpt', by dispatching to scanpy.tl.dpt with validated arguments from the input schema.
    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 and validation for the 'dpt' tool.
    class DPTModel(JSONParsingModel):
        """Input schema for the Diffusion Pseudotime (DPT) tool."""
        
        n_dcs: int = Field(
            default=10,
            description="The number of diffusion components to use.",
            gt=0
        )
        n_branchings: int = Field(
            default=0,
            description="Number of branchings to detect.",
            ge=0
        )
        min_group_size: float = Field(
            default=0.01,
            description="During recursive splitting of branches, do not consider groups that contain less than min_group_size data points. If a float, refers to a fraction of the total number of data points.",
            gt=0,
            le=1.0
        )
        allow_kendall_tau_shift: bool = Field(
            default=True,
            description="If a very small branch is detected upon splitting, shift away from maximum correlation in Kendall tau criterion to stabilize the splitting."
        )
        neighbors_key: Optional[str] = Field(
            default=None,
            description="If specified, dpt looks .uns[neighbors_key] for neighbors settings and uses the corresponding connectivities and distances."
        )
        
        @field_validator('n_dcs')
        def validate_n_dcs(cls, v: int) -> int:
            """Validate n_dcs is positive"""
            if v <= 0:
                raise ValueError("n_dcs must be a positive integer")
            return v
        
        @field_validator('n_branchings')
        def validate_n_branchings(cls, v: int) -> int:
            """Validate n_branchings is non-negative"""
            if v < 0:
                raise ValueError("n_branchings must be a non-negative integer")
            return v
        
        @field_validator('min_group_size')
        def validate_min_group_size(cls, v: float) -> float:
            """Validate min_group_size is between 0 and 1"""
            if v <= 0 or v > 1:
                raise ValueError("min_group_size must be between 0 and 1")
            return v
  • Creates and defines the MCP Tool object for 'dpt', including name, description, and input schema reference.
    # Add dpt tool
    dpt_tool = types.Tool(
        name="dpt",
        description="Diffusion Pseudotime (DPT) analysis",
        inputSchema=DPTModel.model_json_schema(),
    )
  • MCP server registration handler that lists tools, including 'dpt' from tl_tools when MODULE=='tl' or 'all'.
    @server.list_tools()
    async def list_tools() -> list[types.Tool]:
        if MODULE == "io":
            tools = io_tools.values()
        elif MODULE == "pp":
            tools = pp_tools.values()
        elif MODULE == "tl":
            tools = tl_tools.values()
        elif MODULE == "pl":
            tools = pl_tools.values()
        elif MODULE == "util":
            tools = util_tools.values()
        else:
            tools = [
                *io_tools.values(),
                *pp_tools.values(),
                *tl_tools.values(),
                *pl_tools.values(),
                *util_tools.values(),
                *ccc_tools.values(),
            ]
        return tools
  • Helper dictionary that maps the 'dpt' tool name to the underlying scanpy.tl.dpt function for execution.
    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,
    }
Behavior1/5

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

No annotations are provided, so the description must fully disclose behavioral traits. However, it only names the analysis without describing what the tool does operationally—whether it modifies data, returns results, requires preprocessed inputs, or has side effects. This leaves critical behavioral aspects undefined, failing to compensate for the absence of annotations.

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 extremely concise—a single phrase—which avoids waste. However, it is under-specified rather than efficiently informative. It is front-loaded but lacks substance, so it doesn't fully earn a top score for conciseness, as brevity here comes at the cost of clarity.

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 implied by 5 parameters and no output schema, the description is incomplete. It fails to explain what DPT analysis entails, what it returns, or how it fits into a workflow. Without annotations or output schema, the description should provide more context to guide the agent, but it does not, leaving significant gaps in understanding the tool's role and results.

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 input schema has 100% description coverage, with each parameter well-documented in the schema itself. The tool description adds no additional meaning or context about the parameters, such as typical values or interactions. Since the schema does the heavy lifting, a baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

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

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Diffusion Pseudotime (DPT) analysis' is tautological, essentially restating the tool name with minimal elaboration. It lacks a specific verb or clear action, making the purpose vague. While it hints at a computational biology analysis, it doesn't distinguish this tool from siblings like 'diffmap' or 'paga' that might also involve trajectory or pseudotime analysis.

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

Usage Guidelines1/5

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

There is no guidance on when to use this tool versus alternatives. The description provides no context, prerequisites, or exclusions. Given the sibling tools include other analysis methods (e.g., 'diffmap', 'paga', 'tsne'), the lack of usage guidelines leaves the agent without direction on selecting this specific tool.

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