Skip to main content
Glama

enaho_agregar_modulo

Idempotent

Aggregate expense or production modules from product-level rows to household level, preventing duplicate household rows and inflated estimates when merging survey data.

Instructions

Colapsa un modulo de gastos o produccion al nivel hogar.

Los modulos 07 a 28 tienen una fila por PRODUCTO, no por hogar. Unirlos crudos multiplica las filas del hogar por el numero de productos y todo lo que estimes despues sale inflado. Esta herramienta los agrega antes.

Hay que decir explicitamente que variables agregar y con que funcion: no existe un "agrega todo lo numerico" porque sumar un codigo de producto produce un numero que parece un dato. Usa enaho_buscar_variable con el modulo para ver que hay dentro.

Aviso importante que la herramienta tambien reporta: con funcion 'suma', un hogar cuyas filas eran todas faltantes queda como faltante, NO como cero. Tratarlo como cero sesga el gasto hacia abajo.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
anioYes
nivelNohogar
moduloYesModulo de items: 07 (alimentos), 08, 09, 22, 26...
salidaNoNombre del dataset.
encuestaNoEncuesta del INEI sobre la que operar. Por defecto 'enaho'. Valores: enaho, enaho-panel, endes, enapres, enut, enares, ena, epen-departamentos, epen-ciudades, epen-lima, epe-lima, enapref, enco, cenagro, mapa-pobreza. Cada encuesta tiene sus propias llaves de union y su propio factor de expansion; no se pueden mezclar entre si.
variablesYesMapa variable -> funcion. Funciones: suma, media, maximo, minimo, conteo. Ejemplo: {'i580a': 'suma', 'p601a': 'conteo'}.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

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

Beyond the annotations (readOnlyHint=false, idempotentHint=true, destructiveHint=false), the description discloses critical runtime behavior: with function 'suma', a household with all missing rows remains missing rather than zero, and treating it as zero biases estimates. It also warns against 'aggregate all numeric' because summing product codes yields meaningless numbers. This adds significant behavioral context that annotations do not convey.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is compact but dense: the first sentence states the core purpose, the second paragraph explains why the tool exists, the third gives usage rules, and the fourth provides a critical warning. Each section serves a distinct function, with no filler.

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 complexity (nested variables object, multiple parameters) and the presence of an output schema, the description covers all essential behavioral aspects: aggregation logic, variable selection, missing-value handling, and differentiation from raw joins. The only notable omission is the `nivel` parameter's persona option, which is available in the schema but not mentioned in the text.

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 schema covers 67% of parameters; the description compensates by explaining the `variables` parameter in depth: users must explicitly map variables to functions because there is no automatic option, and it provides the example of summing product codes as a pitfall. It does not explain the `nivel` parameter, which allows both 'hogar' and 'persona', while the description only mentions household level; this is a slight gap.

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 'Colapsa un modulo de gastos o produccion al nivel hogar' – a specific verb and resource – and immediately distinguishes itself from raw joins by explaining that modules 07-28 have one row per product and that joining raw inflates estimates. This clearly separates it from sibling tools like enaho_unir_modulos.

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 explains when to use the tool: for modules 07-28 that have product-level rows and need to be aggregated before analysis. It also instructs users to use enaho_buscar_variable to explore module variables, providing a concrete workflow. However, it does not explicitly list situations where another tool should be used instead (e.g., retaining product-level detail), so it lacks a true when-not clause.

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/AnderMC66/enaho-mcp'

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