Skip to main content
Glama
mdwsk88

MS 365-21V MCP Server

Search My Mail

mail_search_messages
Read-only

Search Microsoft 365 mail by keywords or KQL filters like sender, subject, or attachments, across all folders or a specified folder.

Instructions

Search mail by keywords with KQL, for example "budget", "from:Zhang Wei", "subject:review", "hasAttachments:true". Searches all folders unless folder is set. Requires delegated Mail.Read. Chinese intents / 中文意图: 搜索邮件, 按关键词查邮件, 查找某人发的邮件, 查找某封邮件.

Input Schema

NameRequiredDescriptionDefault
topNoMessages to return, from 1 to 50. Defaults to 20.
queryYesKeywords or KQL such as from:, to:, subject:, body:, hasAttachments:.
cursorNonextCursor from the previous call.
folderNoLimit to a folder such as inbox; defaults to all folders.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv0.2.0
    • addedInput schema / properties / cursor
      Added value: +{
      +  "description": "nextCursor from the previous call.",
      +  "maxLength": 4000,
      +  "type": "string"
      +}
    • addedInput schema / properties / folder
      Added value: +{
      +  "description": "Limit to a folder such as inbox; defaults to all folders.",
      +  "maxLength": 300,
      +  "minLength": 1,
      +  "type": "string"
      +}
    • changedInput schema / properties / query / description
      Previous value: -"Search query, such as sender, subject, or body keywords."New value: +"Keywords or KQL such as from:, to:, subject:, body:, hasAttachments:."
    • changedInput schema / properties / top / description
      Previous value: -"Number of messages to return, from 1 to 50."New value: +"Messages to return, from 1 to 50. Defaults to 20."
  2. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/5

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

Annotations cover the read-only and open-world profile; the description adds genuinely new behavioral context – the delegated Mail.Read permission requirement and default all-folders scope. It stops short of describing pagination or result ordering, so it is strong but not exhaustive.

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-loads the core search behavior and syntax up front, with permission and scope details following. The Chinese intent list adds length but serves a real matching purpose, so it stays reasonably tight.

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 read-only search tool with no output schema and full schema coverage, the description supplies the key extras – auth requirement and folder scope. Missing only return-value hints (nextCursor usage) which the cursor parameter largely implies.

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

Parameters3/5

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

Schema description coverage is 100%, so query, folder, top and cursor are already documented with their KQL syntax and limits. The description's examples restate schema content and the folder-default note duplicates the schema, so baseline 3 is appropriate.

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 (Search) and resource (mail) plus concrete KQL examples like from:Zhang Wei and hasAttachments:true. The keyword-search framing clearly separates it from sibling mail_list_messages and mail_get_message 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 Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides clear trigger context via KQL examples and Chinese intent phrases (搜索邮件, 查找某人发的邮件) that map user phrasing to this tool. It notes the all-folders default unless folder is set, but does not name an alternative or a when-not-to-use condition (e.g. fetch a single known message).

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