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, not the whole message; read the chat with teams_read_chat_messages for the rest. 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).

Input Schema

TableJSON 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

TableJSON Schema
NameRequiredDescriptionDefault
noteNo
countNo
errorNo
accountNoThe email (UPN) of the Microsoft 365 account this call used.
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. 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"
      +}
  2. Added

TDQS

A4.7/5.0
Behavior5/5

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

Despite annotations already marking this as a safe read, the description discloses important behavioral traits beyond them: results are in relevance order, body is only a snippet around the match, at most 100 results from at most 4 pages, truncation is reported via truncated:true, and a work or school M365 account is required.

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 front-loaded with purpose, followed by usage guidance, then limitations and prerequisites. Every sentence earns its place: result ordering, snippet behavior, pagination bound, truncation signal, and account requirement are all actionable and non-redundant.

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, the description covers the key non-return concerns: when to use it, what it returns, how results are limited or truncated, and what account type is required. Nothing essential for correct invocation is missing.

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 coverage is 100%, so the schema already documents all six parameters with defaults, bounds, and formats. The description restates that the search can be by text and optionally by sender and date range but adds no additional syntax or constraints beyond what the schema provides, fitting the baseline score.

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 description states a specific verb and resource: searches Microsoft Teams chat and channel messages by text, optionally by sender and date range. It distinguishes itself from the sibling read tool by noting that results are snippets and directing the agent to teams_read_chat_messages for full messages.

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?

It gives a clear when-to-use case: find where something was discussed without knowing the chat. It also names the alternative read tool for full conversation context and specifies account prerequisites, including that personal Microsoft accounts cannot perform Teams reads.

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