Skip to main content
Glama
ExoCubeYT

OpenWA MCP Server

by ExoCubeYT

send_audio

Sends an audio file to a WhatsApp chat using a public URL.

Instructions

Send an audio file to a WhatsApp chat by providing a publicly accessible URL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesSession ID to send from
chatIdYesTarget chat ID
urlYesPublic URL of the audio file

Implementation Reference

  • Handler function for the 'send_audio' tool. It sends an audio file to a WhatsApp chat by making a POST request to the OpenWA API endpoint /sessions/{sessionId}/messages/send-audio with chatId and url (publicly accessible URL of the audio file) in the request body.
    server.registerTool(
      "send_audio",
      {
        description: "Send an audio file to a WhatsApp chat by providing a publicly accessible URL",
        inputSchema: {
          sessionId: z.string().describe("Session ID to send from"),
          chatId: z.string().describe("Target chat ID"),
          url: z.string().describe("Public URL of the audio file"),
        },
      },
      async ({ sessionId, chatId, url }) => {
        const data = await openwaClient({
          method: "POST",
          path: `/sessions/${sessionId}/messages/send-audio`,
          body: { chatId, url },
        });
        return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
      }
    );
  • Input schema for the 'send_audio' tool: sessionId (string), chatId (string), url (string). All are required (no optional fields).
    {
      description: "Send an audio file to a WhatsApp chat by providing a publicly accessible URL",
      inputSchema: {
        sessionId: z.string().describe("Session ID to send from"),
        chatId: z.string().describe("Target chat ID"),
        url: z.string().describe("Public URL of the audio file"),
      },
  • Registration of the 'send_audio' tool via server.registerTool() inside the registerMessageTools() function.
    server.registerTool(
      "send_audio",
      {
        description: "Send an audio file to a WhatsApp chat by providing a publicly accessible URL",
        inputSchema: {
          sessionId: z.string().describe("Session ID to send from"),
          chatId: z.string().describe("Target chat ID"),
          url: z.string().describe("Public URL of the audio file"),
        },
      },
      async ({ sessionId, chatId, url }) => {
        const data = await openwaClient({
          method: "POST",
          path: `/sessions/${sessionId}/messages/send-audio`,
          body: { chatId, url },
        });
        return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
      }
    );
  • The openwaClient helper function used by the handler to make HTTP requests to the OpenWA API. It constructs the URL from BASE_URL + path, adds API key header, and sends the request.
    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?

No annotations are provided, and the description does not disclose behavioral traits such as authentication requirements, file size limits, success/failure responses, or that the URL must be publicly accessible (though implied).

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 sentence with no redundant information, making it very concise and easy to parse.

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

Completeness3/5

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

With no output schema and simple parameters, the description is minimally adequate but lacks context about prerequisites (e.g., active session) or error handling, which would improve completeness.

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 descriptions for each parameter, so the description adds little extra meaning. The addition of 'publicly accessible' for the URL is the only value beyond the schema.

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 identifies the action (send), resource (audio file), and target (WhatsApp chat) with a condition (publicly accessible URL). However, it does not differentiate from sibling 'send_file' which could also send audio files.

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 on when to use this tool versus alternatives like send_file or send_image. The description only states what it does, not when it should be preferred.

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