Skip to main content
Glama

Generate Excel / Word / PDF Analysis Report

kobo_build_report

Generate analytical Excel workbooks, Word reports, or PDFs from KoboToolbox form submissions, with computed tables, charts, and written analysis.

Instructions

Produce finished deliverables from a form's data: an analytical Excel workbook, a written Word report, and/or a PDF — saved to disk.

YOU write the analysis (objective, summary, findings, section commentary, recommendations); the server computes every figure from the real submissions, so the numbers in the deliverable always match the data. Never type counts or percentages into 'custom' tables that the server can compute for you — use the directives below instead.

Each section carries your prose plus 'visuals', declared as directives:

  • {source:"frequencies", column:"crop_health", chart_kind:"pie"} — counts/% per answer, as table and chart

  • {source:"numeric_summary", column:"plot_size"} — mean/median/std/quartiles table

  • {source:"crosstab", row_column:"region", col_column:"crop_health", metric:"count"} — contingency table + grouped chart

  • {source:"custom", columns:[...], rows:[[...]]} — only for figures the server cannot derive Each accepts: show ('table'|'chart'|'both'), chart_kind, title, note (a "how to read this" caption), top_n.

What the Excel workbook contains: a summary sheet (objective, executive summary, findings, recommendations), one sheet per section with tables and NATIVE, editable Excel charts, a cross-tab sheet, the cleaned data as a real Excel Table named 'DonneesKobo' (select it, then Insert > PivotTable to build your own pivot in two clicks), and a data-quality sheet.

Note on pivot tables: cross-tabs are delivered as computed tables, not as live PivotTable objects — no open-source library can create those. The named Excel Table above is there precisely so you can add one yourself instantly.

Args:

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

  • objective (string): the analytical question this report answers

  • formats (array): any of 'xlsx', 'docx', 'pdf'

  • title, methodology, summary, findings[], recommendations[]: your written content

  • sections[]: {heading, text, visuals[]}

  • file_name (string, optional): base name without extension

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

Returns: the full path of each generated file.

Run kobo_load_data first so you know which questions exist and what shape the data is in.

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"}}'
titleNoReport title. Defaults to 'Analyse — <form name>'.
formatsNoDeliverables to produce: 'xlsx' analytical workbook, 'docx' written report, 'pdf' of that report
summaryNoExecutive summary: the headline answer to the objective
findingsNoKey findings, one per bullet, each citing a figure
max_rowsNoHow many submissions to pull. Defaults to 50000, which protects against dragging a huge project into memory; pass a higher value explicitly to analyse a project larger than that.
sectionsYesBody of the report: your analysis, section by section, with the tables and charts to compute
file_nameNoBase file name without extension. Defaults to a slug of the form name and date.
objectiveYesThe analytical objective this report answers, in the user's own terms
methodologyNoHow the analysis was conducted, including any filters applied
recommendationsNoActionable recommendations that follow from the findings

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.6/5.0
Behavior5/5

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

The description discloses behaviors far beyond annotations: files are saved to disk, every figure is computed server-side from real submissions, cross-tabs are delivered as computed tables rather than live PivotTable objects, and the 'custom' source must not be used for figures the server can derive. It even explains the named Excel Table's purpose for enabling user-created pivots. This is unusually transparent.

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 long, but the tool is complex and the length is earned: purpose is front-loaded, then directive syntax, workbook contents, pivot limitation, and a clear 'Run kobo_load_data first' instruction. It is well-structured and every section serves a practical purpose, though a slightly tighter phrasing would improve scannability.

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

Completeness5/5

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

For a 12-parameter report builder with no output schema, the description covers the critical operational details: what the workbook contains, how visuals are declared, the custom-table restriction, the pivot-table limitation, the max_rows memory protection, and the return value (full path of each generated file). Nothing essential is missing.

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?

Schema description coverage is 100%, so the baseline is 3. The description adds meaningful guidance beyond the schema: the visual directive format with examples, the rule that 'custom' is only for figures the server cannot derive, and the warning never to type counts or percentages into custom tables. This supplements the already-complete schema effectively.

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 opens with a specific verb and resource: 'Produce finished deliverables from a form's data: an analytical Excel workbook, a written Word report, and/or a PDF — saved to disk.' It clearly distinguishes this tool from sibling raw-data/export/analysis tools by emphasizing finished deliverables with written analysis plus server-computed visuals.

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?

It gives clear context for when to use the tool ('Produce finished deliverables') and an explicit workflow prerequisite: 'Run kobo_load_data first so you know which questions exist and what shape the data is in.' It does not explicitly name alternatives or exclusions, but the context is strong enough that an agent can identify the right situation.

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