Skip to main content
Glama

delete_webhook

Permanently delete a webhook subscription to stop event notifications for a topic. Use when retiring an integration or switching topics.

Instructions

Permanently unsubscribe from an event topic by deleting the webhook subscription. Stops all future deliveries to that endpoint for that topic — irreversible (you'd have to re-create with create_webhook). Use when retiring an integration or switching topics. Returns the deleted GID, or a no-op message if nothing matched.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesWebhook subscription GID to delete.

Implementation Reference

  • The handler function for the 'delete_webhook' tool. It takes an 'id' argument (a webhook subscription GID), executes the WEBHOOK_DELETE_MUTATION GraphQL mutation, checks for user errors, and returns a success message with the deleted GID or a no-op message.
    server.tool(
      "delete_webhook",
      "Permanently unsubscribe from an event topic by deleting the webhook subscription. Stops all future deliveries to that endpoint for that topic — irreversible (you'd have to re-create with create_webhook). Use when retiring an integration or switching topics. Returns the deleted GID, or a no-op message if nothing matched.",
      deleteWebhookSchema,
      async (args) => {
        const data = await client.graphql<{
          webhookSubscriptionDelete: {
            deletedWebhookSubscriptionId: string | null;
            userErrors: ShopifyUserError[];
          };
        }>(WEBHOOK_DELETE_MUTATION, { id: args.id });
        throwIfUserErrors(
          data.webhookSubscriptionDelete.userErrors,
          "webhookSubscriptionDelete",
        );
        return {
          content: [
            {
              type: "text" as const,
              text: data.webhookSubscriptionDelete.deletedWebhookSubscriptionId
                ? `Deleted webhook ${data.webhookSubscriptionDelete.deletedWebhookSubscriptionId}.`
                : "No webhook matched; nothing deleted.",
            },
          ],
        };
      },
    );
  • Input schema for the 'delete_webhook' tool: a single required field 'id' (string, the webhook subscription GID to delete).
    const deleteWebhookSchema = {
      id: z.string().describe("Webhook subscription GID to delete."),
    };
  • Registration of the 'delete_webhook' tool via server.tool(...) with the name 'delete_webhook', a description explaining the action, the deleteWebhookSchema, and the async handler function.
    server.tool(
      "delete_webhook",
      "Permanently unsubscribe from an event topic by deleting the webhook subscription. Stops all future deliveries to that endpoint for that topic — irreversible (you'd have to re-create with create_webhook). Use when retiring an integration or switching topics. Returns the deleted GID, or a no-op message if nothing matched.",
      deleteWebhookSchema,
      async (args) => {
        const data = await client.graphql<{
          webhookSubscriptionDelete: {
            deletedWebhookSubscriptionId: string | null;
            userErrors: ShopifyUserError[];
          };
        }>(WEBHOOK_DELETE_MUTATION, { id: args.id });
        throwIfUserErrors(
          data.webhookSubscriptionDelete.userErrors,
          "webhookSubscriptionDelete",
        );
        return {
          content: [
            {
              type: "text" as const,
              text: data.webhookSubscriptionDelete.deletedWebhookSubscriptionId
                ? `Deleted webhook ${data.webhookSubscriptionDelete.deletedWebhookSubscriptionId}.`
                : "No webhook matched; nothing deleted.",
            },
          ],
        };
      },
    );
  • The WEBHOOK_DELETE_MUTATION GraphQL mutation string used by the delete_webhook handler. It sends the webhook subscription 'id' to Shopify's webhookSubscriptionDelete mutation and returns the deletedWebhookSubscriptionId plus userErrors.
    const WEBHOOK_DELETE_MUTATION = /* GraphQL */ `
      mutation WebhookDelete($id: ID!) {
        webhookSubscriptionDelete(id: $id) {
          deletedWebhookSubscriptionId
          userErrors { field message }
        }
      }
    `;
  • The throwIfUserErrors helper function used in the delete_webhook handler to check and throw if any user errors are returned from the Shopify API.
    export function throwIfUserErrors(
      errors: ShopifyUserError[] | undefined,
      operation: string,
    ): void {
      if (!errors || errors.length === 0) return;
      const messages = errors
        .map((e) => (e.field ? `${e.field.join(".")}: ${e.message}` : e.message))
        .join("; ");
      throw new Error(`Shopify ${operation} userErrors: ${messages}`);
    }
Behavior4/5

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

No annotations provided, so description carries the full burden. It discloses irreversibility and what the tool returns (deleted GID or no-op). Could mention any prerequisites like authentication, but overall sufficient.

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?

Three sentences: first defines the action, second provides usage context, third describes return. No redundant information; every sentence earns its place.

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

Completeness5/5

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

For a simple deletion tool with one parameter and no output schema, the description covers all necessary aspects: purpose, irreversibility, usage scenarios, and return value.

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?

Input schema has 100% coverage with a clear description for the single parameter. Description adds no additional parameter details beyond the schema, which is adequate.

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: 'Permanently unsubscribe from an event topic by deleting the webhook subscription.' It specifies the resource (webhook subscription) and distinguishes from sibling tools like create_webhook, update_webhook, and list_webhooks.

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

Usage Guidelines5/5

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

It explicitly states when to use: 'Use when retiring an integration or switching topics.' It also notes that deletion is irreversible and that re-creation requires create_webhook, providing an alternative.

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/miller-joe/shopify-mcp'

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