Skip to main content
Glama

Consultar cliente/destinatario por CNPJ, CPF, IE ou nome

cliente_consultar
Read-onlyIdempotent

Pesquisa unificada de cliente/fornecedor. Tenta primeiro o cadastro local da empresa logada e, se nao achar e o termo for um CNPJ valido, consulta a BrasilAPI (Receita Federal) - razao social, endereco, situacao cadastral. E a tool CORRETA pra saber se um CNPJ esta ativo e pegar seus dados (razao social, endereco) - nao confunda com cadastro_consultar, que so traz Inscricao Estadual (IE) da SEFAZ. Use ANTES de pedir CNPJ ao usuario; geralmente o usuario informa nome ou apelido (ex: 'TNT', 'Correios'). Obs: consulta na Receita so funciona por CNPJ - CPF nao tem base publica. Para obter a Inscricao Estadual (operacao com ICMS), use cadastro_consultar. PAGINACAO: Limite default 10 (max 50). Use Offset pra ir alem - o retorno traz TotalGeral. Se TotalGeral > matches retornados, peça mais paginas em vez de inventar/agrupar.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
UfNo
TermoNo
FontesNo
LimiteNo
OffsetNo
TipoBuscaNo
IncluirInativasNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
AvisosNo
LimiteNo
OffsetNo
MatchesNo
TotalGeralNo
TotalLocalNo
TipoDetectadoNo
TermoNormalizadoNo
ConsultouBrasilApiNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed31 schema fields changed
    • changedInput schema / properties / Fontes / type
      Previous value: -"array"New value: +[
      +  "array",
      +  "null"
      +]
    • changedInput schema / properties / Limite / type
      Previous value: -"integer"New value: +[
      +  "integer",
      +  "null"
      +]
    • changedInput schema / properties / Offset / type
      Previous value: -"integer"New value: +[
      +  "integer",
      +  "null"
      +]
    • changedInput schema / properties / Termo / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "null"
      +]
    • changedInput schema / properties / TipoBusca / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "null"
      +]
    • changedInput schema / properties / Uf / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "null"
      +]
    • changedOutput schema / properties / Avisos / type
      Previous value: -"array"New value: +[
      +  "array",
      +  "null"
      +]
    • changedOutput schema / properties / Matches / items / properties / CpfCnpj / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "null"
      +]
    • changedOutput schema / properties / Matches / items / properties / Email / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "null"
      +]
    • changedOutput schema / properties / Matches / items / properties / Endereco / properties / Bairro / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "null"
      +]
    • changedOutput schema / properties / Matches / items / properties / Endereco / properties / Cep / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "null"
      +]
    • changedOutput schema / properties / Matches / items / properties / Endereco / properties / CodMunicipio / type
      Previous value: -"integer"New value: +[
      +  "integer",
      +  "null"
      +]
    • changedOutput schema / properties / Matches / items / properties / Endereco / properties / CodPais / type
      Previous value: -"integer"New value: +[
      +  "integer",
      +  "null"
      +]
    • changedOutput schema / properties / Matches / items / properties / Endereco / properties / Complemento / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "null"
      +]
    • changedOutput schema / properties / Matches / items / properties / Endereco / properties / Logradouro / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "null"
      +]
    • changedOutput schema / properties / Matches / items / properties / Endereco / properties / Municipio / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "null"
      +]
    • changedOutput schema / properties / Matches / items / properties / Endereco / properties / Numero / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "null"
      +]
    • changedOutput schema / properties / Matches / items / properties / Endereco / properties / Pais / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "null"
      +]
    • changedOutput schema / properties / Matches / items / properties / Endereco / properties / Uf / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "null"
      +]
    • changedOutput schema / properties / Matches / items / properties / Endereco / type
      Previous value: -"object"New value: +[
      +  "object",
      +  "null"
      +]
    • changedOutput schema / properties / Matches / items / properties / Fonte / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "null"
      +]
    • changedOutput schema / properties / Matches / items / properties / IdCliente / type
      Previous value: -"integer"New value: +[
      +  "integer",
      +  "null"
      +]
    • changedOutput schema / properties / Matches / items / properties / Ie / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "null"
      +]
    • changedOutput schema / properties / Matches / items / properties / IndicadorIe / type
      Previous value: -"integer"New value: +[
      +  "integer",
      +  "null"
      +]
    • changedOutput schema / properties / Matches / items / properties / Nome / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "null"
      +]
    • changedOutput schema / properties / Matches / items / properties / NomeFantasia / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "null"
      +]
    • changedOutput schema / properties / Matches / items / properties / Situacao / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "null"
      +]
    • changedOutput schema / properties / Matches / items / properties / Telefone / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "null"
      +]
    • changedOutput schema / properties / Matches / type
      Previous value: -"array"New value: +[
      +  "array",
      +  "null"
      +]
    • changedOutput schema / properties / TermoNormalizado / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "null"
      +]
    • changedOutput schema / properties / TipoDetectado / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "null"
      +]
  2. First observed

TDQS

A4.5/5.0
Behavior5/5

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

Annotations already declare readOnly/openWorld/idempotent, and the description goes well beyond them: local-first fallback to an external government API, the CPF limitation, and pagination behavior (default 10, max 50, TotalGeral reconciliation instead of inventing data). That is meaningful context an agent needs before calling.

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-loads the core purpose and labels pagination clearly, so it scans well. It is still fairly long and repeats the cadastro_consultar/IE guidance twice, which is minor redundancy rather than bloat.

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 multi-source, externally dependent search tool the description supplies the decision-critical behavior and pagination rules, and an output schema exists so return fields are not the description's burden. The main gap is that four of seven parameters get no explanation anywhere.

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 0%, so the description must compensate. It does give real semantics for Termo (name/nickname/CNPJ, valid-CNPJ triggers BrasilAPI), Limite (default 10, max 50) and Offset, but leaves Uf, Fontes, TipoBusca and IncluirInativas entirely undocumented.

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 clear verb+resource (“Pesquisa unificada de cliente/fornecedor”) and defines the two-stage strategy (local registry first, then BrasilAPI/Receita for valid CNPJ). It explicitly distinguishes itself from cadastro_consultar, so an agent can tell the siblings apart without opening either 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?

Gives explicit when-to-use (“Use ANTES de pedir CNPJ ao usuario”), when-not (“consulta na Receita so funciona por CNPJ - CPF nao tem base publica”), and names the alternative with its condition (“Para obter a Inscricao Estadual ... use cadastro_consultar”). Routing is unambiguous.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.