Skip to main content
Glama

analyze_spatial_statistics

DestructiveIdempotent

Analyze spatial statistics and autocorrelation patterns.

Instructions

Analyze spatial statistics and autocorrelation patterns.

Args:
    data_id: Dataset ID
    params: Analysis parameters (analysis_type, cluster_key, genes). See SpatialStatisticsParameters for all types.

gene_selection='all' computes moran/geary for every gene; the full per-gene
table (rank, statistic, p, FDR) is stored at results_key, only top genes are returned.

Input Schema

NameRequiredDescriptionDefault
paramsNo
data_idYes

Output Schema

NameRequiredDescriptionDefault
data_idYes
warningsNoNon-fatal conditions that may affect result interpretation.
results_keyNo
top_featuresNo
analysis_typeYes
n_significantNo
spatial_graphNo
summary_metricsNo
n_features_analyzedNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv1.6.0
    • addedInput schema / $defs / SpatialStatisticsParameters / properties / gene_selection
      Added value: +{
      +  "default": "hvg",
      +  "description": "Genes analyzed when genes is None. 'hvg': top n_top_genes highly variable genes. 'all': every gene of the expression matrix (moran and geary only); the per-gene table (rank, statistic, p, FDR q) is stored in adata.uns[results_key], and only the top genes are returned.",
      +  "enum": [
      +    "hvg",
      +    "all"
      +  ],
      +  "title": "Gene Selection",
      +  "type": "string"
      +}
    • addedOutput schema / properties / spatial_graph
      Added value: +{
      +  "anyOf": [
      +    {
      +      "additionalProperties": true,
      +      "type": "object"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Spatial Graph"
      +}
  2. Changed3 schema fields changedv1.5.3
    • addedOutput schema / properties / n_significant / anyOf
      Added value: +[
      +  {
      +    "type": "integer"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedOutput schema / properties / n_significant / default
      Previous value: -0New value: +null
    • removedOutput schema / properties / n_significant / type
      Removed value: -"integer"
  3. Changed5 schema fields changedv1.3.2
    • addedInput schema / $defs / SpatialStatisticsParameters / additionalProperties
      Added value: +false
    • addedInput schema / additionalProperties
      Added value: +false
    • addedOutput schema / additionalProperties
      Added value: +false
    • removedOutput schema / properties / statistics
      Removed value: -{
      -  "anyOf": [
      -    {
      -      "additionalProperties": true,
      -      "type": "object"
      -    },
      -    {
      -      "type": "null"
      -    }
      -  ],
      -  "default": null,
      -  "title": "Statistics"
      -}
    • addedOutput schema / properties / warnings
      Added value: +{
      +  "description": "Non-fatal conditions that may affect result interpretation.",
      +  "items": {
      +    "type": "string"
      +  },
      +  "title": "Warnings",
      +  "type": "array"
      +}
  4. Changed1 schema field changedv1.2.8
    • addedInput schema / $defs / SpatialStatisticsParameters / properties / neighborhood_n_perms
      Added value: +{
      +  "default": 100,
      +  "description": "Permutations for neighborhood enrichment. Use 1000+ for publication.",
      +  "exclusiveMinimum": 0,
      +  "maximum": 10000,
      +  "title": "Neighborhood N Perms",
      +  "type": "integer"
      +}
  5. First observedv1.2.7

TDQS

A3.6/5.0
Behavior4/5

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

The description adds meaningful behavioral context by explaining that gene_selection='all' computes Moran/Geary for every gene and stores the full per-gene table at results_key while returning only top genes. This aligns with the destructive/non-readOnly annotations because it discloses that results are written into the data object, though it does not elaborate on permissions or mutation scope.

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 compact and front-loads the core purpose before the Args block and the gene_selection note. It wastes little space, though the Args formatting is somewhat redundant with the schema.

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's complexity, rich nested parameter schema, and presence of an output schema, the description covers the essential call shape and one important storage/return behavior. It still omits enough about analysis-type selection and cluster_key requirements that an agent must rely heavily on the schema.

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 top-level Args block briefly maps data_id to Dataset ID and params to analysis parameters, and points to SpatialStatisticsParameters for the full set. However, most parameter semantics live in the nested schema, which is richly documented, so the description itself adds only marginal meaning beyond the structured definition.

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 states a specific verb and resource: analyze spatial statistics and autocorrelation patterns. It is clear enough to distinguish this from most sibling tools, but it does not explicitly contrast with closely related tools such as find_spatial_genes or identify_spatial_domains.

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

Usage Guidelines3/5

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

Usage guidance is implied through the parameter model and the note about gene_selection='all', but the description itself does not say when to choose this tool over siblings or when specific analysis types are appropriate. The schema carries much of the routing detail via analysis_type's enum description, leaving the prose only partially helpful.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.