Skip to main content
Glama

search_messages

Read-onlyIdempotent

Search message content across all chats — semantic + keyword. Use to find what was said: quotes, topics, info exchanged. Pass direction, chat_kind or per_chat for an EXACT text search instead: who wrote it (outgoing = the owner), private chats or groups, one result per chat with the number of matches. That is the way to find the chat of a person by how the owner addresses them, e.g. query='Дима', direction='outgoing', chat_kind='dm', per_chat=true. For chats/threads themselves use search.threads; for files use search.files; for links use search.links.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum messages to return.
queryNoWhat to search for in message content.
date_toNoISO8601 date (YYYY-MM-DD) upper bound. OMIT to skip.
per_chatNoExact search only: one result per chat (its newest match) with `matches` = how many messages there matched. OMIT for every message.
chat_kindNoExact search only: 'dm' = private chats, 'group' = groups and channels. OMIT for both.
date_fromNoISO8601 date (YYYY-MM-DD) lower bound. OMIT to skip.
directionNoExact search only: 'outgoing' = messages the owner wrote, 'incoming' = messages others wrote. OMIT for both.
whole_wordNoExact search only: match the query as a whole word ('Дима' finds 'Привет, Дима!' but not 'Димасик'). OMIT to match any part of a word.
in_workspaceNoRun this one call in this workspace id instead of the session's. Nothing is stored; other sessions are not affected.
participant_nameNoFilter to messages involving this participant/contact name. OMIT to search across everyone (do NOT pass an empty string).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • addedInput schema / properties / chat_kind
      Added value: +{
      +  "description": "Exact search only: 'dm' = private chats, 'group' = groups and channels. OMIT for both.",
      +  "enum": [
      +    "dm",
      +    "group"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / direction
      Added value: +{
      +  "description": "Exact search only: 'outgoing' = messages the owner wrote, 'incoming' = messages others wrote. OMIT for both.",
      +  "enum": [
      +    "outgoing",
      +    "incoming"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / per_chat
      Added value: +{
      +  "description": "Exact search only: one result per chat (its newest match) with `matches` = how many messages there matched. OMIT for every message.",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / whole_word
      Added value: +{
      +  "description": "Exact search only: match the query as a whole word ('Дима' finds 'Привет, Дима!' but not 'Димасик'). OMIT to match any part of a word.",
      +  "type": "boolean"
      +}
  2. Changed1 schema field changed
    • addedInput schema / properties / in_workspace
      Added value: +{
      +  "description": "Run this one call in this workspace id instead of the session's. Nothing is stored; other sessions are not affected.",
      +  "type": "integer"
      +}
  3. First observed

TDQS

A4.5/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, so safety is covered. The description adds real behavioral context beyond that: the tool has two distinct execution modes selected by which parameters are passed, and per_chat changes the result shape (one row per chat with a matches count). It does not mention result format details or any rate limits, keeping it just below the top.

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, then mode-switching, then an example, then sibling routing. Every sentence carries information, though the middle paragraph is dense and backtick-heavy, slightly compressing the reading flow.

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?

Covers the mode distinction, the exact-search trigger parameters, an example, and sibling routing. Date bounds, limit, participant_name, whole_word, and in_workspace are documented in the schema and need no restatement here, and there is no output schema to explain. Adequate for a 10-param, all-optional search tool.

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 the baseline is 3, but the description adds genuine meaning beyond the schema: it explains that direction/chat_kind/per_chat collectively switch the tool into exact-text-search mode and spells out the semantic of outgoing vs incoming and per_chat's one-row-with-matches output. That cross-parameter interaction is not captured by the per-property schema text alone.

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 message content across all chats') plus the two retrieval modes (semantic + keyword). It explicitly distinguishes itself from search.threads, search.files, and search.links, so an agent can route 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?

Gives explicit when-to-use guidance: semantic search for quotes/topics/info, and exact text search when direction/chat_kind/per_chat are passed. It names the three sibling alternatives and their domains, plus a concrete worked example for finding a person's chat by how the owner addresses them.

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.