Search Messages
search_messagesSearch Microsoft Teams messages across channels and chats using KQL filters for sender, recipient, mentions, attachments, read status, and date range to pinpoint relevant conversations.
Instructions
Search for messages across all Microsoft Teams channels and chats using the Microsoft Search API. The query string supports KQL (Keyword Query Language) syntax for advanced filtering: from: — messages sent by a person (e.g. from:bob) to: — messages sent to a person mentions: — messages that mention a specific user ID (without dashes) IsMentioned:true — messages that mention the current user hasAttachment:true|false — filter by attachment presence IsRead:true|false — filter by read status sent>=YYYY-MM-DD — messages sent on or after a date sent<=YYYY-MM-DD — messages sent on or before a date Examples: "quarterly report" from:alice sent>=2025-01-01 hasAttachment:true from:bob project update sent>=2025-02-01 Use get_chat_messages or get_channel_messages for browsing a specific conversation.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| from | No | Offset for pagination (0-based). Use with size to paginate through results | |
| size | No | Number of results to return (max 100) | |
| query | Yes | Search query string. Supports KQL syntax (see tool description) | |
| tenantId | No | Target tenant ID from list_tenants. Omit only when a default is configured or exactly one tenant is connected. Resource IDs belong to this tenant. | |
| contentFormat | No | Format for message content. "markdown" (default) converts Teams HTML to clean Markdown optimized for LLMs. "raw" returns original HTML from Graph API. | markdown |
| enableTopResults | No | When true, results are ranked by relevance. When false, results are unranked |