Skip to main content
Glama

discord_edit_webhook

Modifies an existing Discord webhook to update its name, avatar, or channel ID. Enables precise control over webhook configurations for enhanced interaction management.

Instructions

Edits an existing webhook for a Discord channel

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
avatarNo
channelIdNo
nameNo
reasonNo
webhookIdYes
webhookTokenNo

Implementation Reference

  • The main execution handler for the 'discord_edit_webhook' tool. Validates input arguments using EditWebhookSchema, fetches the webhook from Discord API, edits it with provided name, avatar, channel, or reason, and returns success or error response.
    export async function editWebhookHandler( args: unknown, context: ToolContext ): Promise<ToolResponse> { const { webhookId, webhookToken, name, avatar, channelId, reason } = EditWebhookSchema.parse(args); try { if (!context.client.isReady()) { return { content: [{ type: "text", text: "Discord client not logged in." }], isError: true }; } const webhook = await context.client.fetchWebhook(webhookId, webhookToken); if (!webhook) { return { content: [{ type: "text", text: `Cannot find webhook with ID: ${webhookId}` }], isError: true }; } // Edit the webhook await webhook.edit({ name: name, avatar: avatar, channel: channelId, reason: reason }); return { content: [{ type: "text", text: `Successfully edited webhook with ID: ${webhook.id}` }] }; } catch (error) { return handleDiscordError(error); } }
  • Zod schema for input validation used in the editWebhookHandler to parse and validate arguments like webhookId, name, avatar, etc.
    export const EditWebhookSchema = z.object({ webhookId: z.string(), webhookToken: z.string().optional(), name: z.string().optional(), avatar: z.string().optional(), channelId: z.string().optional(), reason: z.string().optional() });
  • JSON schema definition for the 'discord_edit_webhook' tool used for MCP tool registration, defining input properties and requirements.
    name: "discord_edit_webhook", description: "Edits an existing webhook for a Discord channel", inputSchema: { type: "object", properties: { webhookId: { type: "string" }, webhookToken: { type: "string" }, name: { type: "string" }, avatar: { type: "string" }, channelId: { type: "string" }, reason: { type: "string" } }, required: ["webhookId"] }
  • src/server.ts:173-176 (registration)
    Dispatch registration in the server tool execution switch statement that calls editWebhookHandler when the tool name matches 'discord_edit_webhook'.
    case "discord_edit_webhook": this.logClientState("before discord_edit_webhook handler"); toolResponse = await editWebhookHandler(args, this.toolContext); return toolResponse;

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