Skip to main content
Glama

search_messages_raw

Read-only

Run a Gmail, Slack or Messenger query in that connector's own syntax across ALL of the user's accounts for that connector (or a subset via accounts) and return normalized messages (no relevance filtering). Bare Slack channel IDs in in:/-in: are normalized to Slack's <#ID> syntax. Gmail supports the full operator set: from: to: cc: subject: has:attachment filename: is:unread/read/starred/important label: after:/before:/newer_than:/older_than: larger:/smaller: — and in:anywhere to include spam & trash (excluded by default). messenger = space-separated keywords, AND semantics over recent messages. slack = Slack search syntax: plain keywords + from:@name in:#channel or in:<#CHANNEL_ID> after:/before:/during:YYYY-MM-DD has:link (no relative window like newer_than — use after: with a date). One hit per MESSAGE; external_id is 'channel_id:ts' (pass it to send_message's reply_to_external_id to reply in-thread). Requires a workspace connected with search:read — workspaces without it are reported in errors with a reconnect hint. Each Gmail hit is ONE THREAD, represented by its newest matching message (not the thread's oldest message), deduplicated within each page; a thread may recur on later pages. limit is the provider page size per account (default 30, max 100). Follow pagination.next_cursor with identical inputs until has_more is false. Empty filtered pages can have a continuation. Gmail totals estimate matching messages, not unique threads. Pagination and common filters are supported for Gmail and Slack only; Messenger retains its keyword-only recent-message search, nonempty query and 50-per-account maximum, without continuation. Exhaustion never implies complete historical coverage. Call list_accounts first to learn valid account labels. Returned messages include account, subject, sender, snippet, body, url and message_at (ISO). Recipient, cc, labels, has_attachments and is_unread are source-specific and may be absent. The response also carries per-account errors and pagination.accounts with totals (exact/estimate/unknown), coverage notes and unsupported filters. Common filters are combined with the native query. unread is Gmail-only; dm is Slack DM/MPDM; mention is a direct Slack mention of the connected user (not user-group/channel mentions). after is inclusive and before exclusive ISO timestamps with timezone. Unsupported filters fail per account instead of being ignored. Use this when you want to drive the query and judge results yourself; use search_messages to have us build and curate. Each errors[] entry carries kind: 'reconnect' = that account's connection is broken or lacks a permission (tell the user to reconnect it under 設定 → サービス連携); 'accounthub_unavailable' = AccountHub itself is down — show the error text (it asks the user to contact the service provider); reconnecting will not help, so never suggest reconnecting; 'provider_unavailable' = Slack/Google itself may be having an outage (not the user's connection, not AccountHub) — show the error text with its status-page link and retry later; 'transient' = rate limit, wait and retry. Only 'reconnect' means reconnecting helps. Chatwork has no search API: it scans only the latest 100 messages of each of the most recently active rooms (default 10, max 30), by keyword substring (space-separated = AND) — older messages are NOT found and there is no time-range filter. coverage in the result says exactly what was scanned. For connector="chatwork" the query is plain keywords (space-separated = AND).

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

Input Schema

NameRequiredDescriptionDefault
limitNoProvider page size PER account (default 30; Gmail/Slack max 100, Messenger max 50). Follow next_cursor for more; filtering/dedup can produce fewer results.
queryYesConnector-native query, e.g. Gmail: "from:tanaka is:unread newer_than:7d has:attachment".
cursorNoOpaque next_cursor from the preceding page. Keep connector, query, accounts, limit and filters unchanged. Expires after 15 minutes.
filtersNoGmail/Slack shared filters; unsupported conditions return explicit errors. Messenger does not support these filters. after/before are timezone-qualified ISO instants.
accountsNoLimit to these account labels (see list_accounts). Omit to search all accounts for the connector.
connectorYesConnector to search. Its native query syntax applies.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changed
    • addedInput schema / properties / cursor
      Added value: +{
      +  "description": "Opaque next_cursor from the preceding page. Keep connector, query, accounts, limit and filters unchanged. Expires after 15 minutes.",
      +  "maxLength": 65536,
      +  "type": "string"
      +}
    • addedInput schema / properties / filters
      Added value: +{
      +  "description": "Gmail/Slack shared filters; unsupported conditions return explicit errors. Messenger does not support these filters. after/before are timezone-qualified ISO instants.",
      +  "properties": {
      +    "after": {
      +      "type": "string"
      +    },
      +    "before": {
      +      "type": "string"
      +    },
      +    "dm": {
      +      "type": "boolean"
      +    },
      +    "mention": {
      +      "type": "boolean"
      +    },
      +    "unread": {
      +      "type": "boolean"
      +    }
      +  },
      +  "type": "object"
      +}
    • changedInput schema / properties / limit / description
      Previous value: -"Max threads/messages to return PER account (default 30, all connectors). Raise it when the user wants an exhaustive list."New value: +"Provider page size PER account (default 30; Gmail/Slack max 100, Messenger max 50). Follow next_cursor for more; filtering/dedup can produce fewer results."
    • changedInput schema / properties / limit / maximum
      Previous value: -50New value: +100
    • removedInput schema / properties / query / minLength
      Removed value: -1
  2. Changed1 schema field changed
    • changedInput schema / properties / connector / enum
      Previous value: -[
      -  "gmail",
      -  "slack",
      -  "messenger"
      -]New value: +[
      +  "gmail",
      +  "slack",
      +  "messenger",
      +  "chatwork"
      +]
  3. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Annotations only declare readOnlyHint=true; the description adds what actually matters for this tool: a required search:read scope, how missing scopes surface in errors, the meaning of each errors[].kind (reconnect vs accounthub_unavailable vs provider_unavailable vs transient), Gmail's one-hit-per-thread dedup behavior and thread recurrence across pages, and a warning that exhausted pagination never implies complete historical coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The purpose and the sibling routing are front-loaded in the first and last thirds, but the body is a single dense paragraph of roughly 450 words mixing Gmail syntax, Slack syntax, Messenger rules, pagination rules, error taxonomy, and Chatwork caveats. Almost every sentence carries information, but the lack of paragraph breaks or bullets makes it hard to scan for the one connector the agent actually needs.

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?

For a six-parameter, multi-connector search tool with no output schema, the description is unusually complete: it enumerates returned fields (account, subject, sender, snippet, body, url, message_at) and notes which are source-specific and may be absent, and it explains the response's per-account errors and pagination.accounts with totals and coverage notes. Nothing an agent needs to invoke or interpret the call is missing.

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 already 100%, yet the description still adds meaning: limit is per-account provider page size (default 30, max 100), next_cursor must be followed with identical inputs until has_more is false, and the shared filters have connector-specific semantics (unread is Gmail-only, dm is Slack DM/MPDM, mention is a direct mention of the connected user, after inclusive and before exclusive). It does not add much beyond the schema for accounts or cursor expiry, but the filter semantics are genuinely new information.

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 opening sentence states a specific verb (run a query in the connector's own syntax), the resource (messages across all accounts for a connector), and the scope (no relevance filtering). It also explicitly contrasts itself with the sibling search_messages, so an agent can choose between them without opening either 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?

It gives a direct routing rule ('Use this when you want to drive the query and judge results yourself; use search_messages to have us build and curate') and a prerequisite ('Call list_accounts first to learn valid account labels'). It also states per-connector capability limits, e.g. Chatwork has no search API and is limited to the latest 100 messages of the 10 most recently active rooms (max 30).

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