list_channels
Retrieve available Slack channels by type, filter out archived ones, and set result limits for workspace navigation.
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 |
|---|---|---|---|
| types | No | ||
| exclude_archived | No | ||
| limit | No |
Implementation Reference
- slack_mcp/server.py:222-239 (handler)The main MCP tool handler for 'list_channels'. Decorated with @mcp.tool() for registration. Handles input parameters, instantiates SlackClient, calls its list_channels method, and returns JSON-formatted result or error.@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)Helper method in SlackClient class that constructs parameters and makes the Slack API request to 'conversations.list' endpoint.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)
- slack_mcp/server.py:222-222 (registration)The @mcp.tool() decorator registers the list_channels function as an MCP tool.@mcp.tool()