Skip to main content
Glama

Herramientas de Ecuador · ADVISE.ia

Calcular retenciones del SRI de una factura de compra

calcular_retencion_sri
Read-onlyIdempotent

Calcula las retenciones en la fuente de impuesto a la renta y de IVA de una factura de compra en Ecuador con los porcentajes vigentes del SRI (Resolución NAC-DGERCGC26-00000009, vigente desde el 1 de marzo de 2026, y Resolución NAC-DGERCGC20-00000061): porcentaje y valor de cada retención, código del anexo, IVA, total de la factura, total retenido y valor a pagar al proveedor. Considera el concepto del pago, el tipo de proveedor (persona natural obligada o no a llevar contabilidad, sociedad, contribuyente especial, RIMPE) y si quien paga es contribuyente especial. Úsala cuando pregunten cuánto retener en una factura o qué porcentaje de retención aplica.

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": {
      "concepto": "<concepto>",
      "proveedor": "<proveedor>",
      "base_imponible": "<base_imponible>"
    },
    "name": "calcular_retencion_sri"
  }
}

Input Schema

NameRequiredDescriptionDefault
conceptoYesConcepto del pago: prof-titulo = Honorarios de una persona natural con título de educación superior; intelecto = Servicios de una persona natural sin título donde predomina el intelecto; mano-obra = Servicios de una persona natural donde predomina la mano de obra; prof-sociedad = Servicios profesionales prestados por una sociedad; comision-sociedad = Comisiones pagadas a una sociedad; bienes = Compra de bienes muebles (mercadería, equipos, suministros); transporte = Transporte privado de pasajeros o transporte de carga; arriendo = Arrendamiento de bienes inmuebles; publicidad = Medios de comunicación y agencias de publicidad; agro-productor = Productos agrícolas, pecuarios, bioacuáticos, forestales o carnes en estado natural, al productor; agro-comercializador = Los mismos productos en estado natural, a un comercializador; otros = Otros pagos sin porcentaje específico.
proveedorYesTipo de proveedor: pn = Persona natural no obligada a llevar contabilidad; pn-obligada = Persona natural obligada a llevar contabilidad; sociedad = Sociedad; ce = Contribuyente especial; rimpe-emp = RIMPE emprendedor; rimpe-np = RIMPE negocio popular.
naturalezaNoSolo para el concepto «otros»: si lo que se compra es un bien o un servicio (por defecto, bien).
quien_pagaNoQuien paga y retiene: «agente» = agente de retención (por defecto); «especial» = contribuyente especial.
tarifa_ivaNoIVA de la factura: 15 (tarifa general, por defecto) o 0.
base_imponibleYesBase imponible de la factura en USD (el subtotal sin IVA).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.1/5.0
Behavior4/5

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

The annotations already declare it as a read-only, idempotent, closed-world calculation, so the safety profile needs no restating. The description adds real context beyond them by citing the legal source and effective dates of the rates and by enumerating the returned values, but it omits caveats such as rounding rules or what happens with ambiguous concepts.

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 text is front-loaded with the core calculation and its legal basis, then the output list, then the trigger condition, so there is a clear reading order. The middle enumeration of outputs is dense but earns its place given the absent output schema; a shorter phrasing of the regulation references would have helped.

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?

With six parameters, five enums, and no output schema, the description carries the burden of describing results and does so thoroughly (percentage, amount, annex code, IVA, totals, net payable). It is nearly complete; only edge cases and error behavior are left unaddressed for a tool of this complexity.

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% and every enum value is exhaustively documented in the schema, so the baseline is 3. The description does name the decision factors (concepto, tipo de proveedor, whether the payer is a contribuyente especial), which helps an agent understand how the inputs combine, but it adds no detail on the optional parameters and never mentions naturaleza.

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 definition names a concrete verb and resource (calcular retenciones en la fuente / IVA) and confines the scope to purchase invoices in Ecuador, which is clearly separable from siblings like calcular_iva or calcular_impuesto_renta_2026. It also spells out the exact figures produced, so an agent knows what it will get back before opening the schema.

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 final sentence gives an explicit use case: "cuando pregunten cuánto retener en una factura o qué porcentaje de retención aplica". That is strong positive guidance, but no exclusion or named alternative (e.g., when to prefer calcular_iva for IVA of a sale) is offered, so routing between siblings still requires inference.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources