Skip to main content
Glama
ubie-oss

Slack MCP Server

by ubie-oss

slack_list_channels

Retrieve public Slack channels from your workspace with pagination controls to manage large lists efficiently.

Instructions

List public channels in the workspace with pagination

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cursorNoPagination cursor for next page of results
limitNoMaximum number of channels to return (default 100)

Implementation Reference

  • Handler that executes the slack_list_channels tool by parsing arguments, calling Slack's conversations.list API for public channels with pagination support, validating response, and returning JSON-formatted channels list.
    case 'slack_list_channels': { const args = ListChannelsRequestSchema.parse( request.params.arguments ); const response = await slackClient.conversations.list({ limit: args.limit, cursor: args.cursor, types: 'public_channel', // Only public channels }); if (!response.ok) { throw new Error(`Failed to list channels: ${response.error}`); } const parsed = ListChannelsResponseSchema.parse(response); return { content: [{ type: 'text', text: JSON.stringify(parsed) }], }; }
  • Zod schema defining the input parameters for slack_list_channels: optional cursor for pagination and limit (default 100, max 1000).
    export const ListChannelsRequestSchema = z.object({ cursor: z .string() .optional() .describe('Pagination cursor for next page of results'), limit: z .number() .int() .min(1) .max(1000) // Align with Slack API's default limit (conversations.list is actually cursor-based) .optional() .default(100) .describe('Maximum number of channels to return (default 100)'), });
  • src/index.ts:116-120 (registration)
    Registration of the slack_list_channels tool in the MCP server's listTools response, including name, description, and input schema reference.
    { name: 'slack_list_channels', description: 'List public channels in the workspace with pagination', inputSchema: zodToJsonSchema(ListChannelsRequestSchema), },
  • Zod schema for validating the response from Slack's conversations.list API, extending base response with array of ChannelSchema objects.
    export const ListChannelsResponseSchema = BaseResponseSchema.extend({ channels: z.array(ChannelSchema).optional(), });
  • Base ChannelSchema used in ListChannelsResponseSchema for typing individual channel objects returned by the tool.
    export const ChannelSchema = z .object({ conversation_host_id: z.string().optional(), created: z.number().optional(), id: z.string().optional(), is_archived: z.boolean().optional(), name: z.string().optional(), name_normalized: z.string().optional(), num_members: z.number().optional(), purpose: z .object({ creator: z.string().optional(), last_set: z.number().optional(), value: z.string().optional(), }) .optional(), shared_team_ids: z.array(z.string()).optional(), topic: z .object({ creator: z.string().optional(), last_set: z.number().optional(), value: z.string().optional(), }) .optional(), updated: z.number().optional(), }) .strip();

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/ubie-oss/slack-mcp-server'

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