Skip to main content
Glama
piekstra

Slack MCP Server

by piekstra

send_notification_message

Send structured Slack notifications with status indicators to communicate updates, alerts, or information clearly within channels or threads.

Instructions

Send a structured notification message with status indicator.

Args: channel: Channel ID or name status: Status type (success, warning, error, info) title: Notification title description: Main description details: Additional details (optional) thread_ts: Thread timestamp for replies (optional)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channelYes
statusYes
titleYes
descriptionYes
detailsNo
thread_tsNo

Implementation Reference

  • The handler function for the 'send_notification_message' tool. It constructs a Block Kit message with a status emoji and color-coded notification, sends it to the specified Slack channel using SlackClient.send_message, and returns the API response as JSON.
    @mcp.tool()
    async def send_notification_message(
        channel: str,
        status: str,
        title: str,
        description: str,
        details: Optional[str] = None,
        thread_ts: Optional[str] = None
    ) -> str:
        """
        Send a structured notification message with status indicator.
    
        Args:
            channel: Channel ID or name
            status: Status type (success, warning, error, info)
            title: Notification title
            description: Main description
            details: Additional details (optional)
            thread_ts: Thread timestamp for replies (optional)
        """
        try:
            # Status emojis and colors
            status_config = {
                "success": {"emoji": "✅", "color": "#28a745"},
                "warning": {"emoji": "⚠️", "color": "#ffc107"},
                "error": {"emoji": "❌", "color": "#dc3545"},
                "info": {"emoji": "ℹ️", "color": "#17a2b8"}
            }
            
            config = status_config.get(status.lower(), status_config["info"])
            
            blocks = [
                {
                    "type": "section",
                    "text": {
                        "type": "mrkdwn",
                        "text": f"{config['emoji']} *{title}*\n{description}"
                    }
                }
            ]
            
            if details:
                blocks.append(BlockKitBuilder.divider())
                blocks.append(BlockKitBuilder.context([details]))
            
            fallback_text = f"{config['emoji']} {title}: {description}"
            
            client = SlackClient()
            result = await client.send_message(channel, fallback_text, thread_ts, blocks)
            return json.dumps(result, indent=2)
        except Exception as e:
            return json.dumps({"error": str(e)}, indent=2)
  • The @mcp.tool() decorator registers the send_notification_message function as an MCP tool.
    @mcp.tool()
  • Input schema defined by function parameters and detailed in the docstring.
    """
    Send a structured notification message with status indicator.
    
    Args:
        channel: Channel ID or name
        status: Status type (success, warning, error, info)
        title: Notification title
        description: Main description
        details: Additional details (optional)
        thread_ts: Thread timestamp for replies (optional)
    """
  • SlackClient.send_message method used by the tool to post the notification to Slack API.
    async def send_message(
        self, channel: str, text: str, thread_ts: Optional[str] = None, blocks: Optional[List[Dict[str, Any]]] = None
    ) -> Dict[str, Any]:
        """Send a message to a channel."""
        data = {"channel": channel, "text": text}
    
        if thread_ts:
            data["thread_ts"] = thread_ts
    
        if blocks:
            data["blocks"] = blocks
    
        return await self._make_request("POST", "chat.postMessage", json_data=data)

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