Skip to main content
Glama

Update a webhook

lob_webhooks_update
Idempotent

Update an existing webhook's URL, event subscriptions, or description. Lob automatically manages the disabled status.

Instructions

Update a webhook's URL, event subscriptions, or description. Note: the disabled flag on the response is Lob-managed (e.g. Lob auto-disables webhooks whose delivery URL consistently fails) and is not settable by callers.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesWebhook ID (`ep_…`).
urlNo
event_typesNo
descriptionNo
metadataNoUp to 20 string key/value pairs of arbitrary metadata to attach to the resource.
extraNoAdditional Lob API parameters not enumerated above. Merged into the request body verbatim. See https://docs.lob.com for the full parameter list per resource.

Implementation Reference

  • Handler for lob_webhooks_update: destructures id and extra from args, then sends a POST request to /webhooks/{id} with the remaining fields as body (merged with extra params).
      handler: async (args) => {
        const { id, extra, ...rest } = args;
        return lob.request({
          method: "POST",
          path: `/webhooks/${id}`,
          body: withExtra(rest, extra),
        });
      },
    });
  • Input schema for lob_webhooks_update: accepts id (required webhook ID matching whk_ or ep_ prefix), optional url, optional event_types array, optional description (max 255 chars), optional metadata, and optional extra escape hatch.
    inputSchema: {
      id: WH_ID,
      url: z.string().url().optional(),
      event_types: z.array(z.string()).optional(),
      description: z.string().max(255).optional(),
      metadata: metadataSchema,
      extra: extraParamsSchema,
    },
  • Registration of lob_webhooks_update via registerTool helper inside the registerWebhookTools function. Uses mutate annotation preset.
    registerTool(server, {
      name: "lob_webhooks_update",
      annotations: { title: "Update a webhook", ...ToolAnnotationPresets.mutate },
      description:
        "Update a webhook's URL, event subscriptions, or description. Note: the `disabled` flag on the " +
        "response is Lob-managed (e.g. Lob auto-disables webhooks whose delivery URL consistently fails) " +
        "and is not settable by callers.",
      inputSchema: {
        id: WH_ID,
        url: z.string().url().optional(),
        event_types: z.array(z.string()).optional(),
        description: z.string().max(255).optional(),
        metadata: metadataSchema,
        extra: extraParamsSchema,
      },
      handler: async (args) => {
        const { id, extra, ...rest } = args;
        return lob.request({
          method: "POST",
          path: `/webhooks/${id}`,
          body: withExtra(rest, extra),
        });
      },
    });
  • Helper function withExtra used by the handler: merges extra parameters with typed fields, with typed fields taking precedence.
    export function withExtra(
      payload: object,
      extra: Record<string, unknown> | undefined,
    ): Record<string, unknown> {
      return { ...(extra ?? {}), ...compact(payload) };
    }
  • registerTool helper that wraps tool registration with consistent error handling and JSON content formatting.
    export function registerTool<TShape extends ZodRawShape>(
      server: McpServer,
      def: ToolDefinition<TShape>,
    ): void {
      const a = def.annotations ?? {};
      server.registerTool(
        def.name,
        {
          title: a.title ?? def.name,
          description: def.description,
          inputSchema: def.inputSchema,
          annotations: {
            ...a,
            // Lob is always external; default the hint accordingly.
            openWorldHint: a.openWorldHint ?? true,
          },
        },
        // The SDK's ToolCallback type is parameterised over the exact ZodRawShape and
        // resists the generic erasure here. The runtime contract (validated args in,
        // CallToolResult out) is correct, so we bridge the type boundary with `as never`.
        (async (args: unknown, serverCtx: unknown): Promise<CallToolResult> => {
          try {
            const result = await def.handler(args as never, serverCtx);
            return { content: [{ type: "text", text: stringifyResult(result) }] };
          } catch (err) {
            return {
              isError: true,
              content: [{ type: "text", text: formatErrorForTool(err) }],
            };
          }
        }) as never,
      );
    }
    
    function stringifyResult(value: unknown): string {
      if (value === undefined || value === null) return "(no content)";
      if (typeof value === "string") return value;
      try {
        return JSON.stringify(value, null, 2);
      } catch {
        // JSON.stringify throws on circular refs; safeStringify handles them via fallback.
        return safeStringify(value);
      }
    }
Behavior4/5

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

Annotations already indicate it is not read-only or destructive. The description adds crucial context about the disabled flag being Lob-managed and not settable by callers, which is valuable beyond the annotations.

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 with no redundancy. The first sentence states the function, and the second adds an important behavioral note. Every sentence is essential.

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

Completeness4/5

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

Given the tool complexity (6 parameters, no output schema), the description covers the key updateable fields and a critical behavioral note. It omits details about idempotency (hinted in annotations) and the extra parameter, but these are acceptable given the schema and reference link.

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

Parameters4/5

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

Schema coverage is 50%. The description clarifies the purpose of three parameters (url, event_types, description) that lack schema descriptions, compensating for the gap. Other parameters have adequate schema descriptions.

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 ('Update') and the resource ('webhook'), listing the specific attributes that can be updated (URL, event subscriptions, description). This distinguishes it from sibling tools like create, delete, get, and list.

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

Usage Guidelines3/5

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

The description implies usage for updating existing webhooks but lacks explicit guidance on when to use this tool versus alternatives (e.g., when to create instead). No exclusions or prerequisites are stated.

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/optimize-overseas/lob-mcp'

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