Skip to main content
Glama

paga

Analyze single-cell RNA sequencing data by abstracting cellular relationships into partition-based graphs to identify developmental trajectories and cellular transitions.

Instructions

Partition-based graph abstraction

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
groupsNoKey for categorical in adata.obs. You can pass your predefined groups by choosing any categorical annotation of observations. Default: The first present key of 'leiden' or 'louvain'.
use_rna_velocityNoUse RNA velocity to orient edges in the abstracted graph and estimate transitions. Requires that adata.uns contains a directed single-cell graph with key ['velocity_graph'].
modelNoThe PAGA connectivity model.v1.2
neighbors_keyNoIf specified, paga looks .uns[neighbors_key] for neighbors settings and uses the corresponding connectivities and distances.

Implementation Reference

  • Handler function that dispatches to sc.tl.paga (via tl_func mapping) and executes the core PAGA logic on the AnnData object.
    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 
  • PAGAModel: Pydantic model defining the input schema and validation for the 'paga' tool parameters.
    class PAGAModel(JSONParsingModel):
        """Input schema for the Partition-based Graph Abstraction (PAGA) tool."""
        
        groups: Optional[str] = Field(
            default=None,
            description="Key for categorical in adata.obs. You can pass your predefined groups by choosing any categorical annotation of observations. Default: The first present key of 'leiden' or 'louvain'."
        )
        use_rna_velocity: bool = Field(
            default=False,
            description="Use RNA velocity to orient edges in the abstracted graph and estimate transitions. Requires that adata.uns contains a directed single-cell graph with key ['velocity_graph']."
        )
        model: Literal['v1.2', 'v1.0'] = Field(
            default='v1.2',
            description="The PAGA connectivity model."
        )
        neighbors_key: Optional[str] = Field(
            default=None,
            description="If specified, paga looks .uns[neighbors_key] for neighbors settings and uses the corresponding connectivities and distances."
        )
        
        @field_validator('model')
        def validate_model(cls, v: str) -> str:
            """Validate model version is supported"""
            if v not in ['v1.2', 'v1.0']:
                raise ValueError("model must be either 'v1.2' or 'v1.0'")
            return v
  • Definition and registration of the 'paga' MCP Tool object with name, description, and input schema.
    # Add paga tool
    paga_tool = types.Tool(
        name="paga",
        description="Partition-based graph abstraction",
        inputSchema=PAGAModel.model_json_schema(),
    )
  • tl_tools dictionary registering the 'paga_tool' under the 'paga' key for server lookup.
    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,
    }
  • MCP server list_tools() method that includes 'paga' tool via tl_tools.values() for tool discovery.
    @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
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 states 'Partition-based graph abstraction' without explaining what the tool does operationally (e.g., computes connectivity, generates abstracted graphs), what it returns, or any side effects like data modification. This is inadequate for a tool with parameters and no output schema.

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

Conciseness2/5

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

While concise with a single phrase, the description is under-specified and fails to convey essential information. Conciseness should not come at the cost of clarity; this is too brief to be useful, making it inefficient rather than well-structured.

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

Completeness1/5

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

Given the complexity implied by parameters like 'use_rna_velocity' and 'model', and the lack of annotations and output schema, the description is severely incomplete. It doesn't explain the tool's purpose, behavior, or output, leaving critical gaps for an AI agent to understand and invoke it correctly.

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 parameters thoroughly. The description adds no additional meaning beyond what's in the schema, such as clarifying relationships between parameters or typical use cases. This meets the baseline of 3 when schema coverage is high.

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 'Partition-based graph abstraction' is essentially a tautology that restates the tool name 'paga' (which appears to be an acronym for Partition-based Graph Abstraction). It doesn't specify what action the tool performs (e.g., compute, generate, analyze) or what resource it operates on, making it vague and unhelpful for distinguishing from sibling tools like 'leiden' or 'louvain' that also work with graph-based clustering.

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?

The description provides no guidance on when to use this tool versus alternatives. There's no mention of context, prerequisites, or comparisons to sibling tools like 'leiden', 'louvain', or 'neighbors', which are related to graph-based analysis. This leaves the agent with no 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