Skip to main content
Glama

discord_delete_message

Delete a specific message from a Discord text channel using channel ID, message ID, and an optional reason.

Instructions

Deletes a specific message from a Discord text channel

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channelIdYes
messageIdYes
reasonNo

Implementation Reference

  • The deleteMessageHandler function that executes the delete message logic. It parses args with DeleteMessageSchema, fetches the channel, fetches the message, and calls message.delete().
    // Delete message handler
    export async function deleteMessageHandler(
      args: unknown,
      context: ToolContext
    ): Promise<ToolResponse> {
      const { channelId, messageId } = DeleteMessageSchema.parse(args);
      try {
        if (!context.client.isReady()) {
          return {
            content: [{ type: 'text', text: 'Discord client not logged in.' }],
            isError: true,
          };
        }
    
        const channel = await context.client.channels.fetch(channelId);
        if (!(channel?.isTextBased() && 'messages' in channel)) {
          return {
            content: [
              {
                type: 'text',
                text: `Cannot find text channel with ID: ${channelId}`,
              },
            ],
            isError: true,
          };
        }
    
        // Fetch the message
        const message = await channel.messages.fetch(messageId);
        if (!message) {
          return {
            content: [
              { type: 'text', text: `Cannot find message with ID: ${messageId}` },
            ],
            isError: true,
          };
        }
    
        // Delete the message
        await message.delete();
    
        return {
          content: [
            {
              type: 'text',
              text: `Successfully deleted message with ID: ${messageId} from channel: ${channelId}`,
            },
          ],
        };
      } catch (error) {
        return handleDiscordError(error);
      }
    }
  • DeleteMessageSchema - Zod schema defining the input validation for discord_delete_message tool: channelId (string), messageId (string), and optional reason (string).
    export const DeleteMessageSchema = z.object({
      channelId: z.string(),
      messageId: z.string(),
      reason: z.string().optional(),
    });
  • Registration entry in tool-list.ts for 'discord_delete_message' with name, description, and inputSchema (channelId, messageId, reason - channelId and messageId required).
    {
      name: 'discord_delete_message',
      description: 'Deletes a specific message from a Discord text channel',
      inputSchema: {
        type: 'object',
        properties: {
          channelId: { type: 'string' },
          messageId: { type: 'string' },
          reason: { type: 'string' },
        },
        required: ['channelId', 'messageId'],
      },
    },
  • src/server.ts:181-184 (registration)
    Case statement in server.ts that routes 'discord_delete_message' to the deleteMessageHandler function.
    case 'discord_delete_message':
      this.logClientState('before discord_delete_message handler');
      toolResponse = await deleteMessageHandler(args, this.toolContext);
      return toolResponse;
  • Case statement in transport.ts that routes 'discord_delete_message' to deleteMessageHandler.
    case 'discord_delete_message':
      result = await deleteMessageHandler(params, this.toolContext!);
      break;
Behavior2/5

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

No annotations provided, and the description only says 'deletes' without disclosing behavioral traits such as irreversibility, required permissions (e.g., Manage Messages), rate limits, or potential errors. The burden falls entirely on the description, which fails to provide this.

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

Conciseness3/5

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

The description is a single sentence, which is concise and front-loaded. However, the brevity sacrifices necessary details, making it under-specified for a tool with no annotations or output schema.

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 lack of annotations, schema descriptions, and output schema, the description is insufficient. It does not explain return values, side effects, or error handling, leaving the agent with incomplete information to invoke the tool reliably.

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

Parameters2/5

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

Input schema has 0% description coverage for its three parameters. The description adds no additional meaning beyond parameter names. The 'reason' parameter's purpose (e.g., audit log reason) is left implicit, making it harder for an agent to use correctly.

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

Purpose5/5

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

The description clearly states the action ('Deletes') and the target resource ('a specific message from a Discord text channel'), with a verb and specific resource. It distinguishes from sibling tools that delete channels, categories, or forum posts.

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?

No guidance on when to use this tool versus alternatives like discord_remove_reaction or when not to use it. There is no mention of prerequisites (e.g., bot permissions) or context for usage.

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

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