Skip to main content
Glama
z9905080

MCP Server for Slack

by z9905080

slack_list_channels

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

Instructions

List public channels in the workspace with pagination

Input Schema

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

Implementation Reference

  • Handler logic for the slack_list_channels tool within the CallToolRequest switch statement. Extracts arguments and invokes the SlackClient.getChannels method.
    case "slack_list_channels": {
      const args = request.params
        .arguments as unknown as ListChannelsArgs;
      const response = await slackClient.getChannels(
        args.limit,
        args.cursor,
      );
      return {
        content: [{ type: "text", text: JSON.stringify(response) }],
      };
    }
  • Tool schema definition for slack_list_channels, including name, description, and input schema.
    const listChannelsTool: Tool = {
      name: "slack_list_channels",
      description: "List public channels in the workspace with pagination",
      inputSchema: {
        type: "object",
        properties: {
          limit: {
            type: "number",
            description:
              "Maximum number of channels to return (default 100, max 200)",
            default: 100,
          },
          cursor: {
            type: "string",
            description: "Pagination cursor for next page of results",
          },
        },
      },
    };
  • index.ts:567-582 (registration)
    Registration of slack_list_channels tool in the ListToolsRequest handler by including listChannelsTool in the returned tools array.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      console.log("Received ListToolsRequest");
      return {
        tools: [
          listChannelsTool,
          postMessageTool,
          replyToThreadTool,
          addReactionTool,
          getChannelHistoryTool,
          getThreadRepliesTool,
          getUsersTool,
          getUserProfileTool,
          lookupUserByEmailTool,
        ],
      };
    });
  • SlackClient.getChannels method implementing the core logic to fetch public channels from Slack API using conversations.list endpoint.
    async getChannels(limit: number = 100, cursor?: string): Promise<any> {
      const params = new URLSearchParams({
        types: "public_channel",
        exclude_archived: "true",
        limit: Math.min(limit, 200).toString(),
        team_id: process.env.SLACK_TEAM_ID!,
      });
    
      if (cursor) {
        params.append("cursor", cursor);
      }
    
      const response = await fetch(
        `https://slack.com/api/conversations.list?${params}`,
        { headers: this.botHeaders },
      );
    
      return response.json();
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'pagination' and implies a read-only operation by using 'List', but doesn't specify authentication requirements, rate limits, or error conditions. It adds some value by clarifying the scope ('public channels') but lacks depth for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose ('List public channels in the workspace') and includes a key behavioral trait ('with pagination') without any wasted words. Every element serves a clear purpose, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is minimally adequate for a read-only list tool. It covers the resource scope and pagination but omits details like return format, error handling, and authentication needs. For a tool with 2 parameters and 100% schema coverage, it meets basic requirements but lacks completeness for robust agent use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the input schema fully documents both parameters ('limit' and 'cursor') with descriptions and defaults. The description adds no additional parameter semantics beyond what's in the schema, resulting in a baseline score of 3 as the schema handles the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('List') and resource ('public channels in the workspace'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'slack_get_channel_history' or 'slack_get_users', which also retrieve Slack data but serve different purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., authentication), exclusions (e.g., private channels), or compare it to siblings like 'slack_get_users' for user-related queries, leaving the agent to infer usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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

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