Skip to main content
Glama

buscar_cliente_por_cep_ou_cpf

Find customers by entering a CEP (postal code) or an exact CPF number.

Instructions

Busca clientes por parte do endereço (como CEP) ou pelo CPF exato.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
termoYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • server.py:55-78 (handler)
    Handler function that implements the 'buscar_cliente_por_cep_ou_cpf' tool. It searches for clients by address/CEP (partial match via LIKE) or by exact CPF, then formats and returns the results.
    @mcp.tool()
    def buscar_cliente_por_cep_ou_cpf(termo: str) -> str:
        """Busca clientes por parte do endereço (como CEP) ou pelo CPF exato."""
        
        resultados = database.buscar_registros("clientes", "endereco", termo)
        if not resultados:
            resultados = database.buscar_registros("clientes", "cpf", termo)
        
        if not resultados: 
            return "Nenhum cliente encontrado com esse termo."
        
        output = []
        for r in resultados:
            detalhe = (
                f"ID: {r[0]}\n"
                f"Nome: {r[1]}\n"
                f"CPF: {r[2]}\n"
                f"Notas: {r[3]}\n"
                f"Endereço Completo: {r[4] if r[4] else 'Não cadastrado'}\n"
                "-------------------"
            )
            output.append(detalhe)
        
        return "\n".join(output)
  • server.py:55-56 (registration)
    The tool is registered as an MCP tool via the @mcp.tool() decorator on line 55.
    @mcp.tool()
    def buscar_cliente_por_cep_ou_cpf(termo: str) -> str:
  • The 'buscar_registros' helper function in database.py performs the actual SQL query (LIKE search) that the handler relies on to find clients by address or CPF.
    def buscar_registros(tabela, campo_filtro=None, valor_filtro=None):
        conn = sqlite3.connect(DB_NAME)
        cursor = conn.cursor()
        if campo_filtro:
            cursor.execute(f"SELECT * FROM {tabela} WHERE {campo_filtro} LIKE ?", (f"%{valor_filtro}%",))
        else:
            cursor.execute(f"SELECT * FROM {tabela}")
        rows = cursor.fetchall()
        conn.close()
        return rows
Behavior2/5

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

No annotations are provided, so the description must disclose behavioral traits. It only states the search operation but does not mention that it is read-only, any authentication requirements, or potential outcomes. This leaves uncertainty about side effects or permissions.

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?

Single sentence with no wasted words, front-loaded with verb and resource. Effectively communicates the core functionality.

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?

Given the simple tool (one parameter, output schema exists), the description is mostly adequate. It explains the two search modes but does not mention if results are returned as a list or any pagination. The output schema likely covers return structure, so this is a minor gap.

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?

The schema has 0% parameter description coverage, so the description must compensate. It explains that 'termo' can be a partial address (like CEP) or exact CPF, adding meaning beyond the raw schema. However, it lacks format details or examples for the parameter values.

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 searches for clients by address part (like CEP) or exact CPF. The verb 'Busca' and resource 'clientes' are specific, and it distinguishes from sibling tools like cadastrar_cliente (create) or editar_cliente (edit) by focusing on search/find functionality.

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 implies usage when needing to find a client by partial address or exact CPF. It does not explicitly state when not to use or compare to alternatives, but the context is clear given the sibling tools cover create/update/delete/list-all operations.

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/mateus-gondev/MCP-PIE'

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