list_channels
List all active or specific types of channels in a Slack workspace. Filter by channel type, exclude archived channels, and set a limit on the number of results returned.
Instructions
List all channels in the Slack workspace.
Args: types: Comma-separated channel types (public_channel, private_channel, mpim, im) exclude_archived: Whether to exclude archived channels limit: Maximum number of channels to return (1-1000)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| exclude_archived | No | ||
| limit | No | ||
| types | No |
Implementation Reference
- slack_mcp/server.py:222-239 (handler)The MCP tool handler for 'list_channels', registered via @mcp.tool() decorator. Handles input parameters, invokes SlackClient helper, and formats response as JSON.@mcp.tool() async def list_channels(types: Optional[str] = None, exclude_archived: bool = True, limit: int = 100) -> str: """ List all channels in the Slack workspace. Args: types: Comma-separated channel types (public_channel, private_channel, mpim, im) exclude_archived: Whether to exclude archived channels limit: Maximum number of channels to return (1-1000) """ try: client = SlackClient() types_list = types.split(",") if types else None result = await client.list_channels(types_list, exclude_archived, limit) return json.dumps(result, indent=2) except Exception as e: return json.dumps({"error": str(e)}, indent=2)
- slack_mcp/server.py:76-85 (helper)SlackClient helper method that constructs parameters and calls Slack conversations.list API via _make_request.async def list_channels( self, types: Optional[List[str]] = None, exclude_archived: bool = True, limit: int = 100 ) -> Dict[str, Any]: """List all channels in the workspace.""" params = {"exclude_archived": exclude_archived, "limit": limit} if types: params["types"] = ",".join(types) return await self._make_request("GET", "conversations.list", params=params)