Skip to main content
Glama
Strand-AI

Slack Notifier MCP

by Strand-AI

ask_user

Send a question to a Slack channel and wait for the user's reply. Use when you need user input or a decision. Supports background execution to avoid blocking. Returns the reply text.

Instructions

Send a question to the user via Slack and wait for their reply.

Use this when you need user input or a decision. The user will be notified and can reply in the Slack thread. This will BLOCK until the user replies or the timeout is reached.

IMPORTANT - NON-BLOCKING USAGE: To avoid blocking, run this tool in a background agent/task. Example with Claude Code's Task tool:

Task(
    prompt="Call ask_user with question='Your question here'",
    run_in_background=True
)

This lets you continue working while waiting for the Slack reply. You'll be notified when the background task completes with the user's response.

Args: question: The question to ask the user. channel: Channel name or ID. Uses SLACK_DEFAULT_CHANNEL if not specified. context: Optional context to include (e.g., what you're working on). timeout_minutes: How long to wait for a reply (default 5 minutes, max 30).

Returns: Dict with success status and user's reply text if received.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
questionYes
channelNo
contextNo
timeout_minutesNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Primary handler for the 'ask_user' tool. Registered with FastMCP as an async task-enabled tool. Sends a question to Slack, polls for a reply with progress updates, and returns the user's response or timeout.
    @mcp.tool(task=True)
    async def ask_user(
        question: str,
        channel: str | None = None,
        context: str | None = None,
        timeout_minutes: int = 5,
        progress: Progress = Progress(),
    ) -> dict:
        """Send a question to the user via Slack and wait for their reply.
    
        Use this when you need user input or a decision. The user will be notified
        and can reply in the Slack thread. This will BLOCK until the user replies
        or the timeout is reached.
    
        IMPORTANT - NON-BLOCKING USAGE: To avoid blocking, run this tool in a
        background agent/task. Example with Claude Code's Task tool:
    
            Task(
                prompt="Call ask_user with question='Your question here'",
                run_in_background=True
            )
    
        This lets you continue working while waiting for the Slack reply. You'll
        be notified when the background task completes with the user's response.
    
        Args:
            question: The question to ask the user.
            channel: Channel name or ID. Uses SLACK_DEFAULT_CHANNEL if not specified.
            context: Optional context to include (e.g., what you're working on).
            timeout_minutes: How long to wait for a reply (default 5 minutes, max 30).
    
        Returns:
            Dict with success status and user's reply text if received.
        """
        client = _get_client()
    
        # Cap timeout at 30 minutes
        timeout_minutes = min(timeout_minutes, 30)
        timeout_seconds = timeout_minutes * 60
    
        # Format the question message
        if context:
            formatted_message = (
                f":question: *Claude Code needs your input*\n\n"
                f"*Context:* {context}\n\n"
                f"*Question:* {question}\n\n"
                f"_Reply in this thread within {timeout_minutes} minutes._"
            )
        else:
            formatted_message = (
                f":question: *Claude Code needs your input*\n\n"
                f"{question}\n\n"
                f"_Reply in this thread within {timeout_minutes} minutes._"
            )
    
        # Report progress: sending question
        await progress.set_message("Sending question to Slack...")
    
        # Send the question
        send_result = client.send_message(text=formatted_message, channel=channel)
    
        if not send_result.ok:
            return {
                "success": False,
                "message": f"Failed to send question: {send_result.error}",
                "error": send_result.error,
                "reply": None,
            }
    
        # Report progress: waiting for reply
        await progress.set_message(f"Waiting for reply (up to {timeout_minutes} min)...")
        await progress.set_total(timeout_seconds)
    
        # Poll for reply with progress updates
        poll_interval = 5  # seconds
        elapsed = 0
    
        while elapsed < timeout_seconds:
            # Check for replies
            replies = client.get_thread_replies(
                channel=send_result.channel,
                thread_ts=send_result.ts,
                since_ts=None,
            )
    
            if replies:
                reply = replies[0]  # Get the first reply
                # Send acknowledgment
                client.send_message(
                    text=":white_check_mark: Got it, thanks!",
                    channel=send_result.channel,
                    thread_ts=send_result.ts,
                )
    
                return {
                    "success": True,
                    "message": "Received user reply",
                    "reply": reply.text,
                    "replied_by": reply.user_name or reply.user,
                    "user_id": reply.user,
                    "ts": reply.ts,
                    "channel": send_result.channel,
                    "thread_ts": send_result.ts,
                }
    
            # Update progress
            await progress.set_current(elapsed)
            await asyncio.sleep(poll_interval)
            elapsed += poll_interval
    
        # Timeout reached
        client.send_message(
            text=f":hourglass: No reply received after {timeout_minutes} minutes. Continuing without input.",
            channel=send_result.channel,
            thread_ts=send_result.ts,
        )
    
        return {
            "success": False,
            "message": f"No reply received within {timeout_minutes} minutes",
            "reply": None,
            "channel": send_result.channel,
            "thread_ts": send_result.ts,
        }
  • Tool registered via the @mcp.tool(task=True) decorator on line 43 of slack_mcp/server.py. The decorator registers 'ask_user' with FastMCP as a task-capable tool.
    @mcp.tool(task=True)
    async def ask_user(
        question: str,
        channel: str | None = None,
        context: str | None = None,
        timeout_minutes: int = 5,
        progress: Progress = Progress(),
    ) -> dict:
  • Input parameters for ask_user: question (str, required), channel (str|None), context (str|None), timeout_minutes (int, default 5). Return type is dict via type hints.
    async def ask_user(
        question: str,
        channel: str | None = None,
        context: str | None = None,
        timeout_minutes: int = 5,
        progress: Progress = Progress(),
    ) -> dict:
        """Send a question to the user via Slack and wait for their reply.
    
        Use this when you need user input or a decision. The user will be notified
        and can reply in the Slack thread. This will BLOCK until the user replies
        or the timeout is reached.
    
        IMPORTANT - NON-BLOCKING USAGE: To avoid blocking, run this tool in a
        background agent/task. Example with Claude Code's Task tool:
    
            Task(
                prompt="Call ask_user with question='Your question here'",
                run_in_background=True
            )
    
        This lets you continue working while waiting for the Slack reply. You'll
        be notified when the background task completes with the user's response.
    
        Args:
            question: The question to ask the user.
            channel: Channel name or ID. Uses SLACK_DEFAULT_CHANNEL if not specified.
            context: Optional context to include (e.g., what you're working on).
            timeout_minutes: How long to wait for a reply (default 5 minutes, max 30).
    
        Returns:
            Dict with success status and user's reply text if received.
        """
  • SlackClient.wait_for_reply - blocking helper used by the synchronous ask_user in slack_mcp/tools/messaging.py (a simpler duplicate of the main handler).
    def wait_for_reply(
        self,
        channel: str,
        thread_ts: str,
        timeout_seconds: int = 300,
        poll_interval: int = 5,
    ) -> Message | None:
        """Wait for a reply in a thread.
    
        Args:
            channel: Channel ID containing the thread.
            thread_ts: Timestamp of the parent message.
            timeout_seconds: Maximum time to wait (default 5 minutes).
            poll_interval: Seconds between poll attempts (default 5).
    
        Returns:
            First new message in the thread, or None if timeout.
        """
        start_time = time.time()
        last_ts = thread_ts
    
        while time.time() - start_time < timeout_seconds:
            replies = self.get_thread_replies(channel, thread_ts, since_ts=last_ts)
    
            if replies:
                return replies[0]
    
            time.sleep(poll_interval)
    
        return None
  • Synchronous duplicate implementation of ask_user (not registered as a tool). Used as a simpler blocking variant, but the primary MCP tool handler is in server.py.
    def ask_user(
        question: str,
        channel: str | None = None,
        context: str | None = None,
        timeout_minutes: int = 5,
    ) -> dict:
        """Send a question to the user via Slack and wait for their reply.
    
        Use this when you need user input or a decision. The user will be notified
        and can reply in the Slack thread.
    
        Args:
            question: The question to ask the user.
            channel: Channel name or ID. Uses SLACK_DEFAULT_CHANNEL if not specified.
            context: Optional context to include (e.g., what you're working on).
            timeout_minutes: How long to wait for a reply (default 5 minutes, max 30).
    
        Returns:
            Dict with success status and user's reply text if received.
        """
        client = _get_client()
    
        # Cap timeout at 30 minutes
        timeout_minutes = min(timeout_minutes, 30)
        timeout_seconds = timeout_minutes * 60
    
        # Format the question message
        if context:
            formatted_message = (
                f":question: *Claude Code needs your input*\n\n"
                f"*Context:* {context}\n\n"
                f"*Question:* {question}\n\n"
                f"_Reply in this thread within {timeout_minutes} minutes._"
            )
        else:
            formatted_message = (
                f":question: *Claude Code needs your input*\n\n"
                f"{question}\n\n"
                f"_Reply in this thread within {timeout_minutes} minutes._"
            )
    
        # Send the question
        send_result = client.send_message(text=formatted_message, channel=channel)
    
        if not send_result.ok:
            return {
                "success": False,
                "message": f"Failed to send question: {send_result.error}",
                "error": send_result.error,
                "reply": None,
            }
    
        # Wait for reply
        reply = client.wait_for_reply(
            channel=send_result.channel,
            thread_ts=send_result.ts,
            timeout_seconds=timeout_seconds,
        )
    
        if reply:
            # Send acknowledgment
            client.send_message(
                text=":white_check_mark: Got it, thanks!",
                channel=send_result.channel,
                thread_ts=send_result.ts,
            )
    
            return {
                "success": True,
                "message": "Received user reply",
                "reply": reply.text,
                "replied_by": reply.user_name or reply.user,
                "user_id": reply.user,
                "ts": reply.ts,
                "channel": send_result.channel,
                "thread_ts": send_result.ts,
            }
        else:
            # Send timeout message
            client.send_message(
                text=f":hourglass: No reply received after {timeout_minutes} minutes. Continuing without input.",
                channel=send_result.channel,
                thread_ts=send_result.ts,
            )
    
            return {
                "success": False,
                "message": f"No reply received within {timeout_minutes} minutes",
                "reply": None,
                "channel": send_result.channel,
                "thread_ts": send_result.ts,
            }
Behavior5/5

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

No annotations exist, so the description carries full burden. It clearly states that the tool blocks until reply or timeout, explains the return dict, and gives a non-blocking alternative. All behavioral traits are disclosed.

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 well-structured with sections and front-loaded purpose. The code example adds value but lengthens it slightly. Overall efficient for the complexity.

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

Completeness5/5

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

Given 4 parameters, blocking behavior, and an output schema (mentioned but not detailed), the description covers all essential aspects: usage, blocking, timeout, non-blocking alternative, default channel, and return value.

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

Parameters5/5

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

Schema description coverage is 0%, but the description adds detailed meaning for all parameters: question, channel (default SLACK_DEFAULT_CHANNEL), context, and timeout_minutes (default 5, max 30). This fully compensates for the schema's lack of descriptions.

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

Purpose5/5

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

The description clearly states the action ('Send a question to the user via Slack') and the resource ('user via Slack'), and it distinguishes itself from siblings like 'send' and 'get_thread_replies' by highlighting the blocking wait for reply.

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

Usage Guidelines4/5

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

The description explicitly says 'Use this when you need user input or a decision' and provides a non-blocking usage pattern. It doesn't explicitly list when not to use, but the blocking behavior is clearly stated, giving enough guidance.

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/Strand-AI/slack-notifier-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server