Skip to main content
Glama

Teams Search Messages

teams_search_messages
Read-only

Searches 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

NameRequiredDescriptionDefault
limitNoMax results (default 25, max 100)
queryNoText to search for
sinceNoOnly messages on/after this date, YYYY-MM-DD (optional)
untilNoOnly messages on/before this date, YYYY-MM-DD (optional)
accountNoWhich 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_senderNoOnly messages from this sender (name or email; optional)

Output Schema

NameRequiredDescriptionDefault
noteNo
countNo
errorNo
sourceNoWhich 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).
accountNoThe email (UPN) of the Microsoft 365 account this call used.
fix_toolNo
messagesNo
truncatedNoPresent and true only when the read was cut before it had everything it was asked for.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedOutput schema / properties / messages / items / properties / body_truncated
      Added value: +{
      +  "type": "boolean"
      +}
  2. Changed2 schema fields changed
    • addedOutput schema / properties / fix_tool
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / source
      Added value: +{
      +  "description": "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).",
      +  "enum": [
      +    "graph",
      +    "local_cache"
      +  ],
      +  "type": "string"
      +}
  3. Changed7 schema fields changed
    • addedInput schema / properties / account
      Added value: +{
      +  "description": "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.",
      +  "type": "string"
      +}
    • changedInput schema / properties / from_sender / description
      Previous value: -"Filter to a sender by display-name substring (optional)"New value: +"Only messages from this sender (name or email; optional)"
    • changedInput schema / properties / limit / description
      Previous value: -"Max results, newest first (default 50, max 200)"New value: +"Max results (default 25, max 100)"
    • changedInput schema / properties / query / description
      Previous value: -"Text to find in message bodies (case-insensitive substring)"New value: +"Text to search for"
    • addedOutput schema / properties / account
      Added value: +{
      +  "description": "The email (UPN) of the Microsoft 365 account this call used.",
      +  "type": "string"
      +}
    • addedOutput schema / properties / note
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / truncated
      Added value: +{
      +  "description": "Present and true only when the read was cut before it had everything it was asked for.",
      +  "type": "boolean"
      +}
  4. Added

TDQS

A4.6/5.0
Behavior4/5

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

Goes well beyond the readOnly/openWorld annotations: relevance ordering rather than newest-first, 500-character snippet with a body_truncated flag, a hard ceiling of 100 results across at most 4 pages, a truncated flag when the read ran out of time, and a source field distinguishing graph from local_cache. The only untold behavior is latency/rate behavior of the underlying search.

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 purpose and the key caveats, and each sentence carries operational information. There is mild redundancy between the snippet/body_truncated sentence and the later 'search summary can be reordered or cut' sentence that both route to teams_read_chat_messages.

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 a search tool with an output schema and full annotation coverage, nothing an agent needs is missing: result ordering, truncation semantics, result caps, account/auth requirements, and the local-cache fallback are all documented.

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; the description adds real meaning on top by tying limit to the hard maximum of 100 results and 4 pages of search, and by clarifying that results are relevance-ordered snippets rather than full bodies. Per-parameter syntax (query, since, until, from_sender) is left to the schema.

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 precise verb and resource ('Searches the Microsoft Teams chat and channel messages'), the matching dimensions (text, sender, date range), and distinguishes itself from teams_read_chat_messages and the chat-listing siblings. An agent can select it without opening 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?

Gives an explicit use case ('find where something was discussed without knowing the chat') and names the alternative read tool for retrieving full message content. It also states the account prerequisite via connect_m365_account and the fallback path when no account is connected, so the when/when-not conditions are covered.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources