Skip to main content
Glama

Cross-tabulate Two KoboToolbox Questions

kobo_crosstab
Read-onlyIdempotent

Cross-tabulate two survey questions to compare how responses to one vary by another, with counts, percentages, means, or sums.

Instructions

Cross two questions to see how answers to one vary with the other — the core of comparative analysis.

Args:

  • uid (string): the form's asset uid

  • row_column (string): question forming the rows (field name or label)

  • col_column (string): question forming the columns

  • metric: 'count' (default), 'row_pct', 'col_pct', 'mean' or 'sum'

  • value_column (string): numeric question to average/sum — required for 'mean' and 'sum'

  • query (string, optional): Mongo-style filter

  • response_format ('markdown' | 'json')

Returns: the contingency table with row, column and grand totals, and how many submissions were excluded for missing either answer.

Examples:

  • Use when: "Is crop health worse in some regions?" -> row_column="region", col_column="crop_health"

  • Use when: "Share of each health status within each region" -> ..., metric="row_pct"

  • Use when: "Average plot size by region and crop" -> row_column="region", col_column="crop", metric="mean", value_column="plot_size"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
uidYesAsset uid of the form (from kobo_list_forms)
queryNoOptional Mongo-style filter applied server-side, e.g. '{"region":"Sud-Ouest"}' or '{"_submission_time":{"$gte":"2026-01-01"}}'
metricNocount = number of submissions; row_pct/col_pct = percentages; mean/sum = aggregate value_column inside each cellcount
col_columnYesQuestion forming the columns of the table
row_columnYesQuestion forming the rows of the table (field name or label)
value_columnNoNumeric question to average or sum. Required when metric is 'mean' or 'sum'.
response_formatNoOutput format: 'markdown' for human-readable or 'json' for machine-readablemarkdown

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already establish readOnly, idempotent, open-world, and non-destructive behavior, so the description does not need to repeat those. It adds useful behavioral context by stating that the return includes row, column, and grand totals plus the count of submissions excluded for missing either answer. No contradictions with the annotations are present.

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 well-structured with an intro, Args list, Returns, and Use-when examples, and the key purpose is front-loaded. Some parameter details in the Args list duplicate the schema, but the examples and returns keep the description from feeling padded.

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

Completeness4/5

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

Given the tool's moderate complexity, seven parameters, and no output schema, the description provides enough context: return shape, exclusion behavior, metric meanings, and realistic examples. It could be more explicit about how percentages are calculated or how missing-answer submissions affect totals, but the core information an agent needs to invoke it correctly is present.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema already documents all seven parameters at 100% coverage, setting a baseline of 3. The description adds value with concrete example parameter combinations and clarifies how metrics like row_pct and mean are used in practice. It does not dramatically enrich every parameter, but the examples improve selection confidence.

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

Purpose5/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: “Cross two questions to see how answers to one vary with the other.” This clearly identifies a cross-tabulation operation on KoboToolbox questionnaire data and is distinct from the sibling tools, none of which describe this analytic operation.

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

Usage Guidelines4/5

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

The “Use when” examples map natural-language analytical questions to concrete parameter choices, such as row_column, col_column, metric, and value_column. This gives clear contextual guidance, though it does not explicitly say when NOT to use this tool or name an alternative to prefer.

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