Skip to main content
Glama

get_whatsapp_chat_messages

Retrieve WhatsApp chat messages (both inbound and outbound) for a specific device. Backed by the device-scoped Chat Messages endpoint, which requires a Platform subscription on the target device.

Available actions:

  • recent: Latest messages in a chat (newest first by default)

  • search: Text search across messages (within a chat or device-wide)

  • date_range: Messages in a specific time window

  • by_sender: Messages sent from a specific phone number or WID

  • by_type: Messages filtered by type (text, image, video, audio, document, location, contact, etc.)

  • by_id: Fetch a specific message by its WhatsApp message ID

  • thread: Get conversation context around a specific message (N before + target + N after)

  • media: Messages containing media files

The 'device' parameter accepts a device ID (24-hex), phone number in E.164 format, or device alias (e.g., "Sales 2") — pass exactly what the user named in their request. If the account has a single device, omit it and it will be auto-selected. If the account has multiple devices and the user didn't name one, the tool returns an error listing available devices — ask the user which one they mean.

Input Schema

NameRequiredDescriptionDefault
chatNoWhatsApp chat ID. Required for all actions except by_id and search (which accepts device-wide search when chat is omitted)
limitNoMaximum messages to retrieve per request (REST API caps at 50)
queryNoText to search for (required for search action)
actionYesAction to perform for WhatsApp message retrieval operations
deviceNoTarget WhatsApp device — accepts device ID (24-hex), phone number in E.164 format, or device alias. Optional: if the account has a single device, it is auto-selected; otherwise specify which one.
fieldsNoExplicit dot-path allowlist, e.g. ['id','date','flow','body']. Overrides verbosity when set.
senderNoPhone number or WID of message sender (required for by_sender action)
toDateNoUpper bound of the date range (maps to REST `before`)
fromDateNoLower bound of the date range (maps to REST `after`)
messageIdNoSpecific message ID (required for by_id and thread actions)
sortOrderNoSort order by date (default: desc)
verbosityNoResponse detail level: summary = curated high-signal fields (default, token-lean); standard = broader set; full = complete message objects (escape hatch).summary
mediaTypesNoFilter by specific media types (media action)
contextAfterNoMessages after target message (thread action)
includeMediaNoReserved for compatibility — media is always included when present
messageTypesNoTypes of messages to retrieve (required for by_type action)
contextBeforeNoMessages before target message (thread action)
includeQuotesNoWhen true, request quoted message details from the API (off by default to keep responses lean)
includeReactionsNoReserved for compatibility — reactions are returned inline by the REST API when available
includeFileDetailsNoReturn full media file metadata (media action)

Schema Changelog

Changes observed during successful MCP inspections.

No schema history has been recorded yet.

TDQS

A4.1/5.0
Behavior3/5

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

With no annotations, the description carries the full behavioral burden. It usefully discloses that the backing endpoint requires a Platform subscription on the target device and explains device auto-selection and error behavior. However, it does not describe response shape, pagination behavior, rate limits, or other operational traits that would help an agent anticipate results.

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?

The description is front-loaded with the tool purpose and then organized into action variants and device semantics. The action list is long but appropriate for an eight-action tool whose enum descriptions are otherwise generic. There is little wasted text, though the paragraph structure could be slightly tighter.

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

Completeness4/5

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

Given a complex 20-parameter tool with no annotations and no output schema, the description covers the essential invocation context: what the tool retrieves, what each action means, subscription requirements, and how to resolve the device. It stops short of describing return values or operational limits, but the rich input schema covers most parameter-level details.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the schema already documents all 20 parameters and the baseline is 3. The description adds meaningful semantics beyond the schema by explaining each action and giving detailed guidance for the device parameter, including accepted formats and multi-device handling. This is useful value-add over the structured fields.

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 states a specific verb and resource: retrieve WhatsApp chat messages, both inbound and outbound, for a specific device. It enumerates the supported retrieval actions, making clear that this is a message-level tool rather than a chat-list or chat-detail tool. An agent can distinguish it from siblings like get_whatsapp_chats and get_whatsapp_chat_by_id without opening the schema.

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

Usage Guidelines4/5

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

The description clearly explains how to choose among the tool's action variants, and gives explicit device-selection guidance including what happens when the device is omitted and how to respond to multiple-device ambiguity. It does not explicitly name sibling tools or state when not to use this tool, but the context is strong enough for correct invocation.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources