update_message
Modify existing Slack messages by updating text content and rich formatting blocks in specified channels.
Instructions
Update an existing Slack message.
Args: channel: Channel ID where the message exists ts: Timestamp of the message to update text: New message text (fallback text for notifications) blocks: JSON string of Block Kit blocks for rich formatting
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channel | Yes | ||
| ts | Yes | ||
| text | Yes | ||
| blocks | No |
Implementation Reference
- slack_mcp/server.py:310-327 (handler)MCP tool handler implementation for 'update_message'. Creates a SlackClient instance, parses optional blocks JSON, calls the client's update_message method, and returns the JSON-formatted result or error.@mcp.tool() async def update_message(channel: str, ts: str, text: str, blocks: Optional[str] = None) -> str: """ Update an existing Slack message. Args: channel: Channel ID where the message exists ts: Timestamp of the message to update text: New message text (fallback text for notifications) blocks: JSON string of Block Kit blocks for rich formatting """ try: client = SlackClient() blocks_data = json.loads(blocks) if blocks else None result = await client.update_message(channel, ts, text, blocks_data) return json.dumps(result, indent=2) except Exception as e: return json.dumps({"error": str(e)}, indent=2)
- slack_mcp/server.py:116-125 (helper)SlackClient helper method that constructs the request payload and calls Slack API endpoint 'chat.update' via _make_request to update the message.async def update_message( self, channel: str, ts: str, text: str, blocks: Optional[List[Dict[str, Any]]] = None ) -> Dict[str, Any]: """Update an existing message.""" data = {"channel": channel, "ts": ts, "text": text} if blocks: data["blocks"] = blocks return await self._make_request("POST", "chat.update", json_data=data)
- slack_mcp/server.py:310-310 (registration)The @mcp.tool() decorator registers the update_message function as an MCP tool with FastMCP instance.@mcp.tool()