Skip to main content
Glama

waha_pin_message

Pin important messages to the top of WhatsApp chats for easy reference, with customizable duration settings.

Instructions

Pin a message in a chat. Pinned messages appear at the top of the chat.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chatIdYesChat ID (format: number@c.us)
messageIdYesMessage ID to pin
durationNoPin duration in seconds (default: 86400 = 24 hours)

Implementation Reference

  • MCP server handler function that processes the waha_pin_message tool call, validates inputs, calls the WAHA client pinMessage method, and returns success response.
    private async handlePinMessage(args: any) {
      const chatId = args.chatId;
      const messageId = args.messageId;
      const duration = args.duration || 86400; // Default 24 hours
    
      if (!chatId) {
        throw new Error("chatId is required");
      }
    
      if (!messageId) {
        throw new Error("messageId is required");
      }
    
      await this.wahaClient.pinMessage({
        chatId,
        messageId,
        duration,
      });
    
      return {
        content: [
          {
            type: "text",
            text: `Successfully pinned message ${messageId} in chat ${chatId}.\nDuration: ${duration} seconds`,
          },
        ],
      };
    }
  • Tool schema definition including name, description, and input schema returned by ListToolsRequestSchema handler.
    name: "waha_pin_message",
    description: "Pin a message in a chat. Pinned messages appear at the top of the chat.",
    inputSchema: {
      type: "object",
      properties: {
        chatId: {
          type: "string",
          description: "Chat ID (format: number@c.us)",
        },
        messageId: {
          type: "string",
          description: "Message ID to pin",
        },
        duration: {
          type: "number",
          description: "Pin duration in seconds (default: 86400 = 24 hours)",
          default: 86400,
        },
      },
      required: ["chatId", "messageId"],
    },
  • src/index.ts:1063-1064 (registration)
    Registration of the waha_pin_message tool in the CallToolRequestSchema switch statement, dispatching to the handler.
    case "waha_pin_message":
      return await this.handlePinMessage(args);
  • WAHAClient helper method that makes the HTTP POST request to the WAHA API to pin the message.
    async pinMessage(params: {
      chatId: string;
      messageId: string;
      duration?: number;
    }): Promise<void> {
      const { chatId, messageId, duration } = params;
    
      if (!chatId) {
        throw new WAHAError("chatId is required");
      }
    
      if (!messageId) {
        throw new WAHAError("messageId is required");
      }
    
      const queryParams: Record<string, any> = {};
      if (duration !== undefined) {
        queryParams.duration = duration;
      }
    
      const queryString = this.buildQueryString(queryParams);
      const endpoint = `/api/${this.session}/chats/${encodeURIComponent(
        chatId
      )}/messages/${encodeURIComponent(messageId)}/pin${queryString}`;
    
      await this.request<void>(endpoint, {
        method: "POST",
      });
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action and effect but omits critical details: whether pinning requires specific permissions (e.g., admin rights in groups), if it's reversible (implied by 'waha_unpin_message' sibling), rate limits, or error conditions. For a mutation tool with zero annotation coverage, this is a significant gap.

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 two concise sentences that efficiently convey the core purpose and effect without any wasted words. It is front-loaded with the main action, making it easy for an agent to parse quickly.

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 complexity of a mutation tool (pinning messages) with no annotations and no output schema, the description is incomplete. It lacks information on permissions, side effects, error handling, and return values, which are crucial for safe and effective tool invocation. The schema covers parameters well, but behavioral aspects are underspecified.

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 description coverage is 100%, with clear parameter descriptions in the input schema (e.g., 'Chat ID (format: number@c.us)', 'Pin duration in seconds (default: 86400 = 24 hours)'). The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline of 3 for high schema coverage.

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 states the action ('Pin a message') and resource ('in a chat'), with a brief explanation of the effect ('Pinned messages appear at the top of the chat'). It distinguishes from siblings like 'waha_unpin_message' by specifying the opposite action, though not explicitly. However, it lacks explicit sibling differentiation, keeping it at 4 instead of 5.

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 versus alternatives. It does not mention prerequisites (e.g., needing admin rights in a group chat), exclusions, or comparisons to similar tools like 'waha_star_message' (which might bookmark rather than pin). Without such context, the agent lacks clear usage direction.

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/seejux/waha-whatsapp-mcp'

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