Skip to main content
Glama

get_webhook

Fetch a webhook subscription's full configuration by GID to verify details before updating, deleting, or debugging delivery issues.

Instructions

Fetch a single webhook subscription's full configuration by GID — topic, endpoint, format, API version, includeFields filter, metafield namespaces, and timestamps. Use to verify subscription details before update or delete, or when debugging delivery issues.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesWebhook subscription GID.

Implementation Reference

  • Tool handler for 'get_webhook'. Fetches a single webhook subscription by GID, returns its full configuration (topic, endpoint, format, API version, includeFields, metafieldNamespaces, timestamps). Uses GET_WEBHOOK_QUERY GraphQL query.
    server.tool(
      "get_webhook",
      "Fetch a single webhook subscription's full configuration by GID — topic, endpoint, format, API version, includeFields filter, metafield namespaces, and timestamps. Use to verify subscription details before update or delete, or when debugging delivery issues.",
      getWebhookSchema,
      async (args) => {
        const data = await client.graphql<{
          webhookSubscription: WebhookSubscriptionNode | null;
        }>(GET_WEBHOOK_QUERY, { id: args.id });
        if (!data.webhookSubscription) {
          return {
            content: [
              { type: "text" as const, text: `Webhook not found: ${args.id}` },
            ],
          };
        }
        const w = data.webhookSubscription;
        return {
          content: [
            {
              type: "text" as const,
              text: [
                summarizeWebhook(w),
                `  Created: ${w.createdAt}`,
                `  Updated: ${w.updatedAt}`,
              ].join("\n"),
            },
          ],
        };
      },
    );
  • Input schema for 'get_webhook': expects a string 'id' field describing the webhook subscription GID.
    const getWebhookSchema = {
      id: z.string().describe("Webhook subscription GID."),
    };
  • Tool registration via server.tool('get_webhook', ...) inside registerWebhookTools(), called from src/server.ts line 66.
    server.tool(
      "get_webhook",
      "Fetch a single webhook subscription's full configuration by GID — topic, endpoint, format, API version, includeFields filter, metafield namespaces, and timestamps. Use to verify subscription details before update or delete, or when debugging delivery issues.",
      getWebhookSchema,
      async (args) => {
        const data = await client.graphql<{
          webhookSubscription: WebhookSubscriptionNode | null;
        }>(GET_WEBHOOK_QUERY, { id: args.id });
        if (!data.webhookSubscription) {
          return {
            content: [
              { type: "text" as const, text: `Webhook not found: ${args.id}` },
            ],
          };
        }
        const w = data.webhookSubscription;
        return {
          content: [
            {
              type: "text" as const,
              text: [
                summarizeWebhook(w),
                `  Created: ${w.createdAt}`,
                `  Updated: ${w.updatedAt}`,
              ].join("\n"),
            },
          ],
        };
      },
    );
  • GraphQL query definition GET_WEBHOOK_QUERY used by the get_webhook handler to fetch webhook data.
    const GET_WEBHOOK_QUERY = /* GraphQL */ `
      query GetWebhook($id: ID!) {
        webhookSubscription(id: $id) {
          id
          topic
          format
          createdAt
          updatedAt
          includeFields
          metafieldNamespaces
          apiVersion { handle }
          endpoint {
            __typename
            ... on WebhookHttpEndpoint { callbackUrl }
            ... on WebhookPubSubEndpoint { pubSubProject pubSubTopic }
            ... on WebhookEventBridgeEndpoint { arn }
          }
        }
      }
    `;
  • Helper function summarizeWebhook() used by get_webhook handler to format the webhook output text.
    function summarizeWebhook(w: WebhookSubscriptionNode): string {
      const target =
        w.endpoint.callbackUrl ??
        (w.endpoint.pubSubProject
          ? `pubsub ${w.endpoint.pubSubProject}/${w.endpoint.pubSubTopic}`
          : null) ??
        w.endpoint.arn ??
        "(unknown endpoint)";
      const filters: string[] = [];
      if (w.includeFields?.length) {
        filters.push(`fields: ${w.includeFields.join(",")}`);
      }
      if (w.metafieldNamespaces?.length) {
        filters.push(`metafields: ${w.metafieldNamespaces.join(",")}`);
      }
      const filterStr = filters.length ? ` (${filters.join("; ")})` : "";
      return `  ${w.topic} [${w.format}@${w.apiVersion.handle}] → ${target}${filterStr} — ${w.id}`;
    }
Behavior4/5

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

Clearly indicates a read-only operation ('Fetch'), with no annotations to contradict. Discloses that the response includes full configuration details, which is consistent with a read tool. Lacks mention of permissions or rate limits but is acceptable for a simple fetch.

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?

Two sentences: first states action and output details, second provides usage guidance. No wasted words, front-loaded with key information.

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?

Despite no output schema, the description enumerates the returned fields (topic, endpoint, format, etc.), making the tool's output clear. Usage guidance completes the picture for a simple read tool. No gaps.

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 covers the single parameter 'id' with description 'Webhook subscription GID' at 100% coverage. The description reaffirms 'by GID' and lists returned fields, adding some context but not significantly beyond the schema. 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 uses a specific verb 'Fetch' and resource 'single webhook subscription's full configuration', listing included fields (topic, endpoint, etc.), clearly distinguishing it from list_webhooks (multi) and create/update/delete siblings.

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

Usage Guidelines4/5

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

Explicitly states when to use: 'Use to verify subscription details before update or delete, or when debugging delivery issues.' Does not mention alternatives explicitly, but context is sufficient for an agent to decide.

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