Skip to main content
Glama
lars-hagen

Slack User MCP Server

by lars-hagen

slack_list_channels

Retrieve public channels from a Slack workspace with pagination support for managing large channel lists.

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 for the slack_list_channels tool. Extracts arguments and invokes SlackClient.getChannels to list channels.
    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) }],
      };
    }
  • Input schema and metadata definition for the slack_list_channels tool.
    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",
          },
        },
      },
    };
  • Core implementation in SlackClient that calls Slack's conversations.list API to retrieve public channels.
    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.headers },
      );
    
      return response.json();
    }
  • index.ts:532-546 (registration)
    Tool registration via ListToolsRequest handler, which returns the list of tools including slack_list_channels.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      console.error("Received ListToolsRequest");
      return {
        tools: [
          listChannelsTool,
          postMessageTool,
          replyToThreadTool,
          addReactionTool,
          getChannelHistoryTool,
          getThreadRepliesTool,
          getUsersTool,
          getUserProfileTool,
        ],
      };
    });
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.

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/lars-hagen/slack-user-mcp'

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