Skip to main content
Glama
piekstra

Slack MCP Server

by piekstra

send_message

Send messages to Slack channels, including replies in threads and rich formatting with Block Kit. Use channel ID or name, message text, and optional JSON blocks for structured content.

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
blocksNo
channelYes
textYes
thread_tsNo

Implementation Reference

  • The primary MCP tool handler for 'send_message'. It accepts channel, text, optional thread_ts and blocks (JSON string), instantiates SlackClient, parses blocks, calls the client's send_message method, and returns the JSON-formatted result or error.
    @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 SlackClient helper method that constructs the request payload and calls the Slack chat.postMessage API endpoint to send the actual 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