Skip to main content
Glama

list_guild_webhooks

Retrieve all configured webhooks within a Discord server to manage automated message delivery and integrations.

Instructions

List all webhooks in a server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guildIdYesThe ID of the server (guild)

Implementation Reference

  • Executes the tool logic: fetches the guild, retrieves all webhooks using guild.fetchWebhooks(), maps them to a simplified object, wraps in error handling, and returns JSON string.
    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) }] }; }
  • Zod input schema defining the required guildId parameter.
    { guildId: z.string().describe('The ID of the server (guild)'), },
  • Registers the list_guild_webhooks tool on the MCP server with name, description, input schema, and handler function.
    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:61-61 (registration)
    Top-level call to registerWebhookTools which includes the list_guild_webhooks tool.
    registerWebhookTools(server);
  • src/index.ts:18-18 (registration)
    Import of registerWebhookTools function that defines and registers the tool.
    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