Skip to main content
Glama

validate_cnpj

Read-onlyIdempotent

Validates a Brazilian CNPJ (company tax ID) by applying the official checksum algorithm. Ensures accuracy for B2B invoices and supplier onboarding.

Instructions

Validates a Brazilian CNPJ (Cadastro Nacional da Pessoa Jurídica) — the 14-digit company registration number issued by the Receita Federal. Applies the official two-pass weighted checksum algorithm. Returns { valid: boolean, cnpj: string } for valid CNPJs, or { valid: false, reason: string } for invalid format or failed checksum. Use when processing Brazilian B2B invoices (Notas Fiscais), supplier onboarding, or any compliance workflow requiring a verified Brazilian company tax ID. Offline validation only.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cnpjYes14-digit Brazilian CNPJ, with or without formatting. Example: '11.222.333/0001-81' or '11222333000181'

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
validYes
cnpjNo
reasonNo
Behavior4/5

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

Annotations already declare readOnlyHint=true and idempotentHint=true. The description adds value by revealing the algorithm ('two-pass weighted checksum') and specifying return structures for valid vs. invalid inputs, including a 'reason' field for failures. No contradictions with annotations.

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 description is a single coherent paragraph with logical flow: definition, algorithm, output, use cases, and offline notice. No extraneous content, but could be slightly more structured (e.g., bullet points) for easier scanning.

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 simple validation tool with one parameter and an output schema (implied by the return description), the description covers all essential aspects: input format, return types, algorithm, and usage context. It is sufficient for an agent to use correctly.

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 100%, so baseline is 3. The description enhances by clarifying that the parameter accepts formatted or unformatted strings and providing full example patterns. It also ties the parameter to the algorithm and outputs.

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?

Description clearly states the tool validates a Brazilian CNPJ, explains what it is, and specifies the return format. It distinguishes itself from sibling validation tools (e.g., validate_cpf, validate_cuit) by focusing on CNPJ and its specific use cases in Brazilian B2B invoices and compliance.

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?

The description explicitly lists typical usage scenarios: processing Brazilian B2B invoices, supplier onboarding, and compliance workflows. It also notes 'Offline validation only,' though it doesn't explicitly state when not to use it or mention alternative tools.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/josemvelez78/mcp-latam-business'

If you have feedback or need assistance with the MCP directory API, please join our Discord server