Skip to main content
Glama

Slack MCP Server

by lbeatu
list-channels.usecase.ts•1.56 kB
import { ISlackService } from "../../core/interfaces/slack.interface.js"; import { ListChannelsRequest } from "../../core/types/slack.types.js"; export class ListChannelsUseCase { constructor(private readonly slackService: ISlackService) {} async execute(request: ListChannelsRequest) { const result = await this.slackService.listChannels(request); if (!result.success) { return { content: [ { type: "text" as const, text: `āŒ Failed to list channels: ${result.error}`, }, ], }; } const { channels, next_cursor } = result.data!; if (channels.length === 0) { return { content: [ { type: "text" as const, text: "šŸ“­ No channels found.", }, ], }; } const channelList = channels .map((channel, index) => { const memberCount = channel.num_members ? ` (${channel.num_members} members)` : ""; const isPrivate = channel.is_private ? " šŸ”’" : ""; return `${index + 1}. **#${ channel.name }**${isPrivate}${memberCount}\n ID: \`${channel.id}\``; }) .join("\n\n"); const paginationInfo = next_cursor ? `\n\nšŸ“„ **Pagination**: Use cursor \`${next_cursor}\` for next page` : ""; return { content: [ { type: "text" as const, text: `šŸ“‹ **Slack Channels** (${channels.length} found)\n\n${channelList}${paginationInfo}`, }, ], }; } }

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/lbeatu/slack-mcp'

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