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
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Channel name (lowercase, no spaces) | |
| is_private | No | Create as private channel |
Implementation Reference
- src/tools/channels.ts:41-54 (handler)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, }; }); }
- src/utils/validators.ts:22-25 (schema)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),