Skip to main content
Glama
alcastaro

datosgobdo-mcp

by alcastaro

aggregate_resource

Read-only

Run GROUP BY and aggregations on cached resources from datos.gob.do without writing SQL. Specify aggregations, grouping, filters, and ordering via JSON arguments.

Instructions

Run GROUP BY + aggregations against a cached resource without writing SQL.

Typed wrapper that builds safe DuckDB queries from JSON. Example usage: "How many employees by status in April 2026?" → aggregations=[{col: null, fn: count, alias: empleados}], group_by=["Estatus"], filters=[{col:"Año",op:"=",val:2026},{col:"Mes",op:"=",val:"Abril"}], order_by=[{col:"empleados",dir:"desc"}].

First call downloads + caches the file. Subsequent calls reuse the cache. Returns one row per group with the aggregation values.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesDirect URL to the file (CKAN resource 'url' field).
formatYesFormat declared in CKAN. Accepts: csv, tsv, xlsx, json.
aggregationsYesList of {col, fn, alias}. Valid fns: count, count_distinct, sum, avg, mean, median, min, max, stddev, variance. col=null or col='*' means COUNT(*). Example: [{"col":null,"fn":"count","alias":"empleados"},{"col":"Sueldo Bruto","fn":"sum","alias":"masa_salarial"}].
group_byNoColumns to GROUP BY. Example: ["Estatus","Mes"].
filtersNoSame syntax as filter_resource.filters. Applied before grouping.
havingNoPost-aggregation filter on aggregation aliases. Example: [{"col":"empleados","op":">","val":10}].
order_byNoSame syntax as filter_resource.order_by. Refs aggregation aliases or group cols.
limitNoMax groups to return (1-1000).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
errorNo
hintNo
source_urlNo
formatNo
cacheNo
groups_returnedNo
columnsNo
limitNo
rowsNo
Behavior4/5

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

Annotations already indicate readOnlyHint=true and openWorldHint=true. The description adds caching behavior (first call downloads, subsequent reuse) and clarifies it returns one row per group. No contradictions, and additional context is provided.

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 relatively concise and front-loaded with the main purpose. The example is lengthy but illustrative. Every sentence adds value, though the example could be shortened or placed in a separate section.

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 that context signals indicate an output schema exists (though not provided), the description need not explain return values. It covers caching, aggregation functions, and usage. For a tool with 8 parameters and no enums, it is sufficiently complete.

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 coverage is 100%, so baseline is 3. The description adds value by providing valid functions for aggregations, specifying filter syntax reference, and including a detailed example that demonstrates parameter usage. Some details like format accept list are in schema but description elaborates.

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 clearly states the verb 'Run' and the resource 'GROUP BY + aggregations against a cached resource'. It distinguishes itself from siblings like filter_resource and query_resource by emphasizing aggregation without SQL. The example solidifies the purpose.

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 description provides an example and mentions caching behavior, but does not explicitly state when to use this tool vs alternatives like filter_resource or summarize_resource. Implicitly, it's for grouped aggregations, but explicit guidance would improve clarity.

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/alcastaro/datos.gob.do-MCP-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server