explain_rejection
Explain why a rejected document was refused and what to change.
get_invoice_submissions has the authority's reply as sent; this reads it for someone who does not speak SEFAZ: the code, the message verbatim, what it means, the steps to fix it, the field at fault and, when there is one, a suggested value. Quote the code and the message to the user; they are what they will search for. A suggested value is confirmed with the user before reissue_invoice, never applied on its own.
transient means the authority was unavailable, not the data wrong. A document that is not rejected is refused (409). Read-only.
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": {
"invoice_id": "<invoice_id>"
},
"name": "explain_rejection"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| company_id | No | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
| invoice_id | Yes | The local id of the rejected invoice, as list_invoices returns it. A rejected document has no access key. | |
| company_tax_id | No | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | The authority's own rejection code. | |
| field | No | The field to fix, when there is one. | |
| steps | No | What to change, in order. | |
| source | No | catalogue (known code), official_rule (the authority's published rule) or authority (its message only). | |
| status | No | known (from the catalogue of rejection codes), generated (written for this case) or unknown. | |
| actions | No | edit, retry, resend, company or certificate. | |
| message | No | The authority's message, verbatim. | |
| related | No | The authorized document holding the same number, on a duplicate-number rejection. | |
| authority | No | ||
| suggested | No | A value for that field, when one can be suggested. Confirm it with the user before reissuing. | |
| transient | No | True when the authority was unavailable rather than the data wrong: reissuing unchanged may work. | |
| comparison | No | Sent versus related, per field. | |
| invoice_id | No | ||
| explanation | No | What it means, in plain words. |