Skip to main content
Glama
billyfranklim1

mcp-evolution

Find Contacts

find_contacts

Search contacts by name or ID with optional substring filter. Paginate results using limit and offset to control payload size.

Instructions

Find contacts for the pinned instance. Supports search (substring on pushName/name/remoteJid), limit, and offset to prevent large payloads. Returns normalized { remoteJid, pushName, profilePicUrl, isBusiness } — extra fields dropped.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
whereNoOptional Prisma-style filter object (power-user). If supplied, search is ignored.
searchNoConvenience substring filter against pushName, name, or remoteJid (case-insensitive). Ignored when where is provided.
limitNoMax results to return (default 200, max 2000).
offsetNoSkip first N results (default 0).

Implementation Reference

  • The registerFindContacts function that registers the 'find_contacts' tool on the MCP server. It contains the full handler logic: builds a payload with limit/offset (and optional where), calls Evolution API at /chat/findContacts/{instanceName}, optionally filters by search substring on pushName/name/remoteJid, applies client-side slice, normalizes output to { remoteJid, pushName, profilePicUrl, isBusiness }, and returns JSON text.
    export function registerFindContacts(server: McpServer, client: EvolutionClient): void {
      server.registerTool(
        "find_contacts",
        {
          title: "Find Contacts",
          description:
            "Find contacts for the pinned instance. Supports search (substring on pushName/name/remoteJid), limit, and offset to prevent large payloads. " +
            "Returns normalized { remoteJid, pushName, profilePicUrl, isBusiness } — extra fields dropped.",
          inputSchema: schema,
        },
        async (args) => {
          try {
            const limit = args.limit ?? 200;
            const offset = args.offset ?? 0;
    
            const payload: Record<string, unknown> = args.where
              ? { where: args.where, limit, offset }
              : { limit, offset };
    
            const raw = await client.post(`/chat/findContacts/${client.instanceName}`, payload);
    
            let contacts: ContactItem[] = Array.isArray(raw) ? raw : [];
    
            // Client-side search only when no custom where was supplied
            if (!args.where && args.search) {
              const needle = args.search.toLowerCase();
              contacts = contacts.filter(
                (c) =>
                  c.pushName?.toLowerCase().includes(needle) ||
                  c.name?.toLowerCase().includes(needle) ||
                  c.remoteJid?.toLowerCase().includes(needle)
              );
            }
    
            // Client-side safety net for limit/offset (in case Evolution ignores them)
            contacts = contacts.slice(offset, offset + limit);
    
            // Normalize to compact shape — drop everything else
            const normalized = contacts.map(({ remoteJid, pushName, profilePicUrl, isBusiness }) => ({
              remoteJid,
              pushName,
              profilePicUrl,
              isBusiness,
            }));
    
            return {
              content: [{ type: "text" as const, text: JSON.stringify(normalized, null, 2) }],
            };
          } catch (e) {
            if (e instanceof McpError) {
              return { isError: true, content: [{ type: "text" as const, text: e.message }] };
            }
            throw e;
          }
        }
      );
    }
  • Input schema for find_contacts using Zod: 'where' (optional Prisma-style filter object), 'search' (optional substring filter), 'limit' (1-2000, default 200), 'offset' (min 0, default 0).
    const schema = {
      where: z
        .record(z.unknown())
        .optional()
        .describe("Optional Prisma-style filter object (power-user). If supplied, search is ignored."),
      search: z
        .string()
        .optional()
        .describe("Convenience substring filter against pushName, name, or remoteJid (case-insensitive). Ignored when where is provided."),
      limit: z
        .number()
        .int()
        .min(1)
        .max(2000)
        .default(200)
        .optional()
        .describe("Max results to return (default 200, max 2000)."),
      offset: z
        .number()
        .int()
        .min(0)
        .default(0)
        .optional()
        .describe("Skip first N results (default 0)."),
    };
  • Tool registration call: server.registerTool('find_contacts', ...) with title 'Find Contacts' and description.
    server.registerTool(
      "find_contacts",
      {
        title: "Find Contacts",
        description:
          "Find contacts for the pinned instance. Supports search (substring on pushName/name/remoteJid), limit, and offset to prevent large payloads. " +
          "Returns normalized { remoteJid, pushName, profilePicUrl, isBusiness } — extra fields dropped.",
        inputSchema: schema,
  • src/tools/index.ts:7-7 (registration)
    Import of registerFindContacts from './find-contacts.js' in the central tools barrel file.
    import { registerFindContacts } from "./find-contacts.js";
  • Call to registerFindContacts(server, client) inside registerAllTools to wire up the tool at startup.
    registerFindContacts(server, client);
Behavior3/5

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

No annotations are provided, so the description is the sole source of behavioral context. It discloses that the tool returns normalized fields and drops extra data, and mentions pagination parameters to prevent large payloads, implying it's a safe read operation. However, it does not discuss permissions, rate limits, or side effects, leaving some gaps.

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?

The description is three sentences, each serving a purpose: stating the core function, listing key features, and specifying the output format. It is front-loaded with the main purpose and contains no unnecessary words or repetition.

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 tool has no output schema, the description compensates by listing the returned fields and stating that extra fields are dropped. It covers the main parameters and their interactions. However, it does not mention behavior for empty results or whether pagination includes a total count, missing minor details.

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 adds value by explaining that 'search' is a substring match on pushName/name/remoteJid and is case-insensitive, and clarifies that 'where' overrides 'search'. It also explains the purpose of limit/offset ('prevent large payloads'). This goes beyond the schema alone.

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 states 'Find contacts for the pinned instance' with specific verb and resource. It clarifies support for search, limit, and offset, and specifies the returned fields. However, it does not explicitly distinguish this tool from other 'find_*' siblings like find_chats or find_labels, missing an opportunity to differentiate.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool vs alternatives, nor does it mention when not to use it. The usage is only implied by the purpose. No explicit context or exclusions are given.

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/billyfranklim1/mcp-evolution'

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