Skip to main content
Glama

Search messages

search_messages
Read-only

Search the user's messages and return those whose text — the message content or an audio message's transcript — matches query. Omit conversation_id to search every conversation at once: that is how to find which conversation mentions something, and each match names its conversation; add phone to keep it to the conversations of one connected number. Pass a conversation_id (from search_conversations or an earlier match) to search inside that one only. Matches come back most recent first with timestamps and senders, so the latest activity is on the first page. Optionally bound the search to a start_date / end_date window (e.g. "what came up this week"). To continue, pass cursor (the next_cursor from the previous page) with the same query and conversation_id, or again without one; the cursor carries the date range and the number, and a null next_cursor means the end. Only conversations the user owns or has been shared are accessible.

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": {
      "query": "<query>"
    },
    "name": "search_messages"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNoMax matches per page (default 50, capped at 200).
phoneNoOptional, without `conversation_id`: search only the conversations of this connected number, in E.164 as `list_connected_numbers` lists it. Omit it to search every number's.
queryYesText matched against message content and audio transcripts.
cursorNoThe `next_cursor` from a previous page; omit for the first page.
end_dateNoOptional ISO 8601 date (YYYY-MM-DD) upper bound on the match timestamp.
start_dateNoOptional ISO 8601 date (YYYY-MM-DD) lower bound on the match timestamp.
conversation_idNoThe conversation to search within (from `search_conversations`). Omit it to search every conversation.

Output Schema

NameRequiredDescriptionDefault
nameNoIts name; present and absent together with `conversation_id`.
queryNoThe query these matches came from.
resultsNo
next_stepNoPresent only when capture is paused for billing on one of the user's numbers — what is here still searches, but nothing new is arriving. Relay it to the user.
next_cursorNoPass back as `cursor` for the next page. It already carries the query and date range. `null` means there are no more matches.
conversation_idNoThe conversation that was searched; absent when the search covered all of them.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already cover the safety profile (readOnlyHint, destructiveHint=false, openWorldHint=false), so the bar is lower; the description nonetheless adds real behavior: results are ordered most recent first with timestamps and senders, and a `null` `next_cursor` signals the end. It also discloses the access boundary (only owned or shared conversations). It does not mention rate limits or truncation behavior, but those are secondary for a read-only search.

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?

Front-loaded with purpose and the broadest/default usage mode, then narrows to filtering and pagination. It is dense but largely waste-free; the cursor sentence is slightly convoluted with its "or again without one" clause, costing a little readability.

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 seven parameters, a required `query`, an output schema covering return values, and annotations covering safety, the description fills exactly the remaining gaps: match semantics, scoping rules, ordering, pagination continuation, and access restrictions. An agent has everything needed to call it correctly on the first attempt.

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 baseline would be 3, but the description genuinely adds meaning beyond the schema: the cursor must be replayed with the same `query` and `conversation_id`, that the cursor itself carries the date range and phone, and that `phone` only applies when no `conversation_id` is given. It omits nothing critical, though `limit` behavior is left entirely to the schema.

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?

Opens with a specific verb+resource ("Search the user's messages") and immediately defines the match semantics — text of the message content or an audio message's transcript. It also distinguishes itself from the sibling `search_conversations` by positioning that tool as the source of a `conversation_id` rather than a substitute for message search.

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?

Explicit routing for every mode: omit `conversation_id` to search broadly and discover which conversation mentions something, add `phone` to narrow to one connected number, pass `conversation_id` to search within one conversation. It also gives a concrete intent example for the date window ("what came up this week") and states the continuation protocol with `cursor`.

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