Skip to main content
Glama

create_channel

Create new Slack channels for team collaboration by specifying a name and privacy setting to organize workspace communication.

Instructions

Create a new channel

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesChannel name (lowercase, no spaces)
is_privateNoCreate as private channel

Implementation Reference

  • The main handler function for the 'create_channel' tool. It validates input using createChannelSchema, wraps the Slack conversations.create API call in safeCall, and returns the created channel.
    export async function createChannel(client: SlackClientWrapper, args: unknown) {
      const params = createChannelSchema.parse(args);
    
      return await client.safeCall(async () => {
        const result = await client.getClient().conversations.create({
          name: params.name,
          is_private: params.is_private,
        });
    
        return {
          channel: result.channel,
        };
      });
    }
  • Zod schema used for input validation in the createChannel handler, defining name (required, lowercase alphanum/hyphen/underscore) and optional is_private.
    export const createChannelSchema = z.object({
      name: z.string().min(1).max(80).regex(/^[a-z0-9-_]+$/, 'Channel name must be lowercase with hyphens or underscores'),
      is_private: z.boolean().optional().default(false),
    });
  • src/index.ts:87-105 (registration)
    MCP tool registration: defines name, description, and inputSchema for 'create_channel' in the list_tools response.
    {
      name: 'create_channel',
      description: 'Create a new channel',
      inputSchema: {
        type: 'object',
        properties: {
          name: {
            type: 'string',
            description: 'Channel name (lowercase, no spaces)',
          },
          is_private: {
            type: 'boolean',
            description: 'Create as private channel',
            default: false,
          },
        },
        required: ['name'],
      },
    },
  • src/index.ts:417-417 (registration)
    Registers the handler mapping for 'create_channel' in the toolHandlers object, wiring it to the CallToolRequest.
    create_channel: (args) => channelTools.createChannel(slackClient, args),

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

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