Skip to main content
Glama
scarecr0w12

discord-mcp

delete_thread

Remove a Discord thread from a server by specifying the guild and thread IDs. This tool helps manage server organization by deleting outdated or unnecessary discussion threads.

Instructions

Delete a thread

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guildIdYesThe ID of the server (guild)
threadIdYesThe ID of the thread to delete
reasonNoReason for deleting

Implementation Reference

  • The handler function that executes the delete_thread tool: fetches the guild and thread, deletes the thread with optional reason, handles errors with withErrorHandling, and returns success/error response.
    async ({ guildId, threadId, reason }) => {
      const result = await withErrorHandling(async () => {
        const client = await getDiscordClient();
        const guild = await client.guilds.fetch(guildId);
        const thread = await guild.channels.fetch(threadId);
    
        if (!thread || !thread.isThread()) {
          throw new Error('Thread not found');
        }
    
        const threadName = thread.name;
        await thread.delete(reason);
    
        return { threadId, threadName, message: 'Thread deleted successfully' };
      });
    
      if (!result.success) {
        return { content: [{ type: 'text', text: result.error }], isError: true };
      }
    
      return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }] };
    }
  • Input schema using Zod for the delete_thread tool parameters.
    {
      guildId: z.string().describe('The ID of the server (guild)'),
      threadId: z.string().describe('The ID of the thread to delete'),
      reason: z.string().optional().describe('Reason for deleting'),
    },
  • Registration of the delete_thread tool on the MCP server using server.tool() including name, description, schema, and handler.
    server.tool(
      'delete_thread',
      'Delete a thread',
      {
        guildId: z.string().describe('The ID of the server (guild)'),
        threadId: z.string().describe('The ID of the thread to delete'),
        reason: z.string().optional().describe('Reason for deleting'),
      },
      async ({ guildId, threadId, reason }) => {
        const result = await withErrorHandling(async () => {
          const client = await getDiscordClient();
          const guild = await client.guilds.fetch(guildId);
          const thread = await guild.channels.fetch(threadId);
    
          if (!thread || !thread.isThread()) {
            throw new Error('Thread not found');
          }
    
          const threadName = thread.name;
          await thread.delete(reason);
    
          return { threadId, threadName, message: 'Thread deleted successfully' };
        });
    
        if (!result.success) {
          return { content: [{ type: 'text', text: result.error }], isError: true };
        }
    
        return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }] };
      }
    );
  • src/index.ts:64-64 (registration)
    Higher-level registration call that includes the delete_thread tool via registerThreadTools.
    registerThreadTools(server);
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. 'Delete a thread' implies a destructive operation but provides no information about permissions required, whether deletion is permanent or reversible, what happens to thread content, or any rate limits. This is inadequate for a destructive tool.

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 just three words, with zero wasted language. It's front-loaded with the essential action and target, making it immediately scannable and understandable.

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?

For a destructive operation with no annotations and no output schema, the description is insufficient. It doesn't address critical context like what 'delete' means operationally, whether there are confirmation prompts, what permissions are required, or what the response contains. The description should provide more behavioral context.

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?

Schema description coverage is 100%, so all parameters are documented in the schema. The description adds no additional parameter information beyond what's already in the structured schema. The baseline of 3 is appropriate when the schema does the heavy lifting.

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

Purpose4/5

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

The description 'Delete a thread' clearly states the action (delete) and target resource (thread), making the purpose immediately understandable. It doesn't distinguish from sibling tools like 'delete_channel' or 'delete_message', but it's not vague or tautological.

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

Usage Guidelines2/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. With sibling tools like 'delete_channel', 'delete_message', and 'modify_thread', there's no indication of when thread deletion is appropriate versus other deletion or modification operations.

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