Skip to main content
Glama

search_messages

Locate emails across any folder by passing keyword, phrase, or KQL field queries directly to Microsoft Graph search.

Instructions

Search messages across all folders using Graph $search.

The query is passed to Graph as-is — supply quoting yourself if you need a literal phrase (e.g. '"weekly report"') or KQL fielded predicates (e.g. 'from:alice subject:"report"').

Graph does not allow combining $search with $filter or $orderby, and KQL has no isread/unread/flag/in predicates. To filter by isRead / sender / date / attachments while keyword-matching, use list_messages with filter="contains(subject,'…')" (or contains(body/content,'…')) instead — that path supports the full $filter grammar.

Args: query: Graph $search expression. Plain tokens match across common mail fields; quoted phrases match literally; KQL field:value forms target specific fields. mailbox: Optional mailbox. limit: 1-100. page_token: Continuation token. include_raw: Include raw payloads.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
queryYes
mailboxNo
page_tokenNo
include_rawNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.2

TDQS

A4.7/5.0
Behavior4/5

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

With no annotations, the description carries the behavioral burden, and it does so well: it discloses that the query is passed through untouched, that the caller must supply quoting, and that Graph imposes search limitations. It stops short of stating read-only safety, error/empty-result behavior, or output shape, so a small gap remains.

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?

The description is longer than average, but every paragraph earns its place: purpose, essential Graph query caveats, alternative routing, and parameter explanations. The critical usage constraints are front-loaded before the arg list, and no content is redundant with the schema.

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?

For a complex search tool with no output schema and no annotations, the description covers the main invocation risks: query syntax, quoting, Graph limitations, and the alternative path for filtered searches. It does not describe the shape of returned message objects or pagination continuation details beyond naming page_token, but this is a minor gap given the otherwise thorough guidance.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description must define every parameter, and it does: query gets a full explanation with token, phrase, and KQL field:value semantics; limit gets its range; mailbox, page_token, and include_raw all get meaningful one-line explanations. This adds substantial meaning beyond the bare schema titles.

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 first sentence names a specific verb ('Search'), a concrete resource ('messages'), and a clear scope ('across all folders'), and identifies the underlying mechanism (Graph $search). This is enough to distinguish it from sibling list_messages and other mail operations without inspecting the 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?

The description explicitly explains when this tool is the right choice (keyword search via Graph $search), states restrictions (cannot combine with $filter/$orderby, no isread/unread/flag/in KQL predicates), and names list_messages with an exact filter pattern as the alternative for filtered keyword searches. This is direct when-to-use and when-not-to-use guidance.

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