Skip to main content
Glama

get_channel_message_replies

Retrieve all replies to a specific message in a Microsoft Teams channel, including reply content, sender details, and timestamps for threaded conversations.

Instructions

Get all replies to a specific message in a channel. Returns reply content, sender information, and timestamps.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
teamIdYesTeam ID
channelIdYesChannel ID
messageIdYesMessage ID to get replies for
limitNoNumber of replies to retrieve (default: 20)

Implementation Reference

  • The handler function that fetches and formats replies to a specific message in a Microsoft Teams channel using the Graph API. Handles pagination with $top, sorts replies chronologically, and includes error handling.
      async ({ teamId, channelId, messageId, limit }) => {
        try {
          const client = await graphService.getClient();
    
          // Only $top is supported for message replies
          const queryParams: string[] = [`$top=${limit}`];
          const queryString = queryParams.join("&");
    
          const response = (await client
            .api(
              `/teams/${teamId}/channels/${channelId}/messages/${messageId}/replies?${queryString}`
            )
            .get()) as GraphApiResponse<ChatMessage>;
    
          if (!response?.value?.length) {
            return {
              content: [
                {
                  type: "text",
                  text: "No replies found for this message.",
                },
              ],
            };
          }
    
          const repliesList: MessageSummary[] = response.value.map((reply: ChatMessage) => ({
            id: reply.id,
            content: reply.body?.content,
            from: reply.from?.user?.displayName,
            createdDateTime: reply.createdDateTime,
            importance: reply.importance,
          }));
    
          // Sort replies by creation date (oldest first for replies)
          repliesList.sort((a, b) => {
            const dateA = new Date(a.createdDateTime || 0).getTime();
            const dateB = new Date(b.createdDateTime || 0).getTime();
            return dateA - dateB;
          });
    
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(
                  {
                    parentMessageId: messageId,
                    totalReplies: repliesList.length,
                    hasMore: !!response["@odata.nextLink"],
                    replies: repliesList,
                  },
                  null,
                  2
                ),
              },
            ],
          };
        } catch (error: unknown) {
          const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
          return {
            content: [
              {
                type: "text",
                text: `❌ Error: ${errorMessage}`,
              },
            ],
          };
        }
      }
    );
  • Zod input schema validating parameters: teamId (string), channelId (string), messageId (string), limit (number, 1-50, default 20).
    {
      teamId: z.string().describe("Team ID"),
      channelId: z.string().describe("Channel ID"),
      messageId: z.string().describe("Message ID to get replies for"),
      limit: z
        .number()
        .min(1)
        .max(50)
        .optional()
        .default(20)
        .describe("Number of replies to retrieve (default: 20)"),
    },
  • Registration of the tool with MCP server, including name, description.
    server.tool(
      "get_channel_message_replies",
      "Get all replies to a specific message in a channel. Returns reply content, sender information, and timestamps.",
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the return content (replies with content, sender info, timestamps), which is helpful, but lacks critical details like pagination behavior, rate limits, authentication requirements, error conditions, or whether it's a read-only operation. For a tool with no annotations, this leaves significant gaps in understanding its behavior.

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 description is appropriately concise with two sentences: one stating the purpose and another detailing the return values. It's front-loaded with the core function, and every sentence adds value (the second clarifies output content). There's no wasted verbiage, though it could be slightly more structured with bullet points for returns.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is incomplete for a tool with 4 parameters. It covers the basic purpose and return content but misses behavioral aspects (e.g., pagination, errors, auth), usage context relative to siblings, and deeper parameter insights. For a read operation in a collaborative toolset, this leaves too much unspecified.

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 schema fully documents all parameters. The description adds no additional parameter semantics beyond what's in the schema—it doesn't explain relationships between parameters (e.g., that teamId, channelId, and messageId form a hierarchy) or provide usage examples. This meets the baseline for high schema coverage but doesn't enhance understanding.

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 clearly states the verb ('Get') and resource ('all replies to a specific message in a channel'), making the purpose immediately understandable. It distinguishes from siblings like 'get_channel_messages' by focusing on replies rather than primary messages. However, it doesn't explicitly contrast with 'reply_to_channel_message' or 'get_recent_messages', which slightly limits differentiation.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to prefer this over 'get_channel_messages' for replies, or how it relates to 'get_recent_messages' or 'search_messages'. Without such context, an agent might struggle to select the right tool for fetching message replies in different scenarios.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/floriscornel/teams-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server