Skip to main content
Glama

add_webhook

Add a new webhook to a Storyblok space by specifying name, endpoint, and triggering actions. Optionally set secret and activation status.

Instructions

Adds a new webhook to a specified Storyblok space using the Management API.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName of the webhook
endpointYesURL endpoint for the webhook
actionsYesList of actions that trigger the webhook
descriptionNoDescription of the webhook
secretNoSecret for webhook verification
activatedNoWhether the webhook is activated

Implementation Reference

  • The 'add_webhook' tool handler. Registers a new webhook via POST to /webhook_endpoints/. Defines Zod schema for inputs (name, endpoint, actions, description, secret, activated) and calls apiPost to create the webhook.
    // Tool: add_webhook
    server.tool(
      'add_webhook',
      'Adds a new webhook to a specified Storyblok space using the Management API.',
      {
        name: z.string().describe('Name of the webhook'),
        endpoint: z.string().describe('URL endpoint for the webhook'),
        actions: z.array(z.string()).describe('List of actions that trigger the webhook'),
        description: z.string().optional().describe('Description of the webhook'),
        secret: z.string().optional().describe('Secret for webhook verification'),
        activated: z.boolean().optional().default(true).describe('Whether the webhook is activated'),
      },
      async ({ name, endpoint, actions, description, secret, activated }) => {
        try {
          const webhookData: Record<string, unknown> = {
            name,
            description,
            endpoint,
            secret,
            actions,
            activated,
          };
    
          const payload = { webhook_endpoint: webhookData };
          const data = await apiPost('/webhook_endpoints/', payload);
          return createJsonResponse(data);
        } catch (error) {
          if (error instanceof APIError) {
            return createErrorResponse(error);
          }
          throw error;
        }
      }
    );
  • The registerWebhooks function that registers all webhook tools (including 'add_webhook') with the MCP server via server.tool().
    export function registerWebhooks(server: McpServer): void {
      // Tool: retrieve_multiple_webhooks
      server.tool(
        'retrieve_multiple_webhooks',
        'Retrieves multiple webhook endpoints from a specified Storyblok space using the Management API.',
        {
          page: z.number().optional().default(1).describe('Page number'),
          per_page: z.number().optional().default(25).describe('Items per page'),
        },
        async ({ page, per_page }) => {
          try {
            const params: Record<string, string> = {};
            if (page !== undefined) params.page = String(page);
            if (per_page !== undefined) params.per_page = String(per_page);
    
            const data = await apiGet('/webhook_endpoints/', params);
            return createJsonResponse(data);
          } catch (error) {
            if (error instanceof APIError) {
              return createErrorResponse(error);
            }
            throw error;
          }
        }
      );
    
      // Tool: retrieve_single_webhook
      server.tool(
        'retrieve_single_webhook',
        'Retrieves a single webhook from a specified Storyblok space using the Management API.',
        {
          webhook_endpoint_id: z.number().describe('ID of the webhook endpoint to retrieve'),
        },
        async ({ webhook_endpoint_id }) => {
          try {
            const data = await apiGet(`/webhook_endpoints/${webhook_endpoint_id}`);
            return createJsonResponse(data);
          } catch (error) {
            if (error instanceof APIError) {
              return createErrorResponse(error);
            }
            throw error;
          }
        }
      );
    
      // Tool: add_webhook
      server.tool(
        'add_webhook',
        'Adds a new webhook to a specified Storyblok space using the Management API.',
        {
          name: z.string().describe('Name of the webhook'),
          endpoint: z.string().describe('URL endpoint for the webhook'),
          actions: z.array(z.string()).describe('List of actions that trigger the webhook'),
          description: z.string().optional().describe('Description of the webhook'),
          secret: z.string().optional().describe('Secret for webhook verification'),
          activated: z.boolean().optional().default(true).describe('Whether the webhook is activated'),
        },
        async ({ name, endpoint, actions, description, secret, activated }) => {
          try {
            const webhookData: Record<string, unknown> = {
              name,
              description,
              endpoint,
              secret,
              actions,
              activated,
            };
    
            const payload = { webhook_endpoint: webhookData };
            const data = await apiPost('/webhook_endpoints/', payload);
            return createJsonResponse(data);
          } catch (error) {
            if (error instanceof APIError) {
              return createErrorResponse(error);
            }
            throw error;
          }
        }
      );
    
      // Tool: update_webhook
      server.tool(
        'update_webhook',
        'Updates an existing webhook endpoint in a specified Storyblok space.',
        {
          webhook_endpoint_id: z.number().describe('ID of the webhook endpoint to update'),
          name: z.string().optional().describe('New name for the webhook'),
          endpoint: z.string().optional().describe('New URL endpoint'),
          actions: z.array(z.string()).optional().describe('New list of actions'),
          description: z.string().optional().describe('New description'),
          secret: z.string().optional().describe('New secret'),
          activated: z.boolean().optional().describe('Whether the webhook is activated'),
        },
        async ({ webhook_endpoint_id, name, endpoint, actions, description, secret, activated }) => {
          try {
            const webhookData: Record<string, unknown> = {};
            if (name !== undefined) webhookData.name = name;
            if (endpoint !== undefined) webhookData.endpoint = endpoint;
            if (actions !== undefined) webhookData.actions = actions;
            if (description !== undefined) webhookData.description = description;
            if (secret !== undefined) webhookData.secret = secret;
            if (activated !== undefined) webhookData.activated = activated;
    
            const payload = { webhook_endpoint: webhookData };
            const data = await apiPut(`/webhook_endpoints/${webhook_endpoint_id}`, payload);
            return createJsonResponse(data);
          } catch (error) {
            if (error instanceof APIError) {
              return createErrorResponse(error);
            }
            throw error;
          }
        }
      );
    
      // Tool: delete_webhook
      server.tool(
        'delete_webhook',
        'Deletes an existing webhook endpoint in a specified Storyblok space.',
        {
          webhook_endpoint_id: z.number().describe('ID of the webhook endpoint to delete'),
        },
        async ({ webhook_endpoint_id }) => {
          try {
            await apiDelete(`/webhook_endpoints/${webhook_endpoint_id}`);
            return {
              content: [
                { type: 'text' as const, text: `Webhook endpoint ${webhook_endpoint_id} has been successfully deleted.` },
              ],
            };
          } catch (error) {
            if (error instanceof APIError) {
              return createErrorResponse(error);
            }
            throw error;
          }
        }
      );
    }
  • Zod input schema for the add_webhook tool: name (string), endpoint (string), actions (array of strings), description (optional string), secret (optional string), activated (optional boolean, default true).
    {
      name: z.string().describe('Name of the webhook'),
      endpoint: z.string().describe('URL endpoint for the webhook'),
      actions: z.array(z.string()).describe('List of actions that trigger the webhook'),
      description: z.string().optional().describe('Description of the webhook'),
      secret: z.string().optional().describe('Secret for webhook verification'),
      activated: z.boolean().optional().default(true).describe('Whether the webhook is activated'),
    },
  • Import of registerWebhooks from webhooks module.
    import { registerWebhooks } from './webhooks.js';
  • Invocation of registerWebhooks(server) to register all webhook tools, including 'add_webhook'.
    // Webhooks
    registerWebhooks(server);
Behavior2/5

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

No annotations are provided, so the description must carry the burden of behavioral disclosure. It only states 'Adds a new webhook' without mentioning authentication requirements, rate limits, side effects, or error conditions. For a mutation tool, this is insufficient.

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

Conciseness4/5

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

The description is a single sentence with no wasted words. However, it omits important details that could be included without becoming verbose.

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

Completeness2/5

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

No output schema, no explanation of return values, and no context beyond the core action. For a tool with 6 parameters and no annotations, the description is too brief to be fully actionable.

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?

Schema coverage is 100%, with all parameters described. The description adds no extra meaning beyond what is already in the schema, so baseline 3 is appropriate.

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

Purpose5/5

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

The description clearly states the action ('Adds'), the resource ('new webhook'), and the context ('to a specified Storyblok space using the Management API'). It distinguishes from sibling tools like delete_webhook and update_webhook.

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?

No guidance on when to use or not use this tool, no exclusions, and no mention of alternatives. The description lacks context for when to select this over other webhook-related tools.

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/hypescale/storyblok-mcp-server'

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