Skip to main content
Glama

Arquivix Notas · NFS-e

nfse_cancel

DestructiveIdempotent

Cancel an invoice. A queued (scheduled or not yet issued) invoice is cancelled immediately; an authorized NFS-e returns status "cancelling" while the cancellation event is sent to the Sefin. An invoice still being issued (status "processing") registers the request and stays "processing" with the request recorded; if it is authorized it is cancelled automatically at the Sefin and the credit is not refunded, and if the emission is rejected or fails the request is discarded. Issued NFS-e and invoices being issued require a 15-255 character description. With type "nfe" it cancels an authorized NF-e at the SEFAZ: send only invoice_id and description (the justification, 15 to 255 characters); reason is not used. The same for type "nfce" (a NFC-e is cancelled within 30 minutes of the authorization). Cancelling cannot be undone. Without confirm: true it changes nothing and returns a preview; with confirm: true it runs.

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": "nfse_cancel"
  }
}

Input Schema

NameRequiredDescriptionDefault
typeNoKind of invoice: "nfse" (default, services), "nfe" (goods, model 55) or "nfce" (sale to the consumer, model 65). NF-e and NFC-e are homologação only and need their own release for the account. With "nfe" or "nfce" use invoice_id, not access_key.nfse
reasonNoMotivo do cancelamento da NFS-e: issue_error (erro na emissão), service_not_provided (serviço não prestado) ou other.
confirmNotrue runs the action. Without it nothing changes and only a preview is returned.
invoice_idYesUUID of the invoice
descriptionNoFree-text justification; required (15-255 chars) for an authorized NFS-e or an invoice being issued (processing)

Schema Changelog

Changes observed during successful MCP inspections.

No schema history has been recorded yet.

TDQS

A4.2/5.0
Behavior5/5

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

While annotations already flag destructiveHint=true and idempotentHint=true, the description adds substantial context the annotations cannot: the state machine per invoice status, the fact that the credit is not refunded, the 30-minute NFC-e window, that cancellation cannot be undone, and that reason is ignored for nfe/nfce. This is exactly the kind of consequence disclosure a destructive tool needs.

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?

Front-loaded with the core action, then branches by invoice state and type in a logical order. The single dense paragraph is long and repeats a few schema details (the 15-255 character rule appears twice), which costs a little tightness but no sentence is purely 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?

For a destructive, state-dependent mutation with no output schema, the description covers nearly everything an agent needs: all three invoice types, status-dependent outcomes, the confirm preview gate, and required fields. It stops short of describing what the preview response contains or how long a recorded request for a processing invoice survives.

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?

Schema coverage is already 100%, so the schema carries most parameter meaning. The description still adds value by clarifying that for nfe/nfce only invoice_id and description should be sent and that reason is unused there, and by restating the 15-255 character justification requirement in context.

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?

Opens with a specific verb and resource ("Cancel an invoice") and immediately scopes it to NFS-e, NF-e and NFC-e via the type parameter. It never names a sibling such as cte_cancel or schedule_cancel, so an agent must infer the boundary from the invoice-type restriction rather than from explicit differentiation.

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?

Provides clear conditional guidance: queued invoices cancel immediately, authorized ones go to "cancelling", processing ones get a recorded request, and type "nfe"/"nfce" routes to the SEFAZ with different required fields. It also states the confirm gate for previews, but gives no explicit "use X instead" alternatives (e.g. substitution for corrections) and no stated preconditions for account-level NF-e/NFC-e release beyond a brief mention.

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