Teams Search Messages
teams_search_messagesSearches the Microsoft Teams chat and channel messages of a Microsoft 365 account with Microsoft Search: by text, and optionally by sender and date range. Use it to find where something was discussed without knowing the chat. Results come in Microsoft's relevance order (not newest first), and body is a snippet around the match (at most 500 characters; body_truncated: true when it was cut), not the whole message; read the chat with teams_read_chat_messages for the rest. Each hit's text is Microsoft's search summary and can be reordered or cut; to quote a message exactly, read it with teams_read_chat_messages. Returns at most 100 results from at most 4 pages of the search. When the read is cut (by that bound, or because the call ran out of time) the answer has truncated: true. Needs a work or school Microsoft 365 account connected with connect_m365_account (personal Microsoft accounts have no Teams reads). When no Microsoft 365 account is connected at all, it reads the Teams app's local cache on this Mac instead (needs Full Disk Access, can be hours or days behind); the answer's source says which one answered (graph or local_cache).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Max results (default 25, max 100) | |
| query | No | Text to search for | |
| since | No | Only messages on/after this date, YYYY-MM-DD (optional) | |
| until | No | Only messages on/before this date, YYYY-MM-DD (optional) | |
| account | No | Which connected Microsoft 365 account to use: its email (UPN), its id from list_m365_accounts, or its display name when unique. Leave it out to use the default account. | |
| from_sender | No | Only messages from this sender (name or email; optional) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note | No | ||
| count | No | ||
| error | No | ||
| source | No | Which source answered: graph (Microsoft 365) or local_cache (the Teams app's cache on this Mac, used only when no Microsoft 365 account is connected). | |
| account | No | The email (UPN) of the Microsoft 365 account this call used. | |
| fix_tool | No | ||
| messages | No | ||
| truncated | No | Present and true only when the read was cut before it had everything it was asked for. |