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();
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

B3.3/5.0
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 helpfully mentions pagination behavior, which is valuable context not in the schema. However, it doesn't disclose important traits like rate limits, authentication requirements, whether this requires specific permissions, or what the response format looks like (especially critical with no output schema).

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 perfectly concise - a single sentence that communicates the core functionality and key behavioral trait (pagination) with zero wasted words. It's front-loaded with the essential information and earns its place efficiently.

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?

For a read-only listing tool with 2 well-documented parameters, the description is minimally adequate. However, with no annotations and no output schema, it should ideally provide more context about response format, error conditions, or typical use cases. The pagination mention helps, but doesn't fully compensate for the missing structured information.

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 already fully documents both parameters (limit and cursor). The description adds no additional parameter semantics beyond what's in the schema - it mentions pagination generally but doesn't explain parameter interactions or usage patterns. This meets the baseline for high schema coverage.

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 verb ('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_users' or 'slack_get_channel_history' which also retrieve Slack data, leaving some ambiguity about when this specific listing tool is preferred.

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 whether this is for initial discovery, filtering criteria, or how it relates to sibling tools like 'slack_get_channel_history' or 'slack_get_users'. The agent must infer usage context from the tool name alone.

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