Skip to main content
Glama
InditexTech

MCP Microsoft Teams Server

by InditexTech

update_thread

Update an existing Microsoft Teams thread with new content to keep conversations current. Optionally mention a member to notify them.

Instructions

Update an existing thread with new content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
thread_idYesThe thread ID as a string in the format '1743086901347'
contentYesThe content to update in the thread
member_nameNoMember name to mention in the thread

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
thread_idYesThread ID as a string in the format '1743086901347'
message_idYesMessage ID
contentYesMessage content

Implementation Reference

  • MCP tool handler for 'update_thread' - receives thread_id, content, and optional member_name, then delegates to TeamsClient.update_thread()
    @mcp.tool(
        name="update_thread", description="Update an existing thread with new content"
    )
    async def update_thread(
        ctx: Context,
        thread_id: str = Field(
            description="The thread ID as a string in the format '1743086901347'"
        ),
        content: str = Field(description="The content to update in the thread"),
        member_name: str | None = Field(
            description="Member name to mention in the thread", default=None
        ),
    ) -> TeamsMessage:
        await ctx.debug(f"update_thread with thread_id={thread_id} and content={content}")
        client = _get_teams_client(ctx)
        return await client.update_thread(thread_id, content, member_name)
  • Registration of the 'update_thread' tool via @mcp.tool decorator with name and description
    @mcp.tool(
        name="update_thread", description="Update an existing thread with new content"
    )
  • Return type schema (TeamsMessage) for the update_thread tool
    class TeamsMessage(BaseModel):
        thread_id: str = Field(
            description="Thread ID as a string in the format '1743086901347'"
        )
        message_id: str = Field(description="Message ID")
        content: str | None = Field(description="Message content")
  • Core logic of update_thread: initializes the client, creates a message with optional mention, sends it to the thread conversation via the Teams connector API, and returns the result with thread_id/message_id
    async def update_thread(
        self, thread_id: str, content: str, member_name: str | None = None
    ) -> TeamsMessage:
        """Add a message to an existing thread, mentioning a user optionally.
    
        Args:
            thread_id: Thread ID to update
            content: Message content to add
            member_name: Member name to mention (optional)
    
        Returns:
            Updated thread details
        """
        try:
            await self._initialize()
    
            result = TeamsMessage(thread_id=thread_id, content=content, message_id="")
    
            async def update_thread_callback(context: TurnContext):
                mention_member = await self._get_mention_member(context, member_name)
    
                mentions = []
                if mention_member is not None:
                    result.content = f"<at>{mention_member.name}</at> {content}"
                    mention = Mention(
                        text=f"<at>{mention_member.name}</at>",
                        mentioned=ChannelAccount(
                            id=mention_member.id, name=mention_member.name
                        ),
                    )
                    mentions.append(mention)
    
                reply = Activity(
                    type=ActivityTypes.message,
                    text=result.content,
                    from_property=ChannelAccount(id=self.teams_app_id, name=MCP_BOT_NAME),  # type: ignore
                    conversation=ConversationAccount(id=thread_id),
                    entities=mentions,
                )
                #
                # Hack to get the connector client and reply to an existing activity
                #
                conversations = TeamsClient._get_conversation_operations(context)
                #
                # Hack to reply to conversation https://github.com/microsoft/botframework-sdk/issues/6626
                #
                conversation_id = (
                    f"{context.activity.conversation.id};messageid={thread_id}"  # pyright: ignore
                )
                response = await conversations.send_to_conversation(
                    conversation_id=conversation_id, body=reply
                )
    
                if response is not None:
                    result.message_id = response.id  # pyright: ignore
    
            await self.adapter.continue_conversation(
                agent_app_id=self.teams_app_id,
                continuation_activity=self._create_continuation_activity(),
                callback=update_thread_callback,
            )
    
            return result
        except Exception as e:
            LOGGER.error(f"Error updating thread: {str(e)}")
            raise
  • Helper used by update_thread to get the ConversationsOperations from the TurnContext for sending messages
    @staticmethod
    def _get_conversation_operations(context: TurnContext) -> ConversationsOperations:
        # Hack to get the connector client and reply to an existing activity
        connector_client = context.turn_state["ConnectorClient"]
        return connector_client.conversations  # type: ignore
Behavior2/5

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

No annotations provided. Description does not disclose behavioral details such as whether existing content is replaced or appended, effects of updating member_name, permissions required, or whether the operation is reversible. The existence of an output schema is not leveraged in the description.

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 a single, concise sentence without unnecessary words. However, it is so brief that it sacrifices informative value; but for conciseness alone, it is effective.

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 the tool's simplicity (3 params, update operation), the description lacks essential context about update semantics, potential side effects, and return values. The presence of an output schema is not utilized. The description is insufficient for an agent to understand all aspects of invocation.

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% with detailed descriptions for thread_id, content, and member_name. The description adds 'new content' but does not provide additional meaning beyond the schema. Baseline 3 is appropriate.

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?

Description clearly states it updates an existing thread with new content, which is distinct from sibling tools like start_thread, read_thread, and list_threads. However, it does not mention that it can also update the member_name field.

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?

No guidance on when to use this tool versus alternatives. For example, it does not specify when to update an existing thread versus starting a new thread, or what prerequisites are needed (e.g., thread must exist).

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/InditexTech/mcp-teams-server'

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