Skip to main content
Glama

Update a campaign

lob_campaigns_update
Idempotent

Modify campaign metadata, name, description, or send schedule before the campaign is sent. Supports custom parameters via Lob API.

Instructions

Update a campaign's metadata or schedule before it has been sent.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesCampaign ID (`cmp_…`).
nameNo
descriptionNo
send_dateNo
target_delivery_dateNo
cancel_window_campaign_minutesNo
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

  • The handler function for lob_campaigns_update. It destructures args to extract 'id' and 'extra', then sends a PATCH request to /campaigns/{id} with the remaining fields merged via withExtra().
    handler: async (args) => {
      const { id, extra, ...rest } = args;
      return lob.request({
        method: "PATCH",
        path: `/campaigns/${id}`,
        body: withExtra(rest, extra),
      });
    },
  • Input schema for lob_campaigns_update: id (regex ^cmp_), optional name, description (max 500), send_date, target_delivery_date, cancel_window_campaign_minutes, metadata, and extra escape hatch.
    inputSchema: {
      id: CAMPAIGN_ID,
      name: z.string().optional(),
      description: z.string().max(500).optional(),
      send_date: z.string().optional(),
      target_delivery_date: z.string().optional(),
      cancel_window_campaign_minutes: z.number().int().optional(),
      metadata: metadataSchema,
      extra: extraParamsSchema,
    },
  • Registration of the tool via registerTool() with name 'lob_campaigns_update', annotations for mutating operations, and the handler.
    registerTool(server, {
      name: "lob_campaigns_update",
      annotations: { title: "Update a campaign", ...ToolAnnotationPresets.mutate },
      description: "Update a campaign's metadata or schedule before it has been sent.",
      inputSchema: {
        id: CAMPAIGN_ID,
        name: z.string().optional(),
        description: z.string().max(500).optional(),
        send_date: z.string().optional(),
        target_delivery_date: z.string().optional(),
        cancel_window_campaign_minutes: z.number().int().optional(),
        metadata: metadataSchema,
        extra: extraParamsSchema,
      },
      handler: async (args) => {
        const { id, extra, ...rest } = args;
        return lob.request({
          method: "PATCH",
          path: `/campaigns/${id}`,
          body: withExtra(rest, extra),
        });
      },
    });
  • The tool is registered as part of registerCampaignTools(server, lob) call in the central registration entry point.
      registerCampaignTools(server, lob);
      registerUploadsTools(server, lob, tokenStore, pieceCounter);
      registerBankAccountTools(server, lob);
      registerWebhookTools(server, lob);
      registerSpecsResources(server);
    }
  • The registerTool helper function that wraps the tool definition and registers it with the MCP server, with error handling and result serialization.
    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,
      );
    }
Behavior3/5

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

The description correctly implies mutation (consistent with readOnlyHint=false). Annotations already convey idempotency and non-destructiveness. The 'before it has been sent' constraint adds useful context beyond annotations, but no further behavioral traits (e.g., error handling, partial update behavior) are disclosed.

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?

The description is a single, front-loaded sentence with no redundancy. Every word earns its place, clearly conveying the core purpose and a key constraint.

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?

For a tool with 8 parameters (including nested objects), no output schema, and low schema coverage, the description should provide more context about return values, error conditions, parameter usage, or the update semantics (e.g., partial vs full replacement). It only covers the basic purpose and one temporal constraint.

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

Parameters2/5

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

Schema description coverage is low (38%). The description mentions 'metadata or schedule' but does not map these to specific parameters or explain their formats, defaults, or interactions. Even though purpose hints at relevant fields, the description does not compensate for the sparse 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'), the resource ('a campaign'), and the scope ('metadata or schedule before it has been sent'). 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 Guidelines4/5

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

The description provides a critical usage condition ('before it has been sent'), implying that the tool should not be used for sent campaigns. It does not explicitly list alternatives or exclusions, but the condition is clear and helpful.

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