Skip to main content
Glama
mcp-whatsapp

mcp-whatsapp

list_messages

Read-onlyIdempotent

Search and page through cached WhatsApp messages by chat, sender, time range, or text, even while disconnected, and include surrounding context for each match.

Instructions

(reads local cache; works while disconnected) Search and page through cached WhatsApp messages, optionally filtering by chat, sender, time range, and substring; can include surrounding context messages. Read-only; no side effects. Use get_message_context to expand around a single known message ID, or request_sync to backfill missing history. Returns a human-readable formatted text block listing matching messages and, when more results remain, a next_cursor line; edited messages show an [edited] marker and messages deleted for everyone keep their text behind a [deleted <time> UTC] marker. Replies include their quoted context when available. Continue stable walks with that next_cursor passed back as cursor, because the legacy page offset can repeat or miss messages when new messages arrive between calls.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "list_messages"
  }
}

Input Schema

NameRequiredDescriptionDefault
pageNozero-based page index for offset pagination (default 0); offsets shift as new messages arrive, so prefer `cursor` for stable walks
afterNoISO-8601 UTC lower bound on message timestamp (exclusive)
limitNomax messages to return (default 20, capped at 100 server-side)
queryNocase-insensitive substring to match within message body (text, or the caption of an image, video or document; edited messages match their latest text; messages deleted for everyone still match)
beforeNoISO-8601 UTC upper bound on message timestamp (exclusive)
cursorNoopaque `next_cursor` value from a previous response; resumes strictly after that position (timestamp key + message ID tie-break) and takes precedence over `page`; edits and deletions keep it valid because rows are never removed from the cache
chat_jidNofilter to messages in this chat (WhatsApp JID: individual as `<digits>@s.whatsapp.net` or bare phone digits, group as `<digits>-<timestamp>@g.us`)
context_afterNomessages to include after each match (default 1, capped at 20 server-side)
context_beforeNomessages to include before each match (default 1, capped at 20 server-side)
include_contextNoif true, attach a few surrounding messages to each match (defaults to true)
sender_phone_numberNofilter to messages sent by this phone or JID (WhatsApp JID: individual as `<digits>@s.whatsapp.net` or bare phone digits, group as `<digits>-<timestamp>@g.us`)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv0.8.0
    • changedInput schema / properties / after / description
      Previous value: -"ISO-8601 UTC lower bound on message timestamp (inclusive)"New value: +"ISO-8601 UTC lower bound on message timestamp (exclusive)"
    • changedInput schema / properties / before / description
      Previous value: -"ISO-8601 UTC upper bound on message timestamp (inclusive)"New value: +"ISO-8601 UTC upper bound on message timestamp (exclusive)"
    • addedInput schema / properties / cursor
      Added value: +{
      +  "description": "opaque `next_cursor` value from a previous response; resumes strictly after that position (timestamp key + message ID tie-break) and takes precedence over `page`; edits and deletions keep it valid because rows are never removed from the cache",
      +  "type": "string"
      +}
    • changedInput schema / properties / page / description
      Previous value: -"zero-based page index for paging through results (default 0)"New value: +"zero-based page index for offset pagination (default 0); offsets shift as new messages arrive, so prefer `cursor` for stable walks"
  2. Changed1 schema field changedv0.7.2
    • changedInput schema / properties / query / description
      Previous value: -"case-insensitive substring to match within message body"New value: +"case-insensitive substring to match within message body (text, or the caption of an image, video or document; edited messages match their latest text; messages deleted for everyone still match)"
  3. Changed10 schema fields changedv0.3.0
    • changedInput schema / properties / after / description
      Previous value: -"ISO-8601 lower bound"New value: +"ISO-8601 UTC lower bound on message timestamp (inclusive)"
    • changedInput schema / properties / before / description
      Previous value: -"ISO-8601 upper bound"New value: +"ISO-8601 UTC upper bound on message timestamp (inclusive)"
    • changedInput schema / properties / chat_jid / description
      Previous value: -"WhatsApp JID: individual as `<digits>@s.whatsapp.net` or bare phone digits, group as `<digits>-<timestamp>@g.us`"New value: +"filter to messages in this chat (WhatsApp JID: individual as `<digits>@s.whatsapp.net` or bare phone digits, group as `<digits>-<timestamp>@g.us`)"
    • addedInput schema / properties / context_after / description
      Added value: +"messages to include after each match (default 1, capped at 20 server-side)"
    • addedInput schema / properties / context_before / description
      Added value: +"messages to include before each match (default 1, capped at 20 server-side)"
    • addedInput schema / properties / include_context / description
      Added value: +"if true, attach a few surrounding messages to each match (defaults to true)"
    • addedInput schema / properties / limit / description
      Added value: +"max messages to return (default 20, capped at 100 server-side)"
    • addedInput schema / properties / page / description
      Added value: +"zero-based page index for paging through results (default 0)"
    • changedInput schema / properties / query / description
      Previous value: -"case-insensitive substring to match"New value: +"case-insensitive substring to match within message body"
    • changedInput schema / properties / sender_phone_number / description
      Previous value: -"WhatsApp JID: individual as `<digits>@s.whatsapp.net` or bare phone digits, group as `<digits>-<timestamp>@g.us`"New value: +"filter to messages sent by this phone or JID (WhatsApp JID: individual as `<digits>@s.whatsapp.net` or bare phone digits, group as `<digits>-<timestamp>@g.us`)"
  4. First observedv0.1.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false and openWorldHint=false, yet the description still adds real value: it discloses that the tool reads a local cache and works while disconnected, and it explains the returned text block, the `next_cursor` line, `[edited]` and `[deleted <time> UTC]` markers, and quoted replies. The one remaining gap is that it doesn't say how cached-but-unsynced data affects result completeness beyond the request_sync pointer.

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 parenthetical cache note is front-loaded and the search/paging purpose follows immediately; the return-format and pagination sentences each carry distinct information. The final sentence about `next_cursor` vs `page` overlaps with what the schema already says about offsets shifting, so it is slightly redundant but not wasteful.

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

Completeness5/5

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

With 11 optional parameters, no output schema, and no required arguments, the description does the work structured fields can't: it describes the return shape, pagination continuation, edit/deletion markers, and offline-cache behavior. An agent has everything needed to call it correctly and interpret the response.

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%, so all 11 parameters including cursor/page precedence and server-side caps are already documented in structured form. The description restates the page-vs-cursor stability tradeoff and the existence of context inclusion, but adds no syntax, format, or default information the schema doesn't already carry — baseline 3.

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?

States a specific verb and resource ('Search and page through cached WhatsApp messages') plus the filtering dimensions (chat, sender, time range, substring) and the context-expansion capability. The scope is precise enough to distinguish it from get_message_context and request_sync without opening any schema.

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

Usage Guidelines5/5

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

Explicitly routes the agent: 'Use get_message_context to expand around a single known message ID, or request_sync to backfill missing history,' and additionally tells the agent to prefer `cursor` over `page` for stable walks. Both the when-to-use-this and the when-to-use-a-sibling conditions are stated.

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