Skip to main content
Glama

discord_create_text_channel

Create a new text channel in a Discord server to organize conversations, with an optional topic for context.

Instructions

Creates a new text channel in a Discord server with an optional topic

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guildIdYes
channelNameYes
topicNo

Implementation Reference

  • The main handler function that executes the discord_create_text_channel tool. It validates input with CreateTextChannelSchema, fetches the guild, creates a text channel using guild.channels.create(), and returns success or error response.
    export async function createTextChannelHandler( args: unknown, context: ToolContext ): Promise<ToolResponse> { const { guildId, channelName, topic, reason } = CreateTextChannelSchema.parse(args); try { if (!context.client.isReady()) { return { content: [{ type: 'text', text: 'Discord client not logged in.' }], isError: true, }; } const guild = await context.client.guilds.fetch(guildId); if (!guild) { return { content: [ { type: 'text', text: `Cannot find guild with ID: ${guildId}` }, ], isError: true, }; } // Create the text channel const channelOptions: { name: string; type: ChannelType.GuildText; topic?: string; reason?: string; } = { name: channelName, type: ChannelType.GuildText, }; if (topic !== undefined) { channelOptions.topic = topic; } if (reason !== undefined) { channelOptions.reason = reason; } const channel = await guild.channels.create(channelOptions); return { content: [ { type: 'text', text: `Successfully created text channel "${channelName}" with ID: ${channel.id}`, }, ], }; } catch (error) { return handleDiscordError(error); } }
  • MCP tool schema definition for discord_create_text_channel, including name, description, and inputSchema used for tool listing and validation.
    { 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'], }, },
  • src/server.ts:138-144 (registration)
    Registration and dispatch in the main server switch statement, calling createTextChannelHandler for the tool execution.
    case 'discord_create_text_channel': this.logClientState('before discord_create_text_channel handler'); toolResponse = await createTextChannelHandler( args, this.toolContext ); return toolResponse;
  • Additional registration in the HTTP transport handler switch for direct method calls.
    case 'discord_create_text_channel': result = await createTextChannelHandler( params, this.toolContext! ); break;
  • Re-export of createTextChannelHandler from channel.ts, used by server.ts and transport.ts imports.
    export { createCategoryHandler, createTextChannelHandler, deleteCategoryHandler, deleteChannelHandler, editCategoryHandler, getServerInfoHandler, readMessagesHandler, } from './channel.js'; export { createForumPostHandler,

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/IQAIcom/mcp-discord'

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