Skip to main content
Glama

calcular_tributos

Calculates CBS, IBS (state and municipal) and Imposto Seletivo for general-regime operations, validating each item independently so valid items still return results when one has input errors.

Instructions

Calcula CBS, IBS (estadual e municipal) e Imposto Seletivo de uma operação do regime geral.

Usa o endpoint de observabilidade: cada item é calculado de forma independente e, se um item tiver erro de entrada, os demais ainda são calculados (o item com problema vem com estadoItem=INCONSISTENCIA_ENTRADA e a lista de erros). Use explicar_erro para detalhar um código.

Dicas antes de calcular:

  • Descubra CST e cClassTrib com buscar_classificacao_tributaria / listar_situacoes_tributarias.

  • Confirme que a NCM/NBS é compatível com a cClassTrib via validar_nomenclatura_aplicavel.

  • O código do município (IBGE) sai de listar_municipios.

Args: municipio: Código IBGE do município da operação (7 dígitos), ex: 4314902 (Porto Alegre). itens: Itens da operação. dh_fato_gerador: Data/hora do fato gerador ISO 8601 com fuso, ex: '2027-03-10T10:00:00-03:00'. Se omitido, usa agora. uf: Sigla da UF, ex: 'RS'. tp_doc: Modelo do DF-e de origem (55=NF-e, 65=NFC-e, ...). compra_governamental: Preencha apenas em compras governamentais.

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": {
      "municipio": "<municipio>",
      "itens": "<itens>"
    },
    "name": "calcular_tributos"
  }
}

Input Schema

NameRequiredDescriptionDefault
ufNo
itensYes
tp_docNo
municipioYes
dh_fato_geradorNo
compra_governamentalNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

A4.5/5.0
Behavior4/5

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

With no annotations at all, the description carries the full burden, and it does disclose a genuinely important trait: items are computed independently, a bad item yields estadoItem=INCONSISTENCIA_ENTRADA plus an error list while other items still compute. It does not say whether the call is a pure computation or persists anything, and gives no auth/rate-limit context, so the side-effect profile of a tax-calculation call remains 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?

Front-loaded purpose, then failure semantics, then a clearly labeled tips block, then an Args block – a reader can stop at any layer. The Args block duplicates field names the schema already declares, but since those schema fields carry no descriptions the repetition is earning its place rather than padding.

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 six-parameter tool with deeply nested item objects, no annotations, and no output schema, the definition covers purpose, prerequisites, per-item fault isolation, and argument formats. The remaining gap is the return shape beyond the error state – with no output schema, an agent still does not know which computed tax fields come back per item.

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?

Top-level schema coverage is reported as 0%, and the description compensates by documenting each of the six top-level args: 7-digit IBGE município with example 4314902, ISO 8601 dh_fato_gerador with timezone and an 'omit = now' default, UF sigla, and tp_doc model codes (55=NF-e, 65=NFC-e). 'itens' stays thin ('Itens da operação'), but the nested ItemOperacao schema documents those fields in detail, so the description puts its words where the schema is silent.

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 first sentence names a specific verb ('Calcula') and the exact tax resources (CBS, IBS estadual/municipal, Imposto Seletivo) scoped to 'operação do regime geral'. That scope plus the named taxes lets an agent separate it from calculation-adjacent siblings without opening the schema.

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 'Dicas antes de calcular' block gives an explicit prerequisite chain: get CST/cClassTrib from buscar_classificacao_tributaria or listar_situacoes_tributarias, validate NCM/NBS with validar_nomenclatura_aplicavel, get the IBGE code from listar_municipios. It also routes error-code follow-up to explicar_erro, so when-to-use and where-to-go-next are both stated.

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