Skip to main content
Glama

Gerar URL do QR Code do DABPE

bpe_gerar_qrcode

Generates the official BP-e QR Code URL from a 44-digit access key, adding the RSA-SHA1 signature required for offline contingency when applicable.

Instructions

Monta a URL oficial do QR Code (ISO/IEC 18004, nível M, UTF-8). Normal: chBPe + tpAmb. Contingência off-line (tpEmis=2 na chave): inclui sign = RSA-SHA1 Base64 da chave, usando o certificado configurado ou o 'sign' informado.

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": {
      "chBPe": "<chBPe>"
    },
    "name": "bpe_gerar_qrcode"
  }
}

Input Schema

NameRequiredDescriptionDefault
ufNo
signNoAssinatura já calculada (Base64), para contingência
chBPeYes
tpAmbNo
urlBaseNoURL de consulta QR Code da UF. Padrão: data/endpoints_uf.json ou BPE_URL_QRCODE
gerarSvgNoTambém devolver a imagem SVG
chavePrivadaPemNoChave privada PEM (se não houver certificado no .env)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.4/5.0
Behavior3/5

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

With no annotations, the description carries the full burden, and it does disclose genuine behavior: the contingency path requires a signature computed as 'RSA-SHA1 Base64 da chave', falling back to the configured certificate or a supplied 'sign'. That is meaningful non-obvious context. It stops short of the operational details an agent needs, though — what happens if neither a certificate nor a 'sign' is available, whether the operation is pure (non-persisting), and why chavePrivadaPem exists as a parameter are all unstated.

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 text is dense but well front-loaded: the purpose appears in the first clause, followed by the normal case and then the exception. Every sentence carries information, with no filler. It relies heavily on domain acronyms (chBPe, tpAmb, tpEmis) without expansion, which is acceptable for a domain-specific tool but slightly reduces accessibility.

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

Completeness3/5

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

For a 7-parameter tool with no annotations and no output schema, the description covers the cryptographic core but not the edges. It never states what is actually returned (a URL string, plus optionally an SVG when gerarSvg is set) nor what failures look like when signing material is missing, which is the most likely error path given the certificate/PEM alternatives.

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 57%, so the description should compensate for the gap and it only partially does: it explains the relationship between chBPe, tpAmb, and 'sign' along with the signature algorithm. Four parameters — most notably uf, which has no schema description at all, plus gerarSvg, urlBase, and chavePrivadaPem — receive no mention in the description, leaving real semantics undocumented in either place.

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?

The description opens with a specific verb and resource: 'Monta a URL oficial do QR Code', which unambiguously identifies the operation as constructing a QR-code URL rather than validating, consulting, or authorizing. It also specifies the standard (ISO/IEC 18004), error-correction level (M), and encoding (UTF-8), which pins down the exact artifact produced. It does not explicitly contrast itself with siblings such as bpe_gerar_chave_acesso, but the naming is distinct enough that confusion is unlikely.

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

Usage Guidelines3/5

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

The description explains the two operating regimes — 'Normal: chBPe + tpAmb' versus 'Contingência off-line (tpEmis=2 na chave)' — which tells the agent which branch applies based on the key's emission type. However, this is conditional logic rather than tool-selection guidance: there is no statement of when to call this tool versus bpe_gerar_chave_acesso or bpe_consultar_situacao, and no prerequisites (such as a configured certificate) are framed as preconditions for use.

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