Skip to main content
Glama
whatsapp-localmind

whatsapp-localmind

by qilaidev

whatsapp_fetch_messages

Read-onlyIdempotent

Fetch cleaned WhatsApp messages from direct chats, groups, or channels by message cursor or time window, with resolved names, mentions, and reply context for analysis.

Instructions

Fetch cleaned WhatsApp messages across 1-on-1 direct chats, group chats, or channels by incremental cursor (after_msg_id) or time window (since). Automatically resolves real names, @lid identities, @mentions, 150-char reply chains, filters out revoked messages, and prepends context buffer.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "chat_ids": "<chat_ids>"
    },
    "name": "whatsapp_fetch_messages"
  }
}

Input Schema

NameRequiredDescriptionDefault
freshNoForce immediate SQLite online backup snapshot refresh.
sinceNoRelative duration (e.g. '12h', '24h', '7d') or ISO-8601 timestamp when after_msg_id is not set.24h
untilNoOptional upper bound ISO-8601 timestamp.
formatNomarkdown
chat_idsYesArray of WhatsApp chat_ids (@s.whatsapp.net, @lid, @g.us, @newsletter) or ['ALL_ALLOWED'] / ['ALL_DIRECT'] / ['ALL_GROUPS'].
chat_typeNoOptional session type filter ('all', 'direct', 'group', 'newsletter').all
fold_noiseNoFold consecutive short acknowledgment messages ('收到', 'OK', '+1') in markdown mode.
after_msg_idNoGlobal monotonic message cursor (Z_PK). Fetches only messages with msg_id > after_msg_id.
context_bufferNoNumber of preceding history messages to include as context buffer (default 10).
limit_per_chatNoMax messages per chat session (default 500, max 3000).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv4.0.0
    • changedInput schema / properties / chat_ids / description
      Previous value: -"Array of group chat_ids (@g.us) or ['ALL_ALLOWED']."New value: +"Array of WhatsApp chat_ids (@s.whatsapp.net, @lid, @g.us, @newsletter) or ['ALL_ALLOWED'] / ['ALL_DIRECT'] / ['ALL_GROUPS']."
    • addedInput schema / properties / chat_type
      Added value: +{
      +  "default": "all",
      +  "description": "Optional session type filter ('all', 'direct', 'group', 'newsletter').",
      +  "enum": [
      +    "all",
      +    "group",
      +    "direct",
      +    "newsletter",
      +    "broadcast"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / fresh / description
      Added value: +"Force immediate SQLite online backup snapshot refresh."
    • changedInput schema / properties / limit_per_chat / description
      Previous value: -"Max messages per group chat (default 500, max 3000)."New value: +"Max messages per chat session (default 500, max 3000)."
  2. First observedv3.2.0

TDQS

A3.7/5.0
Behavior4/5

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

Annotations already establish readOnly, idempotent, non-destructive, closed-world behavior, and the description adds real value on top: name/@lid/@mention resolution, 150-char reply-chain truncation, revoked-message filtering, noise folding, and the fact that `fresh` forces a SQLite backup snapshot refresh. It does not cover pagination limits or what happens when the cursor is stale, but the behavioral picture is substantially richer than the annotations alone.

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?

It is a single dense sentence, front-loaded with the verb, resource, and access modes before the enrichment features. The trailing list of automatic behaviors is long but each item is genuinely informative, so little is wasted.

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?

For a 10-parameter read-only tool with no output schema, the description covers scope, modes, and post-processing of results well enough to call it correctly. Minor gaps remain around result volume (limit_per_chat max 3000, context buffer prepending) and cursor semantics, but nothing essential is missing.

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 90%, so the parameters are already well documented and the description adds only marginal meaning by tying after_msg_id and since together. It does not explain limit_per_chat vs context_buffer interaction or the ALL_ALLOWED sentinel values, which remain schema-only. Baseline 3 is appropriate when the schema carries the load.

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 uses a specific verb ("Fetch") with a clearly bounded resource ("cleaned WhatsApp messages") and enumerates the chat scopes (1-on-1, group, channel) plus the two retrieval modes (cursor vs time window). It stops short of naming or contrasting a sibling like whatsapp_search_messages, so an agent must infer that keyword search lives elsewhere.

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?

It clarifies the internal choice between after_msg_id and since ("when after_msg_id is not set"), which is useful routing guidance. However, there is no explicit statement of when to prefer this over whatsapp_search_messages or whatsapp_list_chats, and no exclusions or prerequisites are given.

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