discord_list_webhooks
List all webhooks for a specific Discord channel or entire guild to manage automated message delivery and integrations.
Instructions
List all webhooks for a channel or guild. Provide either channel_id or guild_id.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channel_id | No | List webhooks for a specific channel. | |
| guild_id | No | List all webhooks in a guild. |
Implementation Reference
- src/tools/webhooks.ts:185-211 (handler)The implementation logic for "discord_list_webhooks" inside the 'handle' function, which fetches webhooks from either a channel or a guild.
case "discord_list_webhooks": { if (args.channel_id) { const channel = await discord.channels.fetch(validateId(args.channel_id, "channel_id")); if (!channel || !("fetchWebhooks" in channel)) throw new Error("Channel does not support webhooks."); const webhooks = await (channel as any).fetchWebhooks(); const result = [...webhooks.values()].map((w: any) => ({ id: w.id, name: w.name, channel_id: w.channelId, token: w.token ?? null, creator: w.owner?.tag ?? null, })); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } else if (args.guild_id) { const guild = await discord.guilds.fetch(validateId(args.guild_id, "guild_id")); const webhooks = await guild.fetchWebhooks(); const result = [...webhooks.values()].map((w) => ({ id: w.id, name: w.name, channel_id: w.channelId, token: w.token ?? null, creator: w.owner && "tag" in w.owner ? w.owner.tag : (w.owner?.username ?? null), })); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } else { throw new Error("Either channel_id or guild_id is required."); } - src/tools/webhooks.ts:89-99 (schema)The tool definition/registration for "discord_list_webhooks" including the input schema.
{ name: "discord_list_webhooks", description: "List all webhooks for a channel or guild. Provide either channel_id or guild_id.", inputSchema: { type: "object", properties: { channel_id: { type: "string", description: "List webhooks for a specific channel." }, guild_id: { type: "string", description: "List all webhooks in a guild." }, }, }, },