Skip to main content
Glama

validate_webhook

Verify webhook connectivity by sending a test message to Discord, Slack, or both services, ensuring proper setup and functionality for notifications.

Instructions

Test webhook connectivity by sending a test message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageNo
serviceNo

Implementation Reference

  • Handler function that executes the validate_webhook tool: detects services, sends test messages via Discord/Slack webhooks, collects results, and returns formatted response.
    async (args) => {
      const testMessage = args.message || "notify_me_mcp connectivity test";
      
      try {
        const targetServices = detectService(args.service);
        const config = getConfig();
        const results: ServiceResult[] = [];
    
        for (const service of targetServices) {
          try {
            let result;
            
            if (service === "discord") {
              const payload = buildDiscordPayload({ message: testMessage });
              result = await sendDiscord(config.discordWebhookUrl!, payload);
            } else {
              const payload = buildSlackPayload({ message: testMessage });
              result = await sendSlack(config.slackWebhookUrl!, payload);
            }
    
            results.push({
              service,
              success: result.success,
              httpCode: result.httpCode,
              timestamp: result.timestamp
            });
          } catch (error) {
            results.push({
              service,
              success: false,
              error: error instanceof Error ? error.message : "Unknown error"
            });
          }
        }
    
        const overall = results.some(r => r.success);
        const response: SendResult = {
          success: overall,
          overall,
          results
        };
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(response, null, 2)
            }
          ]
        };
      } catch (error) {
        const errorMsg = error instanceof Error ? error.message : "Unknown error";
        return {
          content: [
            {
              type: "text", 
              text: JSON.stringify({ error: errorMsg }, null, 2)
            }
          ]
        };
      }
    }
  • src/index.ts:52-121 (registration)
    Registration of the validate_webhook tool using McpServer.tool method, including description, input schema, and handler reference.
    server.tool(
      "validate_webhook",
      "Test webhook connectivity by sending a test message",
      {
        service: z.enum(["discord", "slack", "both"]).optional(),
        message: z.string().optional(),
      },
      async (args) => {
        const testMessage = args.message || "notify_me_mcp connectivity test";
        
        try {
          const targetServices = detectService(args.service);
          const config = getConfig();
          const results: ServiceResult[] = [];
    
          for (const service of targetServices) {
            try {
              let result;
              
              if (service === "discord") {
                const payload = buildDiscordPayload({ message: testMessage });
                result = await sendDiscord(config.discordWebhookUrl!, payload);
              } else {
                const payload = buildSlackPayload({ message: testMessage });
                result = await sendSlack(config.slackWebhookUrl!, payload);
              }
    
              results.push({
                service,
                success: result.success,
                httpCode: result.httpCode,
                timestamp: result.timestamp
              });
            } catch (error) {
              results.push({
                service,
                success: false,
                error: error instanceof Error ? error.message : "Unknown error"
              });
            }
          }
    
          const overall = results.some(r => r.success);
          const response: SendResult = {
            success: overall,
            overall,
            results
          };
    
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(response, null, 2)
              }
            ]
          };
        } catch (error) {
          const errorMsg = error instanceof Error ? error.message : "Unknown error";
          return {
            content: [
              {
                type: "text", 
                text: JSON.stringify({ error: errorMsg }, null, 2)
              }
            ]
          };
        }
      }
    );
  • Zod schema definition for validate_webhook tool inputs, matching the inline schema used in registration.
    export const ValidateWebhookSchema = z.object({
      service: ServiceSchema.optional(),
      message: z.string().optional(),
    });
  • Inline input schema for validate_webhook tool provided during registration.
      service: z.enum(["discord", "slack", "both"]).optional(),
      message: z.string().optional(),
    },
Install Server

Other Tools

Related 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/thesammykins/notifyme_mcp'

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