delete_message
Remove a specific message from a Slack channel using the channel ID and message timestamp for precise deletion.
Instructions
Delete a message from a Slack channel.
Args: channel: Channel ID where the message exists ts: Timestamp of the message to delete
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channel | Yes | ||
| ts | Yes |
Implementation Reference
- slack_mcp/server.py:330-344 (handler)MCP tool handler function for 'delete_message'. This is the primary entry point decorated with @mcp.tool(), which registers and executes the tool logic by calling the SlackClient helper.@mcp.tool() async def delete_message(channel: str, ts: str) -> str: """ Delete a message from a Slack channel. Args: channel: Channel ID where the message exists ts: Timestamp of the message to delete """ try: client = SlackClient() result = await client.delete_message(channel, ts) return json.dumps(result, indent=2) except Exception as e: return json.dumps({"error": str(e)}, indent=2)
- slack_mcp/server.py:127-130 (helper)SlackClient helper method that implements the core logic by making the Slack API POST request to 'chat.delete' endpoint.async def delete_message(self, channel: str, ts: str) -> Dict[str, Any]: """Delete a message from a channel.""" data = {"channel": channel, "ts": ts} return await self._make_request("POST", "chat.delete", json_data=data)