Skip to main content
Glama

discord_delete_message

Remove a specific message in a Discord text channel by specifying the channel and message IDs, ensuring clean and organized communication management.

Instructions

Deletes a specific message from a Discord text channel

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channelIdYes
messageIdYes
reasonNo

Implementation Reference

  • The main handler function for the discord_delete_message tool. It validates arguments using DeleteMessageSchema, checks client readiness, fetches the channel and message, deletes the message, and returns success or error response.
    export async function deleteMessageHandler(
      args: unknown, 
      context: ToolContext
    ): Promise<ToolResponse> {
      const { channelId, messageId, reason } = 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 || !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);
      }
    } 
  • Zod schema for input validation used within the deleteMessageHandler.
    export const DeleteMessageSchema = z.object({
        channelId: z.string(),
        messageId: z.string(),
        reason: z.string().optional()
    });
  • JSON Schema definition for the tool's input parameters, used in the MCP listTools response.
    {
      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:158-161 (registration)
    Registration and dispatching logic in the MCP server's CallToolRequest handler switch statement.
    case "discord_delete_message":
      this.logClientState("before discord_delete_message handler");
      toolResponse = await deleteMessageHandler(args, this.toolContext);
      return toolResponse;
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Deletes') but lacks critical details like required permissions (e.g., bot or user rights), whether deletion is permanent or reversible, rate limits, or error handling. This is a significant gap for a destructive operation with zero annotation coverage.

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, direct sentence with no wasted words, front-loading the core action and resource. It's appropriately sized for the tool's complexity, making it easy to scan and understand quickly.

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 destructive nature, lack of annotations, 0% schema coverage, and no output schema, the description is incomplete. It doesn't address permissions, consequences, parameter details, or return values, leaving the agent with insufficient context to use the tool safely and effectively.

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?

Schema description coverage is 0%, so the description must compensate for undocumented parameters. It mentions 'a specific message' but doesn't explain what 'channelId', 'messageId', or 'reason' represent, their formats, or how to obtain them. This leaves key parameter semantics unclear, failing to add value beyond the bare schema.

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 clearly states the action ('Deletes') and resource ('a specific message from a Discord text channel'), making the purpose unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'discord_delete_channel' or 'discord_delete_forum_post', which target different resources, so it misses full sibling distinction.

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, such as when to delete a message versus edit it or use other deletion tools for different resources. There's no mention of prerequisites, permissions, or contextual factors, leaving usage unclear beyond the basic action.

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

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

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