Skip to main content
Glama
piekstra

Slack MCP Server

by piekstra

send_form_message

Send interactive form messages with select menus in Slack channels to collect user responses and streamline feedback gathering.

Instructions

Send a form-like message with a select menu.

Args: channel: Channel ID or name title: Form title description: Form description select_options: JSON string of select options [{"text": "Option 1", "value": "opt1"}] select_placeholder: Placeholder text for select menu select_action_id: Action ID for the select menu thread_ts: Thread timestamp for replies (optional)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channelYes
titleYes
descriptionYes
select_optionsYes
select_placeholderNoChoose an option
select_action_idNoform_select
thread_tsNo

Implementation Reference

  • The send_form_message tool handler function. It is registered via the @mcp.tool() decorator and implements sending a Slack message with a Block Kit form containing a select menu.
    @mcp.tool()
    async def send_form_message(
        channel: str,
        title: str,
        description: str,
        select_options: str,
        select_placeholder: str = "Choose an option",
        select_action_id: str = "form_select",
        thread_ts: Optional[str] = None
    ) -> str:
        """
        Send a form-like message with a select menu.
    
        Args:
            channel: Channel ID or name
            title: Form title
            description: Form description
            select_options: JSON string of select options [{"text": "Option 1", "value": "opt1"}]
            select_placeholder: Placeholder text for select menu
            select_action_id: Action ID for the select menu
            thread_ts: Thread timestamp for replies (optional)
        """
        try:
            blocks = [
                BlockKitBuilder.header(title),
                BlockKitBuilder.section(description)
            ]
            
            # Parse select options
            options = json.loads(select_options)
            
            select_menu = BlockKitBuilder.select_menu(
                placeholder=select_placeholder,
                action_id=select_action_id,
                options=options
            )
            
            blocks.append(BlockKitBuilder.section_with_accessory(
                "Please make your selection:",
                select_menu
            ))
            
            fallback_text = f"{title}: {description}"
            
            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)
  • BlockKitBuilder.select_menu method, a key helper used to create the interactive select menu element in the form message.
    def select_menu(placeholder: str, action_id: str, options: List[Dict[str, str]]) -> Dict[str, Any]:
        """Create a static select menu element."""
        return {
            "type": "static_select",
            "placeholder": {
                "type": "plain_text",
                "text": placeholder
            },
            "action_id": action_id,
            "options": [
                {
                    "text": {
                        "type": "plain_text",
                        "text": option["text"]
                    },
                    "value": option["value"]
                }
                for option in options
            ]
        }
    
    @staticmethod
    def section_with_accessory(text: str, accessory: Dict[str, Any], text_type: str = "mrkdwn") -> Dict[str, Any]:
  • BlockKitBuilder.section_with_accessory method, used to attach the select menu as an accessory to the section block.
    def section_with_accessory(text: str, accessory: Dict[str, Any], text_type: str = "mrkdwn") -> Dict[str, Any]:
        """Create a section block with an accessory element."""
        return {
            "type": "section",
            "text": {
                "type": text_type,
                "text": text
            },
            "accessory": accessory
        }

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