Skip to main content
Glama

modify_webhook

Update Discord webhook properties including name, avatar, channel location, and modification reason for server management.

Instructions

Modify a webhook

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
webhookIdYesThe ID of the webhook
nameNoNew name for the webhook
avatarNoURL of the new avatar image
channelIdNoMove webhook to different channel
reasonNoReason for modifying

Implementation Reference

  • Executes the modify_webhook tool: fetches Discord webhook, conditionally builds edit data for name, avatar, channel, reason, edits via Discord.js webhook.edit(), handles errors with withErrorHandling, returns JSON response.
    async ({ webhookId, name, avatar, channelId, reason }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const webhook = await client.fetchWebhook(webhookId); const editData: { name?: string; avatar?: string; channel?: string; reason?: string } = {}; if (name) editData.name = name; if (avatar) editData.avatar = avatar; if (channelId) editData.channel = channelId; if (reason) editData.reason = reason; const updated = await webhook.edit(editData); return { id: updated.id, name: updated.name, channelId: updated.channelId, message: 'Webhook updated successfully', }; }); if (!result.success) { return { content: [{ type: 'text', text: result.error }], isError: true }; } return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }] }; }
  • Zod schema defining input parameters for modify_webhook tool: required webhookId, optional name, avatar, channelId, reason with descriptions.
    { webhookId: z.string().describe('The ID of the webhook'), name: z.string().optional().describe('New name for the webhook'), avatar: z.string().optional().describe('URL of the new avatar image'), channelId: z.string().optional().describe('Move webhook to different channel'), reason: z.string().optional().describe('Reason for modifying'), },
  • Registers the modify_webhook tool on the MCP server with name, description, input schema, and handler function.
    server.tool( 'modify_webhook', 'Modify a webhook', { webhookId: z.string().describe('The ID of the webhook'), name: z.string().optional().describe('New name for the webhook'), avatar: z.string().optional().describe('URL of the new avatar image'), channelId: z.string().optional().describe('Move webhook to different channel'), reason: z.string().optional().describe('Reason for modifying'), }, async ({ webhookId, name, avatar, channelId, reason }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const webhook = await client.fetchWebhook(webhookId); const editData: { name?: string; avatar?: string; channel?: string; reason?: string } = {}; if (name) editData.name = name; if (avatar) editData.avatar = avatar; if (channelId) editData.channel = channelId; if (reason) editData.reason = reason; const updated = await webhook.edit(editData); return { id: updated.id, name: updated.name, channelId: updated.channelId, message: 'Webhook updated successfully', }; }); if (!result.success) { return { content: [{ type: 'text', text: result.error }], isError: true }; } return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }] }; } );
  • src/index.ts:60-60 (registration)
    Top-level registration call to registerWebhookTools which includes the modify_webhook tool among others.
    registerWebhookTools(server);
  • src/index.ts:18-18 (registration)
    Import of registerWebhookTools function used to register webhook tools including modify_webhook.
    import { registerWebhookTools } from './tools/webhook-tools.js';

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

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