Skip to main content
Glama

Gerar/validar chave de acesso do BP-e

bpe_gerar_chave_acesso

Generate a 44-digit BP-e access key with a modulo-11 check digit, or validate an existing key to identify rejection reasons.

Instructions

Monta a chave de acesso de 44 dígitos (cUF + AAMM + CNPJ + 63 + série + nBP + tpEmis + cBP + DV) com DV em Módulo 11, ou valida uma chave existente (motivos da rejeição 236).

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "bpe_gerar_chave_acesso"
  }
}

Input Schema

NameRequiredDescriptionDefault
ufNoSigla da UF do emitente (alternativa a cUF)
cBPNoCódigo numérico (8 dígitos). Se omitido, é gerado aleatoriamente. Em contingência mantenha o mesmo cBP.
cUFNo
nBPNo
aammNoAno/mês AAMM (alternativa a dhEmi)
cnpjNo
dhEmiNoData de emissão (ISO) para extrair AAMM
serieNo
tpEmisNo
validarNoSe informado, apenas valida esta chave e ignora os demais campos

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.5/5.0
Behavior3/5

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

With no annotations and no output schema, the description carries the full behavioral burden, and it does disclose the DV algorithm (Módulo 11) and that validation surfaces rejection-236 reasons. It does not say what is returned in generation mode, what happens when the composition inputs are incomplete (zero required parameters), or whether validation failures raise errors or return a verdict.

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?

A single front-loaded sentence with the composition formula in parentheses; every clause earns its place. It is dense but readable, with the generation mode stated before the validation mode.

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 10-parameter, zero-required tool with no annotations and no output schema, the definition covers the two modes and the key structure but leaves open what the response contains, how missing inputs are handled, and how the alternative parameters interact. Adequate, but not sufficient for an agent to invoke confidently without reading the schema closely.

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

Parameters4/5

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

Schema coverage is only 50%, but the 44-digit layout string maps every core parameter (cUF, AAMM, CNPJ, série, nBP, tpEmis, cBP, DV) to its position and role in the key, which is real meaning beyond the schema. It does not clarify the alternative pairs (uf vs cUF, aamm vs dhEmi) or nBP/serie/cnpj, which have no schema descriptions, so the compensation is partial.

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 names two concrete operations: assembling a 44-digit access key with an explicit field layout (cUF + AAMM + CNPJ + 63 + série + nBP + tpEmis + cBP + DV) and validating an existing key. The dual-mode is unambiguous and distinct from siblings like bpe_gerar_qrcode or bpe_consultar_situacao, though no sibling is named to sharpen the contrast.

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 split between 'build' and 'validate' implies the usage condition, and the schema reinforces it by stating that filling 'validar' ignores the other fields. However, it never states when to prefer this tool over bpe_diagnosticar_rejeicao or bpe_validar_regras_negocio when a key is rejected, so the routing decision is left to inference.

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