Skip to main content
Glama

List campaigns

lob_campaigns_list
Read-onlyIdempotent

List Lob campaigns filtered by date or metadata. Answer 'how many campaigns?' in one call by passing include:['total_count'] with limit:1.

Instructions

List campaigns on your Lob account. For 'how many campaigns?' counts, pass include: ['total_count'] with limit: 1. Filter by date_created or metadata.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoHow many results to return (default 10, max 100).
beforeNoCursor for the previous page.
afterNoCursor for the next page.
includeNoResponse add-ons. Pass ['total_count'] alongside any filters and limit:1 to answer 'how many?' questions in a single call — far cheaper than paginating to count. Not accepted on nested order endpoints (buckslip/card orders) or /webhooks.
date_createdNoISO8601 date filter object with gt/gte/lt/lte keys, e.g. { gt: '2026-04-23T00:00:00Z' } for 'last 7 days'. Combine with include:['total_count'] and limit:1 for date-bounded counts.
metadataNoFilter by metadata key/value pairs.

Implementation Reference

  • The handler for lob_campaigns_list tool: calls lob.request with GET /campaigns and compacted query args (limit, before, after, include, date_created, metadata).
    registerTool(server, {
      name: "lob_campaigns_list",
      annotations: { title: "List campaigns", ...ToolAnnotationPresets.read },
      description:
        "List campaigns on your Lob account. **For 'how many campaigns?' counts, pass " +
        "`include: ['total_count']` with `limit: 1`.** Filter by `date_created` or `metadata`.",
      inputSchema: { ...listParamsSchema.shape },
      handler: async (args) =>
        lob.request({ method: "GET", path: "/campaigns", query: compact(args) }),
    });
  • listParamsSchema — the Zod schema used as inputSchema for lob_campaigns_list (spread as { ...listParamsSchema.shape }). Defines limit, before, after, include, date_created, metadata.
    export const listParamsSchema = z
      .object({
        limit: z
          .number()
          .int()
          .min(1)
          .max(100)
          .optional()
          .describe("How many results to return (default 10, max 100)."),
        before: z.string().optional().describe("Cursor for the previous page."),
        after: z.string().optional().describe("Cursor for the next page."),
        include: z
          .array(z.string())
          .optional()
          .describe(
            "Response add-ons. Pass ['total_count'] alongside any filters and limit:1 to answer 'how many?' " +
              "questions in a single call — far cheaper than paginating to count. " +
              "Not accepted on nested order endpoints (buckslip/card orders) or /webhooks.",
          ),
        date_created: dateFilterSchema.optional(),
        metadata: z
          .record(z.string())
          .optional()
          .describe("Filter by metadata key/value pairs."),
      })
      .describe("Common Lob list/pagination parameters.");
  • registerCampaignTools — the registration function that wires lob_campaigns_list (and all other campaign/creative tools) into the MCP server. Called by registerAllTools in register.ts.
    export function registerCampaignTools(server: McpServer, lob: LobClient): void {
      // ── Campaigns ──────────────────────────────────────────────────────────────
    
      registerTool(server, {
        name: "lob_campaigns_create",
        annotations: { title: "Create a campaign", ...ToolAnnotationPresets.mutate },
        description:
          "Create a campaign — a container for batched mail-piece sends with a shared creative, schedule, " +
          "and audience. Creating a campaign does not by itself send mail; you trigger sends per Lob docs.",
        inputSchema: {
          name: z.string().describe("Display name for the campaign."),
          description: z.string().max(500).optional(),
          schedule_type: z
            .enum(["immediate", "scheduled_send_date"])
            .optional()
            .describe("Whether the campaign should send immediately or on a schedule."),
          send_date: z
            .string()
            .optional()
            .describe("ISO 8601 timestamp for scheduled campaigns."),
          target_delivery_date: z.string().optional(),
          cancel_window_campaign_minutes: z
            .number()
            .int()
            .optional()
            .describe("Minutes before send during which the campaign can still be cancelled."),
          metadata: metadataSchema,
          extra: extraParamsSchema,
        },
        handler: async (args) => {
          const { extra, ...rest } = args;
          return lob.request({
            method: "POST",
            path: "/campaigns",
            body: withExtra(rest, extra),
          });
        },
      });
    
      registerTool(server, {
        name: "lob_campaigns_list",
        annotations: { title: "List campaigns", ...ToolAnnotationPresets.read },
        description:
          "List campaigns on your Lob account. **For 'how many campaigns?' counts, pass " +
          "`include: ['total_count']` with `limit: 1`.** Filter by `date_created` or `metadata`.",
        inputSchema: { ...listParamsSchema.shape },
        handler: async (args) =>
          lob.request({ method: "GET", path: "/campaigns", query: compact(args) }),
      });
  • Registration entry: registerCampaignTools(server, lob) called from registerAllTools, which wires the campaign tools including lob_campaigns_list into the server.
      registerTemplateTools(server, lob);
      registerCampaignTools(server, lob);
      registerUploadsTools(server, lob, tokenStore, pieceCounter);
      registerBankAccountTools(server, lob);
      registerWebhookTools(server, lob);
      registerSpecsResources(server);
    }
  • compact() helper used by the handler to strip undefined values from args before sending as query params.
    export function compact<T extends object>(obj: T): Partial<T> {
      const out: Record<string, unknown> = {};
      for (const [k, v] of Object.entries(obj)) {
        if (v !== undefined) out[k] = v;
      }
      return out as Partial<T>;
    }
Behavior4/5

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

Annotations already indicate read-only and idempotent. Description adds value by noting include parameter restrictions and the counting shortcut. Does not discuss pagination further, but schema covers it.

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 fluff. Main purpose front-loaded, optimization tip bolded. Every word earns its place.

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?

Covers main functionality and a key optimization. Lacks explanation of pagination flow, but schema documents cursors. No output schema, so response format not described, but adequate for typical use.

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 has 100% coverage, baseline 3. Description adds practical guidance for include and limit combination, and mentions filtering by date_created and metadata, improving usability.

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?

Clearly states 'List campaigns on your Lob account.' Specifies verb and resource, distinguishes from sibling CRUD tools. Mentions filtering options for added precision.

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?

Provides specific optimization tip for counting campaigns using include and limit. Does not explicitly contrast with alternatives like lob_campaigns_get, so no exclusion guidance.

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