discord_create_text_channel
Create a new text channel in a Discord server with an optional topic to organize discussions and manage community communication.
Instructions
Creates a new text channel in a Discord server with an optional topic
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| guildId | Yes | ||
| channelName | Yes | ||
| topic | No |
Implementation Reference
- src/index.ts:780-817 (handler)Handler for discord_create_text_channel: parses args with schema, fetches guild, creates text channel using guild.channels.create with name, type GuildText, and optional topic.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 parameters for the tool: guildId (required string), channelName (required string), topic (optional string).const CreateTextChannelSchema = z.object({ guildId: z.string(), channelName: z.string(), topic: z.string().optional() });
- src/index.ts:278-290 (registration)Tool registration in the ListTools response, specifying name, description, and input schema 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"] } },