Skip to main content
Glama

list_guild_webhooks

Retrieve all webhooks configured in a Discord server by providing the guild ID to manage integrations and automated messaging.

Instructions

List all webhooks in a server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guildIdYesThe ID of the server (guild)

Implementation Reference

  • Handler function that fetches all webhooks from the Discord guild using guild.fetchWebhooks() and formats the response, wrapped in error handling.
    async ({ guildId }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const guild = await client.guilds.fetch(guildId); const webhooks = await guild.fetchWebhooks(); return webhooks.map((wh) => ({ id: wh.id, name: wh.name, type: wh.type, channelId: wh.channelId, avatar: wh.avatar, owner: wh.owner ? { id: wh.owner.id, username: wh.owner.username } : null, createdAt: wh.createdAt?.toISOString(), })); }); if (!result.success) { return { content: [{ type: 'text', text: result.error }], isError: true }; } return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }] }; }
  • Input schema defining the required guildId parameter using Zod.
    { guildId: z.string().describe('The ID of the server (guild)'), },
  • Registration of the list_guild_webhooks tool using server.tool(), including name, description, input schema, and handler.
    server.tool( 'list_guild_webhooks', 'List all webhooks in a server', { guildId: z.string().describe('The ID of the server (guild)'), }, async ({ guildId }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const guild = await client.guilds.fetch(guildId); const webhooks = await guild.fetchWebhooks(); return webhooks.map((wh) => ({ id: wh.id, name: wh.name, type: wh.type, channelId: wh.channelId, avatar: wh.avatar, owner: wh.owner ? { id: wh.owner.id, username: wh.owner.username } : null, createdAt: wh.createdAt?.toISOString(), })); }); 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)
    Invocation of registerWebhookTools which registers the webhook tools including list_guild_webhooks.
    registerWebhookTools(server);

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