Skip to main content
Glama
piekstra

Slack MCP Server

by piekstra

send_formatted_message

Send structured Slack messages with Block Kit formatting, including headers, text, fields, and context, to specified channels or threads.

Instructions

Send a formatted message using Block Kit with common elements.

Args: channel: Channel ID or name title: Header text (optional) text: Main message text (optional) fields: Comma-separated fields for side-by-side display (optional) context: Context text at bottom (optional) thread_ts: Thread timestamp for replies (optional)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channelYes
titleNo
textNo
fieldsNo
contextNo
thread_tsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the 'send_formatted_message' MCP tool, decorated with @mcp.tool() for automatic registration. It constructs Slack Block Kit blocks based on input parameters and sends the message via SlackClient, returning JSON result or error.
    @mcp.tool()
    async def send_formatted_message(
        channel: str,
        title: Optional[str] = None,
        text: Optional[str] = None,
        fields: Optional[str] = None,
        context: Optional[str] = None,
        thread_ts: Optional[str] = None
    ) -> str:
        """
        Send a formatted message using Block Kit with common elements.
    
        Args:
            channel: Channel ID or name
            title: Header text (optional)
            text: Main message text (optional)
            fields: Comma-separated fields for side-by-side display (optional)
            context: Context text at bottom (optional)
            thread_ts: Thread timestamp for replies (optional)
        """
        try:
            blocks = []
            
            if title:
                blocks.append(BlockKitBuilder.header(title))
            
            if text:
                blocks.append(BlockKitBuilder.section(text))
            
            if fields:
                field_list = [field.strip() for field in fields.split(",")]
                blocks.append(BlockKitBuilder.fields_section(field_list))
            
            if context:
                blocks.append(BlockKitBuilder.context([context]))
            
            if not blocks:
                return json.dumps({"error": "At least one of title, text, fields, or context must be provided"}, indent=2)
            
            fallback_text = title or text or "Formatted 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)
  • The @mcp.tool() decorator registers the send_formatted_message function as an MCP tool.
    @mcp.tool()
  • Input schema defined by function type hints and default values, used by MCP for tool parameter schema.
    channel: str,
    title: Optional[str] = None,
    text: Optional[str] = None,
    fields: Optional[str] = None,
    context: Optional[str] = None,
    thread_ts: Optional[str] = None
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. While 'Send a formatted message' implies a write operation, it doesn't disclose important behavioral traits: whether this requires specific permissions, rate limits, what happens on failure, or what the response contains. The mention of 'Block Kit' provides some technical context but doesn't explain practical implications.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and well-structured: a clear purpose statement followed by a parameter list. Every sentence serves a purpose. It could be slightly more front-loaded with usage context, but overall it's efficient without wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 6 parameters with 0% schema coverage and no annotations, but with an output schema present, the description provides basic parameter semantics but lacks behavioral context. For a message-sending tool with many alternatives, it should explain more about when to use it, what makes it unique, and practical considerations. The output schema reduces the need to describe return values.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. The Args section lists all 6 parameters with brief explanations, adding meaning beyond the bare schema. However, explanations are minimal (e.g., 'Channel ID or name' for channel, 'Header text' for title) and don't provide format details, constraints, or examples. The description covers all parameters but with limited depth.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Send a formatted message using Block Kit with common elements.' This specifies the action (send), resource (formatted message), and technology (Block Kit). However, it doesn't explicitly differentiate from sibling tools like send_message, send_interactive_message, or send_list_message, which all appear to send different types of messages.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With multiple sibling tools for sending messages (send_message, send_announcement, send_interactive_message, send_list_message, send_notification_message, send_code_snippet, send_form_message), there's no indication of what makes this tool distinct or when it's the appropriate choice.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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