Skip to main content
Glama
piekstra

Slack MCP Server

by piekstra

send_message

Send messages to Slack channels with text, rich formatting using Block Kit, and threaded replies for organized team communication.

Instructions

Send a message to a Slack channel.

Args: channel: Channel ID or name text: Message text (fallback text for notifications) thread_ts: Thread timestamp for replies blocks: JSON string of Block Kit blocks for rich formatting

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channelYes
textYes
thread_tsNo
blocksNo

Implementation Reference

  • The main handler function for the 'send_message' MCP tool. It creates a SlackClient instance, parses optional blocks JSON parameter, calls the underlying SlackClient.send_message method, and returns the API response as formatted JSON or an error message.
    @mcp.tool() async def send_message(channel: str, text: str, thread_ts: Optional[str] = None, blocks: Optional[str] = None) -> str: """ Send a message to a Slack channel. Args: channel: Channel ID or name text: Message text (fallback text for notifications) thread_ts: Thread timestamp for replies 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.send_message(channel, text, thread_ts, blocks_data) return json.dumps(result, indent=2) except Exception as e: return json.dumps({"error": str(e)}, indent=2)
  • The underlying helper method in SlackClient class that constructs the request payload and calls the Slack chat.postMessage API endpoint via _make_request to send the message.
    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