Skip to main content
Glama

Br Sign Nfe

br__sign_nfe

Sign an unsigned NF-e/NFC-e XML with an ICP-Brasil A1 certificate, applying an enveloped XML-DSig signature to produce a valid signed document.

Instructions

Apply an ICP-Brasil enveloped XML-DSig signature to an NF-e/NFC-e XML.

Signs <infNFe> per MOC 7.0 Table 4-2 (RSA-SHA1 / SHA-1, enveloped transform, ds:Signature appended as the last child of <NFe>) using mcp_nfe_br.standards.nfe_signer.build_nfe_signer.

Only ICP-Brasil A1 (PKCS#12 file-based) certificates are supported. A3 (hardware token/HSM) certificates [NEED: not modeled].

Returns a dict with xml (the signed document) or error.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cert_pathYesCaminho local para o certificado ICP-Brasil A1 (.p12/.pfx)
xml_base64NoXML NF-e/NFC-e não assinado, codificado em base64.
xml_contentNoXML NF-e/NFC-e não assinado. Informe xml_content ou xml_base64.
cert_passwordNoSenha do certificado A1, se houver

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.3.1

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations, the description carries the behavioral burden. It discloses the signing algorithm/enveloped transform, the certificate support limitation, the fact that A3 is not modeled, and the return shape ('dict with xml or error'). This goes well beyond a minimal statement, though it leaves minor ambiguities such as requiring one of xml_base64/xml_content.

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 front-loaded with the core purpose and then supplies standard, certificate, and return-value details in compact sentences. The internal code reference and the placeholder-like '[NEED: not modeled]' keep it from being perfectly polished.

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 moderately specialized signing tool, the description covers purpose, standards, certificate constraints, and return format, and an output schema exists to document return fields. It would be complete if it explicitly stated that an unsigned XML must be supplied via xml_base64 or xml_content, though the schema already labels that choice.

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 parameters are already documented in the input schema. The description adds context about the certificate type and return shape but does not need to compensate for missing parameter documentation.

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 specific action and resource: 'Apply an ICP-Brasil enveloped XML-DSig signature to an NF-e/NFC-e XML.' It further names the exact signed element and standard, which clearly distinguishes this NFe-signing tool from siblings like br__sign_nfse and br__validate_nfe_xml.

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 intended use is clear: it is for signing NF-e/NFC-e XML, and it explicitly excludes A3 hardware-token certificates, limiting use to A1 PKCS#12 files. It does not explicitly name alternative tools, but the document-type and certificate constraints provide enough context for selection.

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