Skip to main content
Glama
jar285

MCP-Discord

by jar285

discord_delete_message

Delete a specific message from a Discord text channel using channel and message IDs. This tool removes unwanted or incorrect messages to maintain channel organization.

Instructions

Deletes a specific message from a Discord text channel

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channelIdYes
messageIdYes
reasonNo

Implementation Reference

  • The handler implementation for the discord_delete_message tool. It validates input with DeleteMessageSchema, checks client readiness, fetches the channel and message, deletes the message, and returns success or error response.
    case "discord_delete_message": {
      const { channelId, messageId, reason } = DeleteMessageSchema.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 channel = await client.channels.fetch(channelId);
        if (!channel || !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 {
          content: [{ type: "text", text: `Failed to delete message: ${error}` }],
          isError: true
        };
      }
    }
  • Zod schema defining the input parameters for the discord_delete_message tool: channelId, messageId, and optional reason.
    const DeleteMessageSchema = z.object({
        channelId: z.string(),
        messageId: z.string(),
        reason: z.string().optional()
    });
  • src/index.ts:386-398 (registration)
    Registration of the discord_delete_message tool in the list of available tools, including name, description, and input schema.
    {
      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"]
      }
    },

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

B3.1/5.0
Behavior2/5

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

With no annotations, the description carries full responsibility for disclosing behavior. It only states the action ('Deletes') without mentioning irreversibility, permissions, error handling, or side effects. The agent is not informed that deletion is permanent or what happens if the message does not exist.

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 a single sentence with no wasted words. It is front-loaded with the verb and provides the essential information in a concise, well-structured format.

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?

The tool is simple, but the description lacks necessary context for an agent to make a fully informed choice. It does not address alternative delete tools, behavioral implications, or parameter usage, leaving gaps that a richer description should fill.

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?

The input schema has 0% description coverage, so the description must compensate. It implies the need for channelId and messageId via 'text channel' and 'specific message', but does not explicitly name them or explain the optional 'reason' parameter. This adds minimal meaning beyond the schema.

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 states a specific verb ('Deletes') and resource ('a specific message from a Discord text channel'), clearly distinguishing it from sibling delete tools for categories, channels, and forum posts. The purpose is unambiguous.

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 is provided about when to use this tool versus alternatives, such as deleting an entire channel or a forum post. There is no mention of prerequisites, permissions, or exclusion conditions, leaving the agent to infer usage from context.

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