Skip to main content
Glama
kongyo2

Discord Webhook MCP

Delete Discord Message

discord_delete_message
DestructiveIdempotent

Delete a Discord webhook message by providing the message ID. This action is permanent and subject to rate limits.

Instructions

Webhookで送信したメッセージを削除します。

環境変数DISCORD_WEBHOOK_URLに設定されたWebhookを使用します。

⚠️ レート制限: 30リクエスト/分/チャンネル ⚠️ この操作は取り消せません。

Args:

  • message_id (string, required): 削除するメッセージID

Returns: { "success": boolean, // 削除が成功したか "message_id": string // 削除されたメッセージのID }

Examples:

  • メッセージ削除: { "message_id": "123456789" }

Error Handling:

  • "Discord Webhook error: 404 Not Found - Message not found"

  • "Discord Webhook error: 400 Bad Request - Invalid message ID"

  • "Discord Webhook error: レート制限に達しました" - 429エラー時、retry-after秒後に再試行

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
message_idYes削除するメッセージID

Implementation Reference

  • The async handler function that implements the discord_delete_message tool logic. It calls deleteDiscordMessage with the message_id and returns success or error response.
    async (params: DeleteMessageInput) => {
      // メッセージ削除
      const { error } = await deleteDiscordMessage(params.message_id);
    
      if (error) {
        return {
          content: [
            {
              type: "text",
              text: `エラー: ${formatError(error)}`,
            },
          ],
          isError: true,
        };
      }
    
      return {
        content: [
          {
            type: "text",
            text: `メッセージを削除しました\nID: ${params.message_id}`,
          },
        ],
        structuredContent: {
          success: true,
          message_id: params.message_id,
        },
      };
    }
  • src/index.ts:255-321 (registration)
    The registration of the tool 'discord_delete_message' using server.registerTool(), including its title, description, inputSchema, and annotations.
    // メッセージ削除ツール
    server.registerTool(
      "discord_delete_message",
      {
        title: "Delete Discord Message",
        description:
          `Webhookで送信したメッセージを削除します。
    
    環境変数DISCORD_WEBHOOK_URLに設定されたWebhookを使用します。
    
    ⚠️ レート制限: 30リクエスト/分/チャンネル
    ⚠️ この操作は取り消せません。
    
    Args:
      - message_id (string, required): 削除するメッセージID
    
    Returns:
      {
        "success": boolean,        // 削除が成功したか
        "message_id": string       // 削除されたメッセージのID
      }
    
    Examples:
      - メッセージ削除: { "message_id": "123456789" }
    
    Error Handling:
      - "Discord Webhook error: 404 Not Found - Message not found"
      - "Discord Webhook error: 400 Bad Request - Invalid message ID"
      - "Discord Webhook error: レート制限に達しました" - 429エラー時、retry-after秒後に再試行`,
        inputSchema: DeleteMessageSchema,
        annotations: {
          readOnlyHint: false,
          destructiveHint: true,
          idempotentHint: true,
          openWorldHint: true,
        },
      },
      async (params: DeleteMessageInput) => {
        // メッセージ削除
        const { error } = await deleteDiscordMessage(params.message_id);
    
        if (error) {
          return {
            content: [
              {
                type: "text",
                text: `エラー: ${formatError(error)}`,
              },
            ],
            isError: true,
          };
        }
    
        return {
          content: [
            {
              type: "text",
              text: `メッセージを削除しました\nID: ${params.message_id}`,
            },
          ],
          structuredContent: {
            success: true,
            message_id: params.message_id,
          },
        };
      }
    );
  • Zod schema definition for the input to discord_delete_message. Requires a non-empty string message_id.
    export const DeleteMessageSchema = z.object({
      message_id: z.string().min(1).describe("削除するメッセージID"),
    }).strict();
  • The helper function that makes the actual HTTP DELETE request to the Discord webhook API to delete a message.
    export async function deleteDiscordMessage(
      messageId: string
    ): Promise<{ error?: DiscordWebhookError }> {
      const url = new URL(`${WEBHOOK_URL!}/messages/${messageId}`);
    
      try {
        await makeRequest<void>(url.toString(), "DELETE");
        return {};
      } catch (error) {
        return { error: convertError(error) };
      }
    }
Behavior5/5

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

Annotations already provide destructiveHint and idempotentHint, but description adds rate limits (30 req/min/channel), irreversibility, and specific error messages, enhancing transparency beyond annotations.

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?

Concise yet comprehensive, with clear sections for args, returns, examples, and error handling. No superfluous content.

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

Completeness5/5

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

Covers all necessary aspects for a simple delete tool: environment dependency, rate limits, irreversibility, return format, examples, and error handling. No gaps.

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 coverage is 100%, so baseline is 3. The description repeats the parameter info without adding new semantics about format or validation.

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 tool deletes a message sent via webhook, specifies the use of DISCORD_WEBHOOK_URL environment variable, and distinguishes from sibling tools (edit, send).

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

Usage Guidelines4/5

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

The description implicitly differentiates from siblings by specifying deletion context, but lacks an explicit 'when to use vs. alternatives' statement.

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

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