Skip to main content
Glama

search_messages

Read-only

Search a project's mail subjects and bodies without marking messages read; filter and rank matches by relevance or recency.

Instructions

Search subjects and bodies across a project, returning {result, next_cursor?} without marking mail read. All query words must match; filters narrow those matches. Results rank by best match unless ranking:'recency'. Each excerpt has up to 512 Unicode code points and >>>matched text<<< markers; include_body_md adds full bodies. Keep query, filters and ranking unchanged when passing next_cursor as cursor; no next_cursor means the last page. Use fetch_inbox for your received unread mail, or summarize_thread for a thread's participants and recent messages.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoPositive page size; default 20, capped at 1000.
queryYesWords that must all appear; punctuation is ignored.
sinceNoISO-8601
untilNoISO-8601
cursorNoThe next_cursor of the previous page.
rankingNo'recency' for newest first; omit for best match first.
thread_idNoOnly messages in this thread.
importanceNoComma-separated levels to keep: low, normal, high, urgent.
project_keyYesAbsolute path of the repository's primary checkout.
sender_nameNoOnly messages from this agent.
include_body_mdNoInclude each full body; default false.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed7 schema fields changedv0.2.2
    • addedInput schema / properties / cursor / description
      Added value: +"The next_cursor of the previous page."
    • addedInput schema / properties / importance / description
      Added value: +"Comma-separated levels to keep: low, normal, high, urgent."
    • addedInput schema / properties / include_body_md / description
      Added value: +"Include each full body; default false."
    • addedInput schema / properties / query / description
      Added value: +"Words that must all appear; punctuation is ignored."
    • addedInput schema / properties / ranking / description
      Added value: +"'recency' for newest first; omit for best match first."
    • addedInput schema / properties / sender_name / description
      Added value: +"Only messages from this agent."
    • addedInput schema / properties / thread_id / description
      Added value: +"Only messages in this thread."
  2. First observedv0.2.1

TDQS

A4.9/5.0
Behavior5/5

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

Beyond the readOnlyHint annotation, the description discloses that mail is not marked read, that excerpts are capped at 512 code points with >>>matched text<<< markers, that all query words must match, and that pagination requires keeping query/filters/ranking unchanged. These are concrete operational details annotations cannot convey.

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

Conciseness5/5

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

Dense but front-loaded, leading with the verb, scope, and return shape before the behavioral and pagination rules. Every sentence conveys a distinct constraint or routing hint with no filler.

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 an 11-parameter search tool with no output schema, the description supplies the return structure ({result, next_cursor?}), pagination semantics, excerpt format, and alternative-tool routing. Nothing an agent needs to invoke it correctly 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 100%, so the baseline is 3, but the description adds real meaning: cursor reuse semantics ('keep query, filters and ranking unchanged when passing next_cursor'), include_body_md behavior, and ranking's effect on result order. It does not explain every parameter, but the ones it covers gain genuine context.

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 subjects and bodies across a project') plus the return shape and a behavioral guarantee (does not mark mail read). An agent can distinguish it from fetch_inbox and summarize_thread without opening a 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?

Explicitly routes the agent: 'Use fetch_inbox for your received unread mail, or summarize_thread for a thread's participants and recent messages.' This names both alternatives and the conditions that select them, leaving nothing to inference.

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