Skip to main content
Glama

Cancelar documento fiscal

evento_cancelar
Destructive

Cancela um documento fiscal autorizado (NF-e, NFC-e, NFS-e, CT-e, MDF-e, DC-e). Informe a chave de 44 dígitos e a justificativa (mínimo 15 caracteres). Para NFS-e use TipoDocumento=1 e informe NumeroNFSe ao invés de chave. Prazo SEFAZ NF-e: 24h após autorização (algumas UFs mais).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ChaveNFYesChave de acesso de 44 dígitos da NF-e/NFC-e/CT-e/MDF-e/DC-e a cancelar. Obrigatório quando TipoDocumento = 0 (documentos NFe-family). Para NFS-e (TipoDocumento = 1) use NumeroNFSe.
DataEventoNoData do evento de cancelamento do documento (Caso não for enviado é considerada a data e hora atual)
NumeroNFSeNoNúmero da NFS-e a ser cancelada
TipoAmbienteYesAmbiente do documento original (DEVE bater com o ambiente onde a nota foi emitida). IMPORTANTE: passe explicitamente. Se a nota foi emitida em homologação (testes), use 2. Valores: 1 - Produção; 2 - Homologação
JustificativaYesMotivo do cancelamento. MÍNIMO 15 caracteres, MÁXIMO 1000. NÃO use texto genérico como "cancelamento" ou "erro" - descreva o motivo real (ex: "Erro no valor unitário do produto X"). Obrigatório para TipoDocumento = 0 (NFe-family).
TipoDocumentoYesTipo do documento fiscal a cancelar. Valores: 0 - NF-e, NFC-e, CT-e, MDF-e, DC-e (usa ChaveNF de 44 dígitos); 1 - NFS-e (usa NumeroNFSe + CodCancelamentoNFSe + TipoAmbiente)
NumeroProtocoloNoNúmero do protocolo de autorização original do documento (obrigatório quando a nota foi emitida por OUTRO sistema externo). Se o documento foi emitido pelo próprio BrasilNFe, o protocolo é localizado automaticamente.
NumeroSequencialNoNúmero sequencial do evento
CodCancelamentoNFSeNoCódigo do motivo de cancelamento da NFS-e (Padrão 1) Valores: 1 - Erro na emissão; 2 - Serviço não prestado; 3 - Duplicidade da nota; 9 - Outros
CpfCnpjRemetenteDCeNoCPF ou CNPJ do Usuário Emitente (Remetente) da DC-e original. Obrigatório no cancelamento de DC-e quando a nota não está cadastrada no sistema (caso esteja, o valor é lido da própria NotaFiscal).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
ErrorNoMensagem de erro da operação. Vazia ("") quando foi bem-sucedida.
AvisosNoAvisos não bloqueantes. Pode vir preenchida mesmo em emissão bem-sucedida.
StatusNo1 - Evento Processado; 2 - Aguardando processamento do evento; 3 - Ocorreu um erro ao processar o evento
DsEventoNo
DsMotivoNo
DsAmbienteNo
NuProtocoloNo
NumeroSequencialNo
CodStatusRespostaSefazNo

TDQS

A4.8/5.0
Behavior5/5

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

The description aligns with annotations (destructiveHint=true) and adds important behavioral details: the requirement for the environment to match the original document, the need for a protocol number when the document was issued by an external system, and the automatic protocol retrieval for BrasilNFe-issued documents. It also clarifies the conditional use of ChaveNF vs NumeroNFSe.

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?

The description is three sentences: first states the core action and document types, second explains the NFS-e special case, third provides the deadline. Every sentence adds essential information without redundancy.

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

Completeness5/5

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

Given the complexity (10 parameters, 4 required, conditional logic, and an output schema), the description covers key behavioral aspects: cancellation scope, document type distinction, environment matching, deadline, justification rules, and external system handling. It is complete for an agent to select and invoke the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema coverage, the description still adds significant value: it specifies the 44-digit length for ChaveNF, the minimum and maximum length for Justificativa with examples of inadequate text, the requirement that TipoAmbiente matches the original environment, and the conditional requirement for NumeroProtocolo. This goes well beyond the schema descriptions.

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 description explicitly states the tool cancels authorized fiscal documents (NF-e, NFC-e, NFS-e, CT-e, MDF-e, DC-e) and distinguishes between document types via TipoDocumento. The title and description are aligned and differentiate from sibling event tools like 'evento_carta_correcao'.

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 description provides clear when-to-use guidance (cancellation after authorization) and includes a critical deadline (24h for NF-e) and constraints (justification length). While it does not explicitly state when not to use, the alternative tools are listed as siblings and the description's focus on cancellation implies exclusivity.

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.

TDQS

A3.6/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose, with thorough descriptions that clarify overlaps (e.g., cliente_consultar vs cadastro_consultar). Even similar operations like arquivo_baixar variants have explicit scope differences.

Naming Consistency4/5

Most tools follow a noun_verb pattern (e.g., cliente_consultar, evento_cancelar, produto_criar), but a few deviate (e.g., 'health', 'cte_desacordo'). Overall consistent enough for easy recognition.

Tool Count4/5

34 tools is high but justified given the complexity of fiscal document management across multiple document types (NF-e, NFS-e, CT-e, MDF-e, etc.) and required CRUD, events, and auxiliary operations.

Completeness4/5

The tool set covers create/read/update/delete for clients, products, and tax rules, plus emission, cancellation, correction, and status checks for various documents. Minor gaps like dedicated NFS-e cancellation are handled by generic event tools.