Skip to main content
Glama
jar285

MCP-Discord

by jar285

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
NameRequiredDescriptionDefault
guildIdYes
channelNameYes
topicNo

Implementation Reference

  • 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
        };
      }
    }
  • 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"]
      }
    },

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

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