Skip to main content
Glama
piekstra

Slack MCP Server

by piekstra

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
NameRequiredDescriptionDefault
channelYes
tsYes
textYes
blocksNo

Implementation Reference

  • 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)
  • 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)
  • The @mcp.tool() decorator registers the update_message function as an MCP tool with FastMCP instance.
    @mcp.tool()

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/piekstra/slack-mcp-server'

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