Skip to main content
Glama
ExoCubeYT

OpenWA MCP Server

by ExoCubeYT

get_contact

Retrieve detailed information for a specific WhatsApp contact using session and contact IDs.

Instructions

Get detailed info for a specific WhatsApp contact

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesSession ID
contactIdYesContact ID to look up

Implementation Reference

  • Handler for 'get_contact' tool - makes GET request to /sessions/{sessionId}/contacts/{contactId} and returns the contact details as text content.
    server.registerTool(
      "get_contact",
      {
        description: "Get detailed info for a specific WhatsApp contact",
        inputSchema: {
          sessionId: z.string().describe("Session ID"),
          contactId: z.string().describe("Contact ID to look up"),
        },
      },
      async ({ sessionId, contactId }) => {
        const data = await openwaClient({ method: "GET", path: `/sessions/${sessionId}/contacts/${contactId}` });
        return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
      }
    );
  • Input schema for 'get_contact' tool - requires sessionId (string) and contactId (string).
    {
      description: "Get detailed info for a specific WhatsApp contact",
      inputSchema: {
        sessionId: z.string().describe("Session ID"),
        contactId: z.string().describe("Contact ID to look up"),
      },
    },
  • Registration of 'get_contact' tool via server.registerTool() inside registerContactTools().
    server.registerTool(
      "get_contact",
      {
        description: "Get detailed info for a specific WhatsApp contact",
        inputSchema: {
          sessionId: z.string().describe("Session ID"),
          contactId: z.string().describe("Contact ID to look up"),
        },
      },
      async ({ sessionId, contactId }) => {
        const data = await openwaClient({ method: "GET", path: `/sessions/${sessionId}/contacts/${contactId}` });
        return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
      }
    );
  • src/index.ts:19-19 (registration)
    Top-level registration call that triggers the tool registration.
    registerContactTools(server);
  • Helper function 'openwaClient' used by the handler to make HTTP requests to the OpenWA 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?

With no annotations, the description carries the full burden but only states 'Get detailed info' without disclosing what coverage of details, read-only nature, or any side effects. It lacks behavioral context beyond the basic action.

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?

A single, concise sentence that front-loads the core purpose. No superfluous words.

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?

For a tool with two required parameters and no output schema, the description omits important context: what constitutes 'detailed info', return format, prerequisites (e.g., active session), or constraints. It requires the agent to infer too much.

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 coverage is 100% with clear descriptions for both parameters ('Session ID', 'Contact ID to look up'). The description adds no extra meaning, so baseline score of 3 applies.

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 'Get detailed info for a specific WhatsApp contact', using a specific verb and resource. This readily distinguishes it from sibling tools like get_contacts (listing) and check_number (verification).

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 given on when to use this tool versus alternatives. The description does not specify context, prerequisites, or when not to use it.

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