Skip to main content
Glama

merge_adata

Combine multiple AnnData objects for single-cell RNA sequencing analysis by concatenating along observations or variables with configurable alignment options.

Instructions

merge multiple adata

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
axisNoWhich axis to concatenate along. 'obs' or 0 for observations, 'var' or 1 for variables.obs
joinNoHow to align values when concatenating. If 'outer', the union of the other axis is taken. If 'inner', the intersection.inner
mergeNoHow elements not aligned to the axis being concatenated along are selected.
uns_mergeNoHow the elements of .uns are selected. Uses the same set of strategies as the merge argument, except applied recursively.
labelNolabel different adata, Column in axis annotation (i.e. .obs or .var) to place batch information in.
keysNoNames for each object being added. These values are used for column values for label or appended to the index if index_unique is not None.
index_uniqueNoWhether to make the index unique by using the keys. If provided, this is the delimiter between '{orig_idx}{index_unique}{key}'.
fill_valueNoWhen join='outer', this is the value that will be used to fill the introduced indices.
pairwiseNoWhether pairwise elements along the concatenated dimension should be included.

Implementation Reference

  • The core handler function that merges multiple AnnData objects using anndata.concat, taking adata_dic and kwargs.
    def merge_adata(adata_dic, **kwargs):
        import anndata as ad
        adata =  ad.concat(adata_dic, **kwargs)
        return adata
  • Pydantic model defining the input schema for the merge_adata tool, including parameters like axis, join, merge, etc., passed via kwargs to ad.concat.
    class ConcatAdataModel(JSONParsingModel):
        """Model for concatenating AnnData objects"""
        
        axis: Literal['obs', 0, 'var', 1] = Field(
            default='obs',
            description="Which axis to concatenate along. 'obs' or 0 for observations, 'var' or 1 for variables."
        )
        join: Literal['inner', 'outer'] = Field(
            default='inner',
            description="How to align values when concatenating. If 'outer', the union of the other axis is taken. If 'inner', the intersection."
        )
        merge: Optional[Literal['same', 'unique', 'first', 'only']] = Field(
            default=None,
            description="How elements not aligned to the axis being concatenated along are selected."
        )
        uns_merge: Optional[Literal['same', 'unique', 'first', 'only']] = Field(
            default=None,
            description="How the elements of .uns are selected. Uses the same set of strategies as the merge argument, except applied recursively."
        )
        label: Optional[str] = Field(
            default=None,
            description="label different adata, Column in axis annotation (i.e. .obs or .var) to place batch information in. "
        )
        keys: Optional[List[str]] = Field(
            default=None,
            description="Names for each object being added. These values are used for column values for label or appended to the index if index_unique is not None."
        )
        index_unique: Optional[str] = Field(
            default=None,
            description="Whether to make the index unique by using the keys. If provided, this is the delimiter between '{orig_idx}{index_unique}{key}'."
        )
        fill_value: Optional[Any] = Field(
            default=None,
            description="When join='outer', this is the value that will be used to fill the introduced indices."
        )
        pairwise: bool = Field(
            default=False,
            description="Whether pairwise elements along the concatenated dimension should be included."
        )
  • Registers the merge_adata tool as an MCP types.Tool, specifying name, description, and input schema.
    merge_adata_tool = types.Tool(
        name="merge_adata",
        description="merge multiple adata",
        inputSchema=ConcatAdataModel.model_json_schema(),
    )
  • Registers the merge_adata_tool in the util_tools dictionary for tool dispatching.
    util_tools = {
        "mark_var": mark_var_tool,
        "list_var": list_var_tool,
        "list_obs": list_obs_tool,  
        "check_gene": check_gene_tool,
        "merge_adata": merge_adata_tool,
    }
  • Special handling in run_util_func for merge_adata, which merges all adata_dic and updates the active adata.
    if func == "merge_adata":           
        res = merge_adata(ads.adata_dic)
        ads.adata_dic = {}
        ads.active = "merge_adata"
        ads.adata_dic[ads.active] = res
    else:
Behavior1/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 but fails completely. It doesn't indicate whether this is a read-only or destructive operation, what permissions might be required, what the output looks like, or any performance characteristics. The single phrase provides zero behavioral context beyond the basic action implied by the name.

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 technically concise (only three words), this represents under-specification rather than effective conciseness. The description fails to provide any meaningful information that would help an agent understand or use the tool. Every word should earn its place, but here the words don't provide sufficient value.

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?

For a complex tool with 9 parameters, no annotations, and no output schema, the description is completely inadequate. It doesn't explain what 'adata' refers to (AnnData objects), what the tool actually produces, when to use it, or any behavioral characteristics. The agent would struggle to use this tool correctly based solely on the description.

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%, meaning all 9 parameters are well-documented in the schema itself. The description adds no additional parameter information beyond what's already in the schema descriptions. According to scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no param info in the description.

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 'merge multiple adata' is a tautology that essentially restates the tool name 'merge_adata'. While it implies combining AnnData objects, it lacks specificity about what 'merge' means in this context (concatenation along specific axes) and doesn't distinguish this tool from potential sibling tools that might also manipulate AnnData objects.

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 absolutely no guidance about when to use this tool versus alternatives. There's no mention of prerequisites, typical use cases, or comparison to other data manipulation tools in the sibling list. The agent must infer usage solely from the tool name and parameter schema.

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