Skip to main content
Glama

Br Correct Cte

br__correct_cte

Corrects an issued CT-e by submitting an electronic correction letter (CC-e) to SEFAZ. Fixes typo or minor data errors while respecting legal limits on what can be changed.

Instructions

Emite uma Carta de Correção Eletrônica para um CT-e (evento 110110, CTeRecepcaoEventoV4).

Constrói, assina (build_cte_event_signer, alvo infEvento) e submete o evento de CC-e. cStat=135 indica CC-e homologada [Verified locally] — MOC CT-e Visão Geral v4.00 §6.4. Por força do Art. 58-B do CONVÊNIO/SINIEF 06/89, a CC-e não pode alterar valores de impostos, dados cadastrais das partes, ou a data de emissão/saída.

Exige confirmação em duas etapas (ConfirmationGate). Define BR_CTE_READ_ONLY=1 para desabilitar. endpoint_override é obrigatório.

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 corrigir (chCTe), 44 caracteres
tp_ambNoIdentificação do Ambiente (tpAmb): '1' = produção, '2' = homologação2
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)
correcoesYesLista de correções. Cada item: 'grupo_alterado', 'campo_alterado', 'valor_alterado', e opcionalmente 'nro_item_alterado'.
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

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.6.2

TDQS

A4.3/5.0
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It covers the signing workflow (`build_cte_event_signer`, target `infEvento`), the expected result code (`cStat=135`), the legal restrictions on what can be altered, the confirmation gate requiring a token, and the return shape (`cStat`/`xMotivo` or `error`). The mention of `ConfirmationGate` and the requirement for `endpoint_override` are concrete behavioral traits. A small gap is that it doesn't explicitly state that the operation is a write/mutation, though constructing and submitting an event implies this strongly.

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?

The description is moderately sized and packs substantial information into a few sentences: the event type, the signing flow, the success code, legal constraints, and the confirmation requirement. It is well-structured with the core purpose first, followed by behavioral details and constraints. It could be slightly tighter—the legal citation and verification note add context but are somewhat verbose for a tool description.

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 10 parameters, a required endpoint override, a confirmation gate, and no annotations, the description covers the critical operational details: what the tool does, how it signs, the expected success code, what it can and cannot correct, and the return format. The reference to a module docstring for `endpoint_override` is a minor gap, as an agent invoking this via MCP may not have access to that docstring. The presence of an output schema also alleviates the need to describe return values in detail.

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 description coverage is 100%, so the schema already documents all 10 parameters meaningfully. The description adds context for `endpoint_override` (required, see module docstring) and `confirmation_token` (obtained from a prior pending call), but it doesn't add detail for most parameters beyond what the schema already provides. This is a baseline-3 case where the schema does the heavy lifting and the description adds marginal value.

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 opens with a precise verb and object: 'Emite uma Carta de Correção Eletrônica para um CT-e', identifying the specific event type (`110110`) and webservice operation (`CTeRecepcaoEventoV4`). It clearly distinguishes this from the sibling tools like `br__generate_cte`, `br__submit_cte`, and `br__cancel_cte`, which handle different CT-e operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains when this tool is used (to emit a CC-e correction event) and includes important legal/regulatory context (Art. 58-B do CONVÊNIO/SINIEF 06/89) that constrains what can be corrected. It also mentions that `endpoint_override` is required and that a two-step confirmation gate applies, with the `BR_CTE_READ_ONLY=1` escape hatch. While it doesn't explicitly name sibling alternatives, its scoping to the CC-e event and the regulatory constraints make the usage context clear.

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