send
Send formatted Slack messages to channels or threads. Use urgency to add @here mentions for critical alerts, reply in threads, and @mention specific users. Supports Slack mrkdwn formatting.
Instructions
Send a message to a Slack channel or thread.
Args: message: Message text. Supports Slack mrkdwn formatting. channel: Channel name or ID. Uses SLACK_DEFAULT_CHANNEL if not specified. thread_ts: Thread timestamp to reply in a thread. urgency: Message urgency level. 'critical' adds @here mention. mention_user: If True, @mentions the configured user (requires SLACK_USER_ID).
Returns: Dict with success status and message details.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message | Yes | ||
| channel | No | ||
| thread_ts | No | ||
| urgency | No | normal | |
| mention_user | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- slack_mcp/tools/messaging.py:110-160 (handler)Core handler function for the 'send' tool. Formats the message based on urgency and mention_user flags, then calls client.send_message() and returns a dict with success status and message details.
def send( message: str, channel: str | None = None, thread_ts: str | None = None, urgency: Literal["normal", "important", "critical"] = "normal", mention_user: bool = False, ) -> dict: """Send a message to a Slack channel or thread. Args: message: Message text. Supports Slack mrkdwn formatting. channel: Channel name or ID. Uses SLACK_DEFAULT_CHANNEL if not specified. thread_ts: Thread timestamp to reply in a thread. urgency: Message urgency level. 'critical' adds @here mention. mention_user: If True, @mentions the configured user (requires SLACK_USER_ID). Returns: Dict with success status and message details. """ client = _get_client() # Add user mention if requested mention_prefix = "" if mention_user: mention = client.mention_user() if mention: mention_prefix = f"{mention} " # Format message based on urgency if urgency == "critical": formatted_message = f"{mention_prefix}<!here> :rotating_light: *CRITICAL*\n{message}" elif urgency == "important": formatted_message = f"{mention_prefix}:warning: *Important*\n{message}" else: formatted_message = f"{mention_prefix}{message}" result = client.send_message(text=formatted_message, channel=channel, thread_ts=thread_ts) if result.ok: return { "success": True, "message": "Message sent", "ts": result.ts, "channel": result.channel, } else: return { "success": False, "message": f"Failed to send message: {result.error}", "error": result.error, } - slack_mcp/server.py:169-197 (registration)Registration of the 'send' tool via @mcp.tool() decorator. This is the entry point that delegates to the handler in tools/messaging.py.
@mcp.tool() def send( message: str, channel: str | None = None, thread_ts: str | None = None, urgency: Literal["normal", "important", "critical"] = "normal", mention_user: bool = False, ) -> dict: """Send a message to a Slack channel or thread. Args: message: Message text. Supports Slack mrkdwn formatting. channel: Channel name or ID. Uses SLACK_DEFAULT_CHANNEL if not specified. thread_ts: Thread timestamp to reply in a thread. urgency: Message urgency level. 'critical' adds @here mention. mention_user: If True, @mentions the configured user (requires SLACK_USER_ID). Returns: Dict with success status and message details. """ from .tools.messaging import send as _send return _send( message=message, channel=channel, thread_ts=thread_ts, urgency=urgency, mention_user=mention_user, ) - slack_mcp/tools/messaging.py:110-116 (schema)Function signature/type schema for the 'send' tool: accepts message (str), channel (optional str), thread_ts (optional str), urgency (Literal normal/important/critical), and mention_user (bool).
def send( message: str, channel: str | None = None, thread_ts: str | None = None, urgency: Literal["normal", "important", "critical"] = "normal", mention_user: bool = False, ) -> dict: - slack_mcp/slack_client.py:50-57 (helper)SendResult dataclass used as the return type from client.send_message(). Contains ok, ts, channel, and error fields.
@dataclass class SendResult: """Result of sending a message.""" ok: bool ts: str | None = None channel: str | None = None error: str | None = None - slack_mcp/slack_client.py:85-123 (helper)SlackClient.send_message() - the low-level helper that calls the Slack API chat.postMessage to actually send the message.
def send_message( self, text: str, channel: str | None = None, thread_ts: str | None = None, ) -> SendResult: """Send a message to a Slack channel or thread. Args: text: Message text (supports Slack mrkdwn formatting) channel: Channel ID or name. Uses default if not specified. thread_ts: Thread timestamp to reply in a thread. Returns: SendResult with message timestamp if successful. """ target_channel = channel or self.config.default_channel if not target_channel: return SendResult( ok=False, error="No channel specified and no default channel configured. " "Set SLACK_DEFAULT_CHANNEL or pass channel parameter.", ) try: result = self.client.chat_postMessage( channel=target_channel, text=text, thread_ts=thread_ts, ) return SendResult( ok=True, ts=result["ts"], channel=result["channel"], ) except SlackApiError as e: return SendResult(ok=False, error=str(e.response["error"]))