Skip to main content
Glama
ExoCubeYT

OpenWA MCP Server

by ExoCubeYT

check_number

Check if a phone number is registered on WhatsApp to confirm account existence.

Instructions

Check if a phone number is registered on WhatsApp

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesSession ID
phoneYesPhone number in international format without + prefix

Implementation Reference

  • The async handler function that executes the 'check_number' tool logic. It takes sessionId and phone, calls the OpenWA API endpoint `/sessions/{sessionId}/contacts/{phone}/check` via the openwaClient helper, and returns the result as text content.
      async ({ sessionId, phone }) => {
        const data = await openwaClient({ method: "GET", path: `/sessions/${sessionId}/contacts/${phone}/check` });
        return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
      }
    );
  • Input schema for the 'check_number' tool, defining sessionId (string) and phone (string in international format without + prefix) as required parameters, with a description stating it checks if a phone number is registered on WhatsApp.
    {
      description: "Check if a phone number is registered on WhatsApp",
      inputSchema: {
        sessionId: z.string().describe("Session ID"),
        phone: z.string().describe("Phone number in international format without + prefix"),
      },
    },
  • Registration of the 'check_number' tool on the McpServer via server.registerTool(), binding the tool name, its schema, and the handler function together.
    server.registerTool(
      "check_number",
      {
        description: "Check if a phone number is registered on WhatsApp",
        inputSchema: {
          sessionId: z.string().describe("Session ID"),
          phone: z.string().describe("Phone number in international format without + prefix"),
        },
      },
      async ({ sessionId, phone }) => {
        const data = await openwaClient({ method: "GET", path: `/sessions/${sessionId}/contacts/${phone}/check` });
        return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
      }
    );
  • The registerContactTools function is called from src/index.ts (line 19), which registers all contact-related tools including 'check_number' on the MCP server.
    export function registerContactTools(server: McpServer) {
      server.registerTool(
        "get_contacts",
        {
          description: "List all contacts stored in the WhatsApp session",
          inputSchema: {
            sessionId: z.string().describe("Session ID"),
          },
        },
        async ({ sessionId }) => {
          const data = await openwaClient({ method: "GET", path: `/sessions/${sessionId}/contacts` });
          return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
        }
      );
  • The openwaClient helper function used by the 'check_number' handler to make HTTP requests to the OpenWA backend API.
    export async function openwaClient<T = unknown>(opts: RequestOptions): Promise<T> {
      const url = `${BASE_URL}${opts.path}`;
    
      const headers: Record<string, string> = {
        "Content-Type": "application/json",
        "X-API-Key": API_KEY,
      };
    
      const res = await fetch(url, {
        method: opts.method,
        headers,
        body: opts.body ? JSON.stringify(opts.body) : undefined,
      });
    
      const text = await res.text();
    
      if (!res.ok) {
        throw new Error(`OpenWA API ${res.status}: ${text}`);
      }
    
      try {
        return JSON.parse(text) as T;
      } catch {
        return text as T;
      }
    }
Behavior2/5

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

The description does not disclose behavioral traits beyond the basic check. It does not mention whether a session is required, what happens if the number is not registered, or any potential side effects. With no annotations, the description carries the full burden but is insufficient.

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 a single, clear sentence with no unnecessary words. It is appropriately sized for the tool's simplicity.

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?

The description fails to clarify what the tool returns (e.g., boolean or status) or any error conditions. Given no output schema, it should provide more context about the outcome.

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 input schema has 100% coverage for both parameters. The description adds no extra meaning beyond what is already in the schema (sessionId and phone format). Baseline at 3 is appropriate.

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?

The description clearly states the verb 'check' and the resource 'phone number registered on WhatsApp'. It is specific and distinguishes from sibling tools like get_contact or send_text, which have different purposes.

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?

No guidance is provided on when to use this tool versus alternatives like get_contact or get_contacts. There is no mention of prerequisites, such as requiring an active session.

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/ExoCubeYT/openwa-mcp'

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