Skip to main content
Glama
scarecr0w12

discord-mcp

create_thread

Create a new thread in a Discord server channel to organize discussions or focus on specific topics.

Instructions

Create a new thread

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guildIdYesThe ID of the server (guild)
channelIdYesThe ID of the parent channel
nameYesName of the thread
messageIdNoMessage ID to start thread from
autoArchiveDurationNoAuto archive after minutes
typeNoThread type (default public)
reasonNoReason for creating

Implementation Reference

  • The handler function that implements the create_thread tool logic. It fetches the Discord guild and channel, validates the channel type, maps auto-archive durations, and creates either a public/private thread or starts one from a message using Discord.js APIs. Returns JSON response or error.
    async ({ guildId, channelId, name, messageId, autoArchiveDuration, type = 'public', reason }) => {
      const result = await withErrorHandling(async () => {
        const client = await getDiscordClient();
        const guild = await client.guilds.fetch(guildId);
        const channel = await guild.channels.fetch(channelId);
        
        if (!channel || channel.type !== ChannelType.GuildText) {
          throw new Error('Channel does not support creating threads');
        }
    
        const textChannel = channel as TextChannel;
        const archiveDurationMap: Record<string, ThreadAutoArchiveDuration> = {
          '60': ThreadAutoArchiveDuration.OneHour,
          '1440': ThreadAutoArchiveDuration.OneDay,
          '4320': ThreadAutoArchiveDuration.ThreeDays,
          '10080': ThreadAutoArchiveDuration.OneWeek,
        };
    
        let thread;
        if (messageId) {
          const message = await textChannel.messages.fetch(messageId);
          thread = await message.startThread({
            name,
            autoArchiveDuration: autoArchiveDuration ? archiveDurationMap[autoArchiveDuration] : undefined,
            reason,
          });
        } else {
          thread = await textChannel.threads.create({
            name,
            autoArchiveDuration: autoArchiveDuration ? archiveDurationMap[autoArchiveDuration] : undefined,
            type: type === 'private' ? ChannelType.PrivateThread : ChannelType.PublicThread,
            reason,
          });
        }
    
        return {
          id: thread.id,
          name: thread.name,
          type: ChannelType[thread.type],
          parentId: thread.parentId,
          message: 'Thread created successfully',
        };
      });
    
      if (!result.success) {
        return { content: [{ type: 'text', text: result.error }], isError: true };
      }
    
      return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }] };
    }
  • Zod schema defining the input parameters for the create_thread tool, including guild ID, channel ID, thread name, optional message ID, auto-archive duration, type, and reason.
      guildId: z.string().describe('The ID of the server (guild)'),
      channelId: z.string().describe('The ID of the parent channel'),
      name: z.string().describe('Name of the thread'),
      messageId: z.string().optional().describe('Message ID to start thread from'),
      autoArchiveDuration: z.enum(['60', '1440', '4320', '10080']).optional().describe('Auto archive after minutes'),
      type: z.enum(['public', 'private']).optional().describe('Thread type (default public)'),
      reason: z.string().optional().describe('Reason for creating'),
    },
  • Registration of the create_thread tool via server.tool() within the registerThreadTools function, specifying name, description, input schema, and handler.
      'Create a new thread',
      {
        guildId: z.string().describe('The ID of the server (guild)'),
        channelId: z.string().describe('The ID of the parent channel'),
        name: z.string().describe('Name of the thread'),
        messageId: z.string().optional().describe('Message ID to start thread from'),
        autoArchiveDuration: z.enum(['60', '1440', '4320', '10080']).optional().describe('Auto archive after minutes'),
        type: z.enum(['public', 'private']).optional().describe('Thread type (default public)'),
        reason: z.string().optional().describe('Reason for creating'),
      },
      async ({ guildId, channelId, name, messageId, autoArchiveDuration, type = 'public', reason }) => {
        const result = await withErrorHandling(async () => {
          const client = await getDiscordClient();
          const guild = await client.guilds.fetch(guildId);
          const channel = await guild.channels.fetch(channelId);
          
          if (!channel || channel.type !== ChannelType.GuildText) {
            throw new Error('Channel does not support creating threads');
          }
    
          const textChannel = channel as TextChannel;
          const archiveDurationMap: Record<string, ThreadAutoArchiveDuration> = {
            '60': ThreadAutoArchiveDuration.OneHour,
            '1440': ThreadAutoArchiveDuration.OneDay,
            '4320': ThreadAutoArchiveDuration.ThreeDays,
            '10080': ThreadAutoArchiveDuration.OneWeek,
          };
    
          let thread;
          if (messageId) {
            const message = await textChannel.messages.fetch(messageId);
            thread = await message.startThread({
              name,
              autoArchiveDuration: autoArchiveDuration ? archiveDurationMap[autoArchiveDuration] : undefined,
              reason,
            });
          } else {
            thread = await textChannel.threads.create({
              name,
              autoArchiveDuration: autoArchiveDuration ? archiveDurationMap[autoArchiveDuration] : undefined,
              type: type === 'private' ? ChannelType.PrivateThread : ChannelType.PublicThread,
              reason,
            });
          }
    
          return {
            id: thread.id,
            name: thread.name,
            type: ChannelType[thread.type],
            parentId: thread.parentId,
            message: 'Thread created successfully',
          };
        });
    
        if (!result.success) {
          return { content: [{ type: 'text', text: result.error }], isError: true };
        }
    
        return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }] };
      }
    );
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'Create a new thread' implies a write operation but doesn't specify permissions required, rate limits, whether it's idempotent, what happens on failure, or the expected return format. For a mutation tool with zero annotation coverage, this is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise at three words with no wasted language. It's front-loaded with the core action, though this brevity comes at the cost of completeness. Every word earns its place, making it structurally efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (7 parameters, mutation operation) and lack of annotations and output schema, the description is incomplete. It doesn't explain what a thread is in this context, what happens after creation, or any behavioral aspects. For a tool with this many parameters and no structured support, the description should do more.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so the schema already documents all 7 parameters with descriptions and enums. The description adds no additional parameter semantics beyond what's in the schema, but since the schema does the heavy lifting, the baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Create a new thread' is a tautology that merely restates the tool name without adding specificity. It doesn't specify what type of thread (e.g., Discord thread, forum thread) or what resource it creates, nor does it distinguish this tool from sibling tools like 'create_channel' or 'create_forum_post' that might serve similar purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. There's no mention of prerequisites (e.g., needing a guild and channel), use cases (e.g., organizing discussions), or exclusions (e.g., not for creating regular channels). With multiple sibling creation tools, this lack of differentiation is problematic.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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

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