Skip to main content
Glama

teams_search_messages

Read-only

Search Microsoft Teams messages by full text and filter results by sender, chat or date. Returns conversation and message IDs for work and personal accounts, with paging support.

Instructions

Full-text search of your Teams messages, optionally by sender, chat and date; results carry conversationId, messageId and fromMri. Work and personal accounts (personal accounts fall back to Teams free search; to page, repeat with from=nextFrom and the engine the result reports).

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "teams_search_messages"
  }
}

Input Schema

NameRequiredDescriptionDefault
fromNoResult offset (nextFrom of the previous page)
sizeNoResults per page (Teams free search returns at most 25)
afterNoOnly items sent at or after this ISO date/time
limitNoSame as size
queryNoSearch text. Microsoft 365 search also takes KQL: "exact phrase", OR, NOT, in:<chat or channel name>
beforeNoOnly items sent before this ISO date/time
engineNoauto (default): Microsoft 365 search (substrate), then Teams free search (osearch, personal only) when it fails or finds nothing
senderNoOnly items from this person (MRI, email or name)
accountNoAccount alias (see teams_accounts). Defaults to the default account.
conversation_idNoOnly messages in this chat or channel

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.7/5.0
Behavior4/5

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

Annotations already cover read-only and open-world safety, and the description adds real behavior beyond that: which fields results carry (conversationId, messageId, fromMri), the personal-account fallback to Teams free search, and the paging protocol across calls. It does not cover ordering, ranking, or result-limit behavior, but the added context is substantial.

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?

The purpose is front-loaded in the first clause and the second sentence carries the account-fallback and paging details. The long parenthetical in the second sentence is dense but every element is functional, so it is efficient without being sprawling.

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?

With no output schema, the description appropriately names the key return fields and covers the account-type and paging nuances that matter for a 10-parameter search tool. It stops short of describing ordering or result caps, which are minor gaps for a read-only search.

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 the baseline is 3. The description mostly restates the schema's filter parameters, though 'repeat with from=nextFrom and the engine the result reports' adds a modest hint about coupling the offset and engine parameters across pages.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/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 ('Full-text search of your Teams messages') and names the optional filters (sender, chat, date). It does not explicitly contrast with sibling tools such as teams_get_messages or teams_search_channels, leaving differentiation partly implicit, so it falls just short of a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

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

It explains the search modality and the work/personal account fallback, and gives concrete paging instructions ('repeat with from=nextFrom and the engine the result reports'). However, it never states when to prefer this over message-listing siblings or when-not to use it, so usage guidance is implied rather than explicit.

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

Deploy Server

Other Tools