list_messages
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
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | zero-based page index for offset pagination (default 0); offsets shift as new messages arrive, so prefer `cursor` for stable walks | |
| after | No | ISO-8601 UTC lower bound on message timestamp (exclusive) | |
| limit | No | max messages to return (default 20, capped at 100 server-side) | |
| query | No | 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) | |
| before | No | ISO-8601 UTC upper bound on message timestamp (exclusive) | |
| cursor | No | 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 | |
| chat_jid | No | filter to messages in this chat (WhatsApp JID: individual as `<digits>@s.whatsapp.net` or bare phone digits, group as `<digits>-<timestamp>@g.us`) | |
| context_after | No | messages to include after each match (default 1, capped at 20 server-side) | |
| context_before | No | messages to include before each match (default 1, capped at 20 server-side) | |
| include_context | No | if true, attach a few surrounding messages to each match (defaults to true) | |
| sender_phone_number | No | 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`) |