Skip to main content
Glama

SRI Ecuador — Facturación electrónica

Generar XML de comprobante de retención

sri_generar_retencion_xml
Read-only

Construye el XML de un comprobante de retención (versión 2.0.0, con documentos sustento) por las facturas de un proveedor. Calcula los valores retenidos de renta, IVA e ISD. Para IVA el código sale del porcentaje (10, 20, 30, 50, 70 o 100 %); para renta e ISD indica el código del concepto vigente. No firma ni envía.

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": {
      "fechaEmision": "<fechaEmision>",
      "secuencial": "<secuencial>",
      "emisor": "<emisor>",
      "sujetoRetenido": "<sujetoRetenido>",
      "documentos": "<documentos>"
    },
    "name": "sri_generar_retencion_xml"
  }
}

Input Schema

NameRequiredDescriptionDefault
emisorYesEl agente de retención (quien retiene)
ambienteNoAmbiente del SRI. Por defecto: el configurado en SRI_AMBIENTE o 'pruebas'.
documentosYes
secuencialYes
fechaEmisionYesaaaa-mm-dd o dd/mm/aaaa
puntoEmisionNo001
infoAdicionalNoCampos adicionales (máx. 15), p. ej. { Email: '...' }
periodoFiscalNomm/aaaa; por defecto el mes de la fecha de emisión
codigoNumericoNo
sujetoRetenidoYes
establecimientoNo001

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A3.8/5.0
Behavior4/5

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

The final sentence 'No firma ni envía' is a genuinely useful boundary that tells the agent the tool stops at XML construction, consistent with readOnlyHint=true. It also discloses that retention amounts are computed internally rather than passed in, and gives the rule that IVA codes are derived from the percentage. It does not say what is returned (XML string vs. file path) or whether the output is schema-validated.

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?

Four short sentences, front-loaded with what is built and scoped by version, then the calculation rules, then the exclusion. Every sentence contributes; there is no filler or restatement of the title.

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

Completeness3/5

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

For an 11-parameter, deeply nested generator with no output schema, the definition should state what comes back (raw XML string, object, or file) and how failures on invalid retention codes surface. It covers the domain rules well but leaves the return contract and error behavior unstated, and most nested parameter semantics rest on a 45%-covered schema.

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 only 45% across 11 mostly nested parameters, so the description carries extra burden. It does add real meaning for retenciones: the IVA code derives from the percentage with an enumerated set (10/20/30/50/70/100 %) that the schema does not list, and it reinforces that renta and ISD require the vigente concept code. However, it says nothing about ambiente, periodoFiscal, codigoNumerico, puntoEmision/establecimiento, or the documentos.impuestos base structure, leaving most of the surface undocumented.

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?

States a specific verb and resource: builds the XML for a comprobante de retención v2.0.0 with documentos sustento, scoped to a supplier's invoices. It also names the taxes computed (renta, IVA, ISD), which makes it clearly distinct from the factura and nota de crédito siblings without needing to name them.

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?

Usage is implied by 'por las facturas de un proveedor' — you call it when you already have supplier invoices and need a retention document. There is no explicit when-to-use/when-not statement, no mention of prerequisites (e.g., needing the supplier's authorization numbers), and no routing to siblings such as sri_generar_clave_acceso or sri_generar_ride.

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.