discord_create_text_channel
Create a new text channel in Discord with a specified name and optional topic. Simplify channel management for organized server communication and collaboration.
Instructions
Creates a new text channel in a Discord server with an optional topic
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channelName | Yes | ||
| guildId | Yes | ||
| topic | No |
Implementation Reference
- src/index.ts:780-817 (handler)The switch case handler that executes the discord_create_text_channel tool. Parses arguments using CreateTextChannelSchema, fetches the guild, creates a new text channel using Discord.js guild.channels.create(), and returns success or error response.case "discord_create_text_channel": { const { guildId, channelName, topic } = CreateTextChannelSchema.parse(args); try { if (!client.isReady()) { return { content: [{ type: "text", text: "Discord client not logged in. Please use discord_login tool first." }], isError: true }; } const guild = await client.guilds.fetch(guildId); if (!guild) { return { content: [{ type: "text", text: `Cannot find guild with ID: ${guildId}` }], isError: true }; } // Create the text channel const channel = await guild.channels.create({ name: channelName, type: ChannelType.GuildText, topic: topic }); return { content: [{ type: "text", text: `Successfully created text channel "${channelName}" with ID: ${channel.id}` }] }; } catch (error) { return { content: [{ type: "text", text: `Failed to create text channel: ${error}` }], isError: true }; } }
- src/index.ts:168-172 (schema)Zod schema defining input validation for the tool: guildId (required string), channelName (required string), topic (optional string). Used in handler for parsing args.const CreateTextChannelSchema = z.object({ guildId: z.string(), channelName: z.string(), topic: z.string().optional() });
- src/index.ts:278-290 (registration)Tool registration in the MCP server's ListTools response, including name, description, and inputSchema matching the zod schema.{ name: "discord_create_text_channel", description: "Creates a new text channel in a Discord server with an optional topic", inputSchema: { type: "object", properties: { guildId: { type: "string" }, channelName: { type: "string" }, topic: { type: "string" } }, required: ["guildId", "channelName"] } },