Skip to main content
Glama
india-gov-data-mcp

india-gov-data-mcp

Aggregate Dataset

aggregate_dataset

Computes exact SUM, AVG, MIN, MAX, or COUNT values over filtered data.gov.in datasets with DuckDB, grouped by a chosen column, so agents avoid unreliable mental math.

Instructions

Compute an exact aggregation over a data.gov.in dataset using DuckDB.

Fetches filtered data, loads it into an in-memory DuckDB table, and runs a deterministic SUM, AVG, MIN, MAX, or COUNT grouped by the specified column. Use this instead of asking the LLM to do mental math — results are guaranteed correct.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "resource_id": "<resource_id>",
      "group_by": "<group_by>",
      "metric_column": "<metric_column>"
    },
    "name": "aggregate_dataset"
  }
}

Input Schema

NameRequiredDescriptionDefault
filtersNoColumn-value filters using **original** API column names.
group_byYesColumn to group by (use ``snake_case`` names from ``inspect_schema``).
operationNoOne of ``"sum"``, ``"avg"``, ``"min"``, ``"max"``, ``"count"`` (default ``"sum"``).sum
resource_idYesDataset ``resource_id``.
metric_columnYesNumeric column to aggregate (use ``snake_case`` name).

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

A3.5/5.0
Behavior3/5

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

With no annotations at all, the description carries the full disclosure burden. It does add useful mechanism detail (data is fetched with filters, loaded into an in-memory DuckDB table, and results are deterministic) and implicitly establishes read-only semantics, but it omits dataset-size limits, latency/cost characteristics, and failure modes — significant gaps for an agent deciding whether to invoke it on a large resource.

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?

Front-loaded with the core verb and resource, then a short paragraph on the underlying mechanism and a bolded usage warning. Tight and purposeful, with only minor redundancy between the opening sentence and the enumerated operations.

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?

An output schema exists, so return-value explanation is not required, and all five parameters are fully described in the schema. What remains thin is operational context — no guidance on expected data volumes, whether filters must match API column names exactly (partially covered in the schema), or error behavior when a non-numeric metric_column is supplied.

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 baseline is 3. The description reinforces that filters apply before loading and that group_by/metric_column take snake_case schema names, but it adds no meaning beyond what the schema and operation descriptions already state, and does not explain default or null behavior for the optional filters.

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?

States a specific verb and resource: compute an exact aggregation over a data.gov.in dataset via DuckDB, with the supported operations (SUM/AVG/MIN/MAX/COUNT) and grouping behavior named. It does not explicitly contrast itself with sibling tools such as query_records or export_dataset, so an agent still has to infer the boundary.

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?

The one explicit directive — 'Use this instead of asking the LLM to do mental math' — is a real usage cue, and 'use snake_case names from inspect_schema' hints at a required prerequisite step. However, there is no statement of when to prefer this over query_records or export_dataset, and no exclusions or failure conditions.

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