Skip to main content
Glama
piekstra

Slack MCP Server

by piekstra

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
NameRequiredDescriptionDefault
typesNo
exclude_archivedNo
limitNo

Implementation Reference

  • 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)
  • 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)
  • The @mcp.tool() decorator registers the list_channels function as an MCP tool.
    @mcp.tool()

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