Skip to main content
Glama
scarecr0w12

discord-mcp

list_channel_webhooks

Retrieve all webhooks configured in a Discord channel to manage integrations and automate messaging.

Instructions

List all webhooks in a channel

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guildIdYesThe ID of the server (guild)
channelIdYesThe ID of the channel

Implementation Reference

  • The core handler function for the 'list_channel_webhooks' tool. It fetches the Discord client, guild, and channel, validates the channel type, retrieves all webhooks from the channel, maps their properties (redacting tokens), wraps in error handling, and returns a JSON-formatted response.
    async ({ guildId, channelId }) => {
      const result = await withErrorHandling(async () => {
        const client = await getDiscordClient();
        const guild = await client.guilds.fetch(guildId);
        const channel = await guild.channels.fetch(channelId);
        
        if (!isWebhookableChannel(channel)) {
          throw new Error('Channel does not support webhooks');
        }
    
        const webhooks = await channel.fetchWebhooks();
        return webhooks.map((wh) => ({
          id: wh.id,
          name: wh.name,
          type: wh.type,
          channelId: wh.channelId,
          guildId: wh.guildId,
          avatar: wh.avatar,
          token: wh.token ? '[REDACTED]' : null,
          owner: wh.owner ? { id: wh.owner.id, username: wh.owner.username } : null,
          applicationId: wh.applicationId,
          sourceGuild: wh.sourceGuild ? { id: wh.sourceGuild.id, name: wh.sourceGuild.name } : null,
          sourceChannel: wh.sourceChannel ? { id: wh.sourceChannel.id, name: wh.sourceChannel.name } : null,
          url: wh.url,
          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) }] };
    }
  • The registration of the 'list_channel_webhooks' tool using McpServer.tool(), including the tool name, description, input schema (guildId and channelId), and the handler function.
    server.tool(
      'list_channel_webhooks',
      'List all webhooks in a channel',
      {
        guildId: z.string().describe('The ID of the server (guild)'),
        channelId: z.string().describe('The ID of the channel'),
      },
      async ({ guildId, channelId }) => {
        const result = await withErrorHandling(async () => {
          const client = await getDiscordClient();
          const guild = await client.guilds.fetch(guildId);
          const channel = await guild.channels.fetch(channelId);
          
          if (!isWebhookableChannel(channel)) {
            throw new Error('Channel does not support webhooks');
          }
    
          const webhooks = await channel.fetchWebhooks();
          return webhooks.map((wh) => ({
            id: wh.id,
            name: wh.name,
            type: wh.type,
            channelId: wh.channelId,
            guildId: wh.guildId,
            avatar: wh.avatar,
            token: wh.token ? '[REDACTED]' : null,
            owner: wh.owner ? { id: wh.owner.id, username: wh.owner.username } : null,
            applicationId: wh.applicationId,
            sourceGuild: wh.sourceGuild ? { id: wh.sourceGuild.id, name: wh.sourceGuild.name } : null,
            sourceChannel: wh.sourceChannel ? { id: wh.sourceChannel.id, name: wh.sourceChannel.name } : null,
            url: wh.url,
            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 schema defining the input parameters for the tool: guildId (string) and channelId (string).
      guildId: z.string().describe('The ID of the server (guild)'),
      channelId: z.string().describe('The ID of the channel'),
    },
  • Helper function to type-guard and check if a Discord channel supports webhooks (Text, News, Voice, Forum channels). Used in the handler to validate the channel.
    function isWebhookableChannel(channel: unknown): channel is WebhookableChannel {
      if (!channel || typeof channel !== 'object') return false;
      const ch = channel as { type?: number };
      return ch.type === ChannelType.GuildText || 
             ch.type === ChannelType.GuildAnnouncement ||
             ch.type === ChannelType.GuildVoice ||
             ch.type === ChannelType.GuildForum;
    }
  • src/index.ts:60-61 (registration)
    In the main server setup, registerWebhookTools(server) is called to register all webhook-related tools, including 'list_channel_webhooks'.
    registerEmojiTools(server);
    registerWebhookTools(server);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states it's a list operation (implying read-only), but doesn't mention whether it requires specific permissions, returns paginated results, includes webhook details like URLs/tokens, or has rate limits. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that states exactly what the tool does with zero wasted words. It's appropriately sized for a simple list operation and front-loads the core functionality immediately.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple read operation with 2 parameters and 100% schema coverage, the description is minimally adequate. However, with no annotations and no output schema, it should ideally mention what information is returned (e.g., webhook names, IDs, URLs) or typical response structure to be more complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage with clear parameter documentation, so the baseline is 3. The description doesn't add any parameter semantics beyond what's already in the schema (guildId and channelId are adequately described there), nor does it provide context about how these IDs should be obtained or validated.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'List all webhooks in a channel' clearly states the verb ('List') and resource ('webhooks in a channel'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'list_guild_webhooks' or 'create_webhook', which would require explicit comparison to earn a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'list_guild_webhooks' or 'create_webhook'. It lacks any context about prerequisites, permissions needed, or typical use cases, leaving the agent to infer usage from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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