Skip to main content
Glama
Caiuriuller

SRP Hub MCP

by Caiuriuller

post_customer

Create new customer leads in the Hub by registering them from external sources. This tool validates Brazilian CPF/CNPJ IDs and manages customer records through structured operations.

Instructions

Cria um novo cliente (lead) no Hub. Use esta ferramenta para registrar leads encontrados em outras fontes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codigoYes
tipoYesTipo de pessoa. 1=Jurídica, 2=Física, 3=Exportação
cnpjCpfYesSomente dígitos: CPF (11 dígitos) ou CNPJ (14 dígitos)
nomeFantasiaYes
statusYes

Implementation Reference

  • The handler function that executes the post_customer logic, including validation and the HTTP request to create a customer.
      async ({ cnpjCpf, codigo, nomeFantasia, status, tipo }) => {
        if (tipo === constants.PESSOA.TIPO.FISICA) {
          if (!constants.CPF.test(cnpjCpf)) {
            return {
              isError: true,
              content: [{ type: "text", text: "Erro: cnpjCpf deve ser um CPF válido com 11 dígitos numéricos (sem pontos ou traços)" }],
            };
          }
        } else if (
          tipo === constants.PESSOA.TIPO.JURIDICA ||
          tipo === constants.PESSOA.TIPO.EXPORTACAO
        ) {
          if (!constants.CNPJ.test(cnpjCpf)) {
            return {
              isError: true,
              content: [{ type: "text", text: "Erro: cnpjCpf deve ser um CNPJ válido com 14 dígitos numéricos (sem pontos, barras ou traços)" }],
            };
          }
        }
    
        const { data, error } = await request<CustomerRequest, CustomerResponse>(
          "/clientes",
          "POST",
          { codigo, tipo, cnpjCpf, nomeFantasia, status },
        );
    
        if (error || !data) {
          return {
            isError: true,
            content: [{ type: "text", text: `Falha ao criar cliente: ${error ?? "resposta vazia"}` }],
          };
        }
    
        return {
          content: [
            {
              type: "text",
              text: `Cliente criado com sucesso!\n\n${JSON.stringify(data, null, 2)}`,
            },
          ],
        };
      },
    );
  • The input schema definition using Zod for the post_customer tool.
    inputSchema: z.object({
      codigo: z
        .string({ required_error: "codigo é obrigatório" })
        .min(1, "codigo não pode ser vazio")
        .max(40, "codigo deve ter no máximo 40 caracteres"),
      tipo: z
        .nativeEnum(constants.PESSOA.TIPO, {
          required_error: "tipo é obrigatório",
          invalid_type_error: `tipo deve ser: ${Object.entries(constants.PESSOA.TIPO)
            .map(([k, v]) => `${v}=${k}`)
            .join(", ")}`,
        })
        .describe("Tipo de pessoa. 1=Jurídica, 2=Física, 3=Exportação"),
      cnpjCpf: z
        .string({ required_error: "cnpjCpf é obrigatório" })
        .min(1, "cnpjCpf não pode ser vazio")
        .max(40, "cnpjCpf deve ter no máximo 40 caracteres")
        .describe("Somente dígitos: CPF (11 dígitos) ou CNPJ (14 dígitos)"),
      nomeFantasia: z
        .string({ required_error: "nomeFantasia é obrigatório" })
        .min(1, "nomeFantasia não pode ser vazio")
        .max(250, "nomeFantasia deve ter no máximo 250 caracteres"),
      status: z
        .number({ required_error: "status é obrigatório" })
        .refine(
          (v) => Object.values(constants.STATUS).includes(v),
          { message: `status deve ser ${Object.values(constants.STATUS).join(" ou ")} (0=Inativo, 1=Ativo)` },
        ),
    }),
  • The registration of the post_customer tool with the MCP server.
    server.registerTool(
      "post_customer",
      {
        description: "Cria um novo cliente (lead) no Hub. Use esta ferramenta para registrar leads encontrados em outras fontes.",
        inputSchema: z.object({
          codigo: z
            .string({ required_error: "codigo é obrigatório" })
            .min(1, "codigo não pode ser vazio")
            .max(40, "codigo deve ter no máximo 40 caracteres"),
          tipo: z
            .nativeEnum(constants.PESSOA.TIPO, {
              required_error: "tipo é obrigatório",
              invalid_type_error: `tipo deve ser: ${Object.entries(constants.PESSOA.TIPO)
                .map(([k, v]) => `${v}=${k}`)
                .join(", ")}`,
            })
            .describe("Tipo de pessoa. 1=Jurídica, 2=Física, 3=Exportação"),
          cnpjCpf: z
            .string({ required_error: "cnpjCpf é obrigatório" })
            .min(1, "cnpjCpf não pode ser vazio")
            .max(40, "cnpjCpf deve ter no máximo 40 caracteres")
            .describe("Somente dígitos: CPF (11 dígitos) ou CNPJ (14 dígitos)"),
          nomeFantasia: z
            .string({ required_error: "nomeFantasia é obrigatório" })
            .min(1, "nomeFantasia não pode ser vazio")
            .max(250, "nomeFantasia deve ter no máximo 250 caracteres"),
          status: z
            .number({ required_error: "status é obrigatório" })
            .refine(
              (v) => Object.values(constants.STATUS).includes(v),
              { message: `status deve ser ${Object.values(constants.STATUS).join(" ou ")} (0=Inativo, 1=Ativo)` },
            ),
        }),
      },
      async ({ cnpjCpf, codigo, nomeFantasia, status, tipo }) => {
        if (tipo === constants.PESSOA.TIPO.FISICA) {
          if (!constants.CPF.test(cnpjCpf)) {
            return {
              isError: true,
              content: [{ type: "text", text: "Erro: cnpjCpf deve ser um CPF válido com 11 dígitos numéricos (sem pontos ou traços)" }],
            };
          }
        } else if (
          tipo === constants.PESSOA.TIPO.JURIDICA ||
          tipo === constants.PESSOA.TIPO.EXPORTACAO
        ) {
          if (!constants.CNPJ.test(cnpjCpf)) {
            return {
              isError: true,
              content: [{ type: "text", text: "Erro: cnpjCpf deve ser um CNPJ válido com 14 dígitos numéricos (sem pontos, barras ou traços)" }],
            };
          }
        }
    
        const { data, error } = await request<CustomerRequest, CustomerResponse>(
          "/clientes",
          "POST",
          { codigo, tipo, cnpjCpf, nomeFantasia, status },
        );
    
        if (error || !data) {
          return {
            isError: true,
            content: [{ type: "text", text: `Falha ao criar cliente: ${error ?? "resposta vazia"}` }],
          };
        }
    
        return {
          content: [
            {
              type: "text",
              text: `Cliente criado com sucesso!\n\n${JSON.stringify(data, null, 2)}`,
            },
          ],
        };
      },
    );
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions creating a new customer/lead, implying a write operation, but doesn't cover critical aspects like authentication requirements, error handling, rate limits, or what happens on success/failure. This leaves significant gaps for an agent to understand the tool's behavior.

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 concise with two sentences that are front-loaded and to the point. The first sentence states the purpose, and the second provides usage context, with no wasted words. However, it could be slightly more structured by explicitly listing key parameters or outcomes.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a write operation with 5 required parameters, low schema description coverage (40%), no annotations, and no output schema, the description is incomplete. It doesn't address behavioral traits, parameter meanings beyond the schema, or expected outputs, making it inadequate for an agent to use the tool effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 40%, with only 2 out of 5 parameters having descriptions in the schema. The tool description adds no information about parameters, failing to compensate for the low coverage. It doesn't explain what 'codigo', 'nomeFantasia', or 'status' mean, leaving key inputs undocumented.

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 clearly states the action ('Cria um novo cliente') and resource ('no Hub'), specifying it's for creating a new customer/lead. It distinguishes the purpose by mentioning it's for registering leads from other sources, though without sibling tools, differentiation isn't applicable. However, it's slightly vague about what 'Hub' refers to.

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?

The description provides implied usage guidance by stating 'Use esta ferramenta para registrar leads encontrados em outras fontes,' which suggests when to use it (for leads from other sources). However, it lacks explicit when-not-to-use scenarios or alternatives, and with no sibling tools, broader context is limited.

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/Caiuriuller/srp-hub-mcp'

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