Skip to main content
Glama
piekstra

Slack MCP Server

by piekstra

send_announcement

Send formatted announcements to Slack channels with titles, messages, and optional author attribution for team communication.

Instructions

Send a formatted announcement message.

Args: channel: Channel ID or name title: Announcement title message: Main announcement message author: Author name (optional) timestamp: Custom timestamp (optional) thread_ts: Thread timestamp for replies (optional)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channelYes
titleYes
messageYes
authorNo
timestampNo
thread_tsNo

Implementation Reference

  • The send_announcement tool handler, registered via @mcp.tool() decorator. Constructs Block Kit blocks for a formatted announcement including title, message, author, and timestamp, then sends via SlackClient.send_message.
    @mcp.tool()
    async def send_announcement(
        channel: str,
        title: str,
        message: str,
        author: Optional[str] = None,
        timestamp: Optional[str] = None,
        thread_ts: Optional[str] = None
    ) -> str:
        """
        Send a formatted announcement message.
    
        Args:
            channel: Channel ID or name
            title: Announcement title
            message: Main announcement message
            author: Author name (optional)
            timestamp: Custom timestamp (optional)
            thread_ts: Thread timestamp for replies (optional)
        """
        try:
            blocks = [
                BlockKitBuilder.header(f"📢 {title}"),
                BlockKitBuilder.section(message)
            ]
            
            # Add context with author and timestamp
            context_elements = []
            if author:
                context_elements.append(f"*By:* {author}")
            if timestamp:
                context_elements.append(f"*Date:* {timestamp}")
            else:
                context_elements.append(f"*Date:* {datetime.now().strftime('%Y-%m-%d %H:%M')}")
            
            if context_elements:
                blocks.append(BlockKitBuilder.context(context_elements))
            
            fallback_text = f"📢 {title}: {message}"
            
            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)

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