Skip to main content
Glama

Diagnosticar rejeição (cStat)

bpe_diagnosticar_rejeicao

Diagnose BP-e rejection codes by returning the official reason, violated MOC rules, and corrective action from a cStat, helping users resolve SEFAZ validation errors.

Instructions

Recebe um cStat (ex.: 215, 539, 678) e retorna mensagem oficial, causa, regras violadas (grupos A–J/CI do MOC) e ação corretiva.

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": {
      "cStat": "<cStat>"
    },
    "name": "bpe_diagnosticar_rejeicao"
  }
}

Input Schema

NameRequiredDescriptionDefault
cStatYes
xMotivoNoxMotivo retornado (extrai complementos como [chBPe], [nProt], [Motivo])
tpEventoNoFiltra as regras do Grupo J pelo evento

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, the description carries the full burden. It implies a read-only diagnostic lookup and discloses the return contents, which is useful, but it says nothing about whether the call has side effects, whether the lookup is exhaustive, or how partial matches (e.g., an unknown cStat) are handled.

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 well-formed sentence with the input and the four output components front-loaded. Nothing is wasted, though a brief clause on the optional parameters would have been worth the extra words.

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?

Without an output schema, the description correctly compensates by enumerating the return fields. The only gap is explaining the role of the two optional parameters relative to the required cStat, which for a three-parameter diagnostic tool is a minor omission.

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 67%, so the schema documents xMotivo and tpEvento while the description adds only example cStat values. The description never explains how xMotivo complements the code or that tpEvento filters Group J rules, leaving the optional parameters dependent on the schema text alone.

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 a specific input (cStat with example values 215, 539, 678) and enumerates the outputs precisely: official message, cause, violated rules from MOC groups A–J/CI, and corrective action. That is clearly distinct from siblings such as bpe_validar_regras_negocio, though it never explicitly contrasts itself with any of them.

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?

Usage is implied: call this when you have a rejection code and need to understand it. There is no explicit when-to-use statement, no exclusion criteria, and no pointer to alternatives for related tasks like rule validation or status lookup.

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