Skip to main content
Glama
stackia
by stackia

Search Messages

search_messages
Read-onlyIdempotent

Search 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

TableJSON Schema
NameRequiredDescriptionDefault
fromNoOffset for pagination (0-based). Use with size to paginate through results
sizeNoNumber of results to return (max 100)
queryYesSearch query string. Supports KQL syntax (see tool description)
tenantIdNoTarget tenant ID from list_tenants. Omit only when a default is configured or exactly one tenant is connected. Resource IDs belong to this tenant.
contentFormatNoFormat for message content. "markdown" (default) converts Teams HTML to clean Markdown optimized for LLMs. "raw" returns original HTML from Graph API.markdown
enableTopResultsNoWhen true, results are ranked by relevance. When false, results are unranked

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.1

TDQS

A4.7/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, and destructiveHint false, so the safety profile is covered. The description adds value beyond these by clarifying the global scope across all channels/chats and the KQL filtering behavior. It omits details like rate limits or result shape, but annotations lower the burden here.

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 long but efficiently organized: leading scope statement, KQL reference, examples, and sibling routing. Every section contributes to correct invocation, and the structure makes scanning easy despite the volume of syntax detail.

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?

Given the tool's complexity, the description covers the query language, pagination semantics, content format, tenant selection, and ranking behavior, either directly or via a well-described schema. There is no output schema, so a brief note about the returned message shape would make it fully complete, but this is a minor gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, but the query parameter in the schema only points to the tool description. The description compensates with a detailed KQL syntax reference, including from:, to:, mentions:, hasAttachment:, IsRead:, and sent date filters, plus multiple examples. This adds substantial meaning beyond the structured input 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?

The opening sentence names a specific action, resource, and scope: 'Search for messages across all Microsoft Teams channels and chats using the Microsoft Search API.' This clearly distinguishes it from per-conversation browsing tools and tells the agent exactly what it operates on.

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?

The description explicitly routes to alternatives with 'Use get_chat_messages or get_channel_messages for browsing a specific conversation.' It also gives representative KQL examples that show the intended use cases, so an agent knows when cross-channel searching is appropriate versus when it is not.

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