Skip to main content
Glama
ExoCubeYT

OpenWA MCP Server

by ExoCubeYT

upload_media

Upload media files to an OpenWA session for later use in messages. Supports image, video, audio, and document types.

Instructions

Upload media to OpenWA for later use in messages

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesSession ID
fileYesPublic URL of the media file to upload
typeYesMedia type: image, video, audio, or document

Implementation Reference

  • The async handler function for the upload_media tool. It calls openwaClient with POST method to /sessions/{sessionId}/media, sending the file URL and media type in the request body.
      async ({ sessionId, file, type }) => {
        const data = await openwaClient({
          method: "POST",
          path: `/sessions/${sessionId}/media`,
          body: { file, type },
        });
        return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
      }
    );
  • Input schema for upload_media: sessionId (string), file (string - public URL of media), type (string - image/video/audio/document).
    inputSchema: {
      sessionId: z.string().describe("Session ID"),
      file: z.string().describe("Public URL of the media file to upload"),
      type: z.string().describe("Media type: image, video, audio, or document"),
    },
  • Registration of the upload_media tool on the McpServer via server.registerTool(), with its schema and handler.
    server.registerTool(
      "upload_media",
      {
        description: "Upload media to OpenWA for later use in messages",
        inputSchema: {
          sessionId: z.string().describe("Session ID"),
          file: z.string().describe("Public URL of the media file to upload"),
          type: z.string().describe("Media type: image, video, audio, or document"),
        },
      },
      async ({ sessionId, file, type }) => {
        const data = await openwaClient({
          method: "POST",
          path: `/sessions/${sessionId}/media`,
          body: { file, type },
        });
        return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
      }
    );
  • src/index.ts:22-22 (registration)
    The registerMediaTools(server) call that activates the upload_media registration.
    registerMediaTools(server);
  • The openwaClient helper function used by the upload_media handler to make the HTTP POST request 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?

No annotations exist. The description only says 'Upload media', which indicates mutation but lacks details on behavior such as size limits, overwrite rules, or storage duration.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence, 8 words, very concise. However, it could be slightly more structured by front-loading the verb and resource, but it is not verbose.

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?

Given the presence of many sibling tools and no output schema or annotations, the description is incomplete. It does not explain return values, prerequisites, or constraints (e.g., file URL accessibility).

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% description coverage, so the description adds no additional meaning beyond the schema's parameter descriptions. Baseline score of 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 'Upload' and the resource 'media to OpenWA for later use in messages', distinguishing it from siblings like send_image or get_media.

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

Usage Guidelines3/5

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

The description implies that upload is a prerequisite for sending media messages, but does not explicitly state when to use it versus alternatives or provide exclusions.

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