Skip to main content
Glama

search_messages

Read-only

Searches the text and captions of messages from the last 90 days, across all chats or within one chat, using full-text search. Returns { chats, senders?, messages }, newest first: each message has its id, timestamp, chat_jid, sender and text; chats maps each chat_jid to its chat and, for group messages, senders maps each sender_jid to that sender, both with the contact fields (name; name_source: address_book, push_name, group_subject, business, phone or unresolved; canonical_jid: the JID to pass to send_message and read_chat_history; phone_jid and lid_jid: the chat's phone-number and LID forms, null when unknown or for groups; phone_display: the number as +). Media shows up as e.g. "[voice note, 0:42]" or "[image] caption", but only captions are searchable. An edited message is found and shown by its latest text, with edited: true. Texts longer than about 300 characters are shortened around the match (text_truncated: true); read the chat with read_chat_history for the whole message. A page holds up to limit matches but stops early when they are long; when more may exist, the headline gives the before to pass for the next, older page. For messages older than 90 days or to browse a chat, use read_chat_history.

Input Schema

NameRequiredDescriptionDefault
limitNoOptional. Maximum number of results to return (default 20, max 100).
queryYesThe text to search for.
beforeNoOptional. For the next page: the `id` of the last (oldest) message of the previous results, as the headline gives it. Keep the same query and filters.
chat_jidNoOptional. Filter by a specific chat: a JID, a phone number with country code, or a contact name.
sender_jidNoOptional. Filter by who sent the message: a JID (…@s.whatsapp.net or …@lid), a phone number with country code, or a contact name. Every form of the person's number matches. A name that matches several people returns an error listing them.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Beyond the readOnlyHint, the description discloses the 90-day window, result shape, media handling, edited-message behavior, truncation around ~300 characters, and pagination behavior including when a page may stop early. These are substantial behavioral details an agent would otherwise not know.

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 long but front-loaded and information-dense, covering purpose, output shape, and edge cases. The long parenthetical listing contact fields is somewhat heavy, but every sentence serves a purpose given the lack of an output schema.

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?

There is no output schema, and the description thoroughly explains the return shape including chats, senders, message fields, truncation flags, and pagination. It is complete enough for an agent to invoke and interpret results correctly.

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 the input schema already documents all five parameters. The description adds some contextual guidance around `before` pagination and sender ambiguity, but most parameter semantics are already carried by the schema, so baseline 3 is appropriate.

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 opens with a precise verb and resource: full-text search over message text and captions from the last 90 days, across all chats or within one chat. It clearly distinguishes this tool from browsing tools like read_chat_history.

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?

It explicitly states when to use this tool versus read_chat_history: use this for search within 90 days; use read_chat_history for older messages or to browse a chat. It also clarifies that only captions are searchable for media.

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