Slack-Formatted Output Guide
Last updated
Was this helpful?
Last updated
Was this helpful?
This guide explains how to use the new Slack-formatted output feature in the Slack MCP Client.
The Slack MCP Client now supports rich message formatting using Slack's Block Kit and Markdown (mrkdwn) syntax. This allows for more visually appealing and interactive messages in Slack.
The client automatically detects the format of messages and applies the appropriate formatting:
Plain Text: Simple text messages
Markdown Text: Messages with Markdown formatting (bold, italic, code blocks, etc.)
JSON Block Kit: Messages in Block Kit JSON format
Structured Data: Messages with key-value pairs that are automatically converted to Block Kit format
You can use Slack's Markdown syntax in your messages. The formatter automatically converts standard Markdown syntax to Slack's mrkdwn format. For a comprehensive mapping between standard Markdown and Slack's supported syntax, see the .
Bold:
Standard Markdown: **bold text**
Slack Markdown: *bold text*
(automatically converted)
Italic:
Standard Markdown: *italic text*
or _italic text_
Slack Markdown: _italic text_
(automatically converted)
Strikethrough:
Standard Markdown: ~~struck text~~
Slack Markdown: ~struck text~
(automatically converted)
Code: `code`
(same in both)
Code Block:
Block Quote:
Lists:
Links:
Standard Markdown: [link text](https://example.com)
Slack Markdown: <https://example.com|link text>
(automatically converted)
The formatter automatically converts double-quoted strings to inline code blocks for better visualization. For example:
Will be displayed as:
This makes timestamps, IDs, and other quoted values stand out better in messages.
For more complex layouts, you can return a Block Kit JSON structure:
The client can automatically convert structured data (key-value pairs) to Block Kit format:
This will be displayed as a nicely formatted Block Kit message with fields.
The formatter package provides several utility functions for formatting messages:
The Slack-formatted output feature is implemented in the internal/slack/formatter
package, which provides:
Message Type Detection: Automatically detects the type of message (plain text, markdown, JSON Block Kit, structured data)
Formatting Functions: Utility functions for formatting text with Markdown
Block Kit Generation: Functions for creating Block Kit messages
Structured Data Conversion: Automatic conversion of structured data to Block Kit format
The postMessage
method in the Slack client has been updated to use these formatting functions.
This will be automatically converted to a Block Kit message with a header and fields.