Skip to main content
Glama

br__cancel_cte

Cancel an authorized CT-e by submitting a signed cancellation event to SEFAZ. Provide CT-e key, CNPJ, protocol number, and justification.

Instructions

Solicita o cancelamento de um CT-e autorizado (evento 110111, CTeRecepcaoEventoV4).

Constrói, assina (build_cte_event_signer, alvo infEvento) e submete o evento de cancelamento. cStat=135 indica cancelamento homologado [Verified locally] — MOC CT-e Visão Geral v4.00 §6.2.2.

Cancelamento é uma operação irreversível em produção e exige confirmação em duas etapas (ConfirmationGate). Define BR_CTE_READ_ONLY=1 para desabilitar. endpoint_override é obrigatório — nenhuma URL de endpoint CT-e está embutida/verificada nesta versão.

Retorna cStat/xMotivo ou error.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cnpjYesCNPJ do emitente do CT-e (autor do evento)
ch_cteYesChave de acesso do CT-e a cancelar (chCTe), 44 caracteres
n_protYesNúmero do protocolo de autorização do CT-e original (nProt)
tp_ambNoIdentificação do Ambiente (tpAmb): '1' = produção, '2' = homologação2
x_justYesJustificativa do cancelamento
c_orgaoYesCódigo IBGE da UF do autorizador (cOrgao), 2 dígitos (ou '90' para SUFRAMA)
cert_pathYesCaminho local para o certificado ICP-Brasil A1 (.p12/.pfx)
dh_eventoYesData e hora do evento (ISO 8601, UTC)
cert_passwordNoSenha do certificado A1, se houver
endpoint_overrideYesURL completa do webservice CTeRecepcaoEventoV4 — obrigatório, ver docstring do módulo.
confirmation_tokenNoToken de confirmação obtido de uma chamada anterior pendente.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

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

With no annotations, the description fully discloses behavioral traits: irreversible operation, two-step confirmation, requirement for endpoint_override, internal signing process, and return of cStat/xMotivo or error. No contradictions.

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 concise, well-structured, and front-loaded with the main purpose. Every sentence adds value without unnecessary detail.

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?

Given the tool's complexity (11 parameters, irreversible action), the description covers critical aspects: event code, mandatory endpoint, confirmation process, read-only guard, and return fields. Minor omission of output schema details, but output schema exists.

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 coverage is 100%, so baseline 3 is appropriate. The description adds high-level context (event code, confirmation token usage) but does not significantly elaborate on individual parameters beyond 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 clearly states the verb 'cancelar' and the resource 'CT-e autorizado', specifying the event code (110111) and web service (CTeRecepcaoEventoV4). It is distinct from siblings like br__consult_cte or br__correct_cte.

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 important context: cancellation is irreversible in production, requires two-step confirmation with ConfirmationGate, and endpoint_override is mandatory. Does not explicitly contrast with siblings but offers clear when-to-use guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cmendezs/mcp-nfe-br'

If you have feedback or need assistance with the MCP directory API, please join our Discord server