Skip to main content
Glama

SRI Ecuador — Facturación electrónica

Generar XML de nota de crédito

sri_generar_nota_credito_xml
Read-only

Construye el XML de una nota de crédito (versión 1.1.0) que modifica una factura: devolución, descuento o anulación. Calcula subtotales e IVA por tarifa; no firma ni envía. El comprador debe estar identificado (no consumidor final).

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>",
      "comprador": "<comprador>",
      "documentoModificado": "<documentoModificado>",
      "motivo": "<motivo>",
      "items": "<items>"
    },
    "name": "sri_generar_nota_credito_xml"
  }
}

Input Schema

NameRequiredDescriptionDefault
itemsYesÍtems que se devuelven o rebajan (valores sin IVA)
emisorYes
motivoYesRazón: devolución, descuento, anulación…
ambienteNoAmbiente del SRI. Por defecto: el configurado en SRI_AMBIENTE o 'pruebas'.
compradorYesComprador de la factura original (no puede ser consumidor final)
secuencialYes
fechaEmisionYesaaaa-mm-dd o dd/mm/aaaa
puntoEmisionNo001
infoAdicionalNoCampos adicionales (máx. 15), p. ej. { Email: '...' }
codigoNumericoNo
establecimientoNo001
documentoModificadoYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A3.9/5.0
Behavior4/5

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

The readOnlyHint is consistent with a description that explicitly says the tool only builds XML locally and neither signs nor sends, so there is no side effect to worry about. It also discloses internal computation ('Calcula subtotales e IVA por tarifa') and a hard business rule about the buyer, which the annotation alone would not tell an agent. It stops short of saying what the call returns (raw XML string vs. object), which matters since there is no output schema.

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?

Three short sentences with no filler: what is built, what is computed or not done, and the one precondition. The key scope limit ('no firma ni envía') is placed early where an agent will act on it.

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?

For a 12-parameter tool with nested objects and no output schema, the description covers the essential business rules and the build-only scope well. The remaining gap is the return contract and any constraint on the modified-document reference, which the agent must reconstruct from the schema.

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?

With 12 parameters and only ~50% schema description coverage, the description supplies meaningful semantics: the credit-note version to emit, the purpose for 'motivo', the restriction on 'comprador', and the fact that item values are pre-IVA while tax is computed per 'tarifaIva'. Format-level details for fechaEmision and documentoModificado are left entirely to the schema, so coverage is not complete.

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 concrete verb and artifact ('Construye el XML de una nota de crédito') plus the version (1.1.0) and the three business cases it covers (devolución, descuento, anulación), and frames it as modifying an invoice, which separates it from the invoice/retención XML generators. It never names a sibling explicitly, so the differentiation is inferential rather than stated.

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?

'no firma ni envía' implies this is one step in a larger pipeline, and 'El comprador debe estar identificado (no consumidor final)' is a real precondition for calling it. However, it does not name the follow-up tool for signing/sending or say when to prefer this over the other XML generators, leaving the routing to 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.