invite_to_channel
Add users to a Slack channel by providing their IDs and the target channel ID for team collaboration.
Instructions
Invite users to a Slack channel.
Args: channel: Channel ID users: Comma-separated list of user IDs
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channel | Yes | ||
| users | Yes |
Implementation Reference
- slack_mcp/server.py:506-522 (handler)MCP tool handler function that parses comma-separated users, creates SlackClient instance, calls the underlying invite_to_channel method, and returns JSON result or error.@mcp.tool() async def invite_to_channel(channel: str, users: str) -> str: """ Invite users to a Slack channel. Args: channel: Channel ID users: Comma-separated list of user IDs """ try: client = SlackClient() users_list = users.split(",") result = await client.invite_to_channel(channel, users_list) return json.dumps(result, indent=2) except Exception as e: return json.dumps({"error": str(e)}, indent=2)
- slack_mcp/server.py:206-210 (helper)Helper method in SlackClient class that makes the actual Slack API POST request to conversations.invite endpoint with channel and comma-joined user IDs.async def invite_to_channel(self, channel: str, users: List[str]) -> Dict[str, Any]: """Invite users to a channel.""" data = {"channel": channel, "users": ",".join(users)} return await self._make_request("POST", "conversations.invite", json_data=data)
- slack_mcp/server.py:506-506 (registration)Registration of the invite_to_channel tool using the @mcp.tool() decorator.@mcp.tool()