Skip to main content
Glama

Validar CPF ou CNPJ

validar_documento
Read-onlyIdempotent

Validates CPF and CNPJ check digits locally without internet, including alphanumeric CNPJ, and returns the formatted document; it does not confirm registration or existence.

Instructions

Valida localmente (sem internet) os dígitos verificadores de um CPF ou CNPJ, inclusive o CNPJ alfanumérico em vigor desde 2026, e devolve o número formatado. Não consulta se o documento existe.

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": {
      "documento": "<documento>"
    },
    "name": "validar_documento"
  }
}

Input Schema

NameRequiredDescriptionDefault
tipoNoForça o tipo; padrão: detecta pelo tamanho
documentoYesCPF ou CNPJ, com ou sem pontuação

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare readOnly/idempotent/closed-world, so the description's added value is the scope limit (no existence check), the offline nature, and the 2026 alphanumeric CNPJ support. It does not describe failure behavior for invalid documents or the exact response shape, which keeps it at 4.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with the core action, with no redundant phrasing; the scope disclaimer is placed where it does the most work.

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?

With no output schema, the description correctly states the return value ('devolve o número formatado') and the checking scope. Minor gaps remain around invalid-input behavior, but nothing an agent needs to invoke it correctly is missing.

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% and the schema already explains the 'tipo' enum and that punctuation is optional. The description adds only the notion that the output is formatted, not deeper semantics for either parameter, so the baseline 3 applies.

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?

States a specific verb and resource ('Valida ... os dígitos verificadores de um CPF ou CNPJ') and scopes it explicitly to checksum validation returning a formatted number. The closing clause 'Não consulta se o documento existe' separates it from the sibling consultar_cnpj, which presumably queries registry existence.

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?

Gives a clear context of use (offline format/check-digit validation) and an explicit exclusion ('Não consulta se o documento existe'), which steers the agent toward a lookup tool when existence matters. It does not name the alternative tool directly, keeping it short of a 5.

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