Skip to main content
Glama

Retrieve a campaign

lob_campaigns_get
Read-onlyIdempotent

Retrieve campaign details by ID. Use this tool to get specific campaign information for managing your Lob mailing campaigns.

Instructions

Retrieve a single campaign by ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesCampaign ID (`cmp_…`).

Implementation Reference

  • The function registerCampaignTools registers all campaign tools via registerTool(). The lob_campaigns_get tool is registered at lines 74-80.
    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) }),
      });
    
      registerTool(server, {
        name: "lob_campaigns_get",
        annotations: { title: "Retrieve a campaign", ...ToolAnnotationPresets.read },
        description: "Retrieve a single campaign by ID.",
        inputSchema: { id: CAMPAIGN_ID },
        handler: async ({ id }) => lob.request({ method: "GET", path: `/campaigns/${id}` }),
      });
  • The handler for lob_campaigns_get: an async function that takes { id } and performs a GET request to /campaigns/{id} using the Lob client.
    registerTool(server, {
      name: "lob_campaigns_get",
      annotations: { title: "Retrieve a campaign", ...ToolAnnotationPresets.read },
      description: "Retrieve a single campaign by ID.",
      inputSchema: { id: CAMPAIGN_ID },
      handler: async ({ id }) => lob.request({ method: "GET", path: `/campaigns/${id}` }),
    });
  • CAMPAIGN_ID zod schema: validates campaign IDs matching the regex /^cmp_/ with description 'Campaign ID (cmp_…)'.
    const CAMPAIGN_ID = z.string().regex(/^cmp_/).describe("Campaign ID (`cmp_…`).");
  • Input schema for lob_campaigns_get: { id: CAMPAIGN_ID }, requiring a single campaign ID starting with 'cmp_'.
    inputSchema: { id: CAMPAIGN_ID },
  • Import of registerCampaignTools in the central registration entry point.
    import { registerCampaignTools } from "./campaigns.js";
Behavior3/5

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

Annotations already provide readOnlyHint, destructiveHint, idempotentHint. Description adds no extra behavioral context (e.g., auth, rate limits). No contradiction.

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?

Single sentence with no redundancy. Efficiently conveys purpose.

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

Completeness3/5

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

Simple tool with one param, but no output schema and no mention of return value format or usage context relative to siblings. Adequate but not enriched.

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 coverage is 100%. Description only restates that it retrieves by ID, adding no new meaning beyond the schema's parameter description.

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?

Clear verb ('Retrieve'), specific resource ('campaign'), and scope ('single by ID'). Distinguishes from sibling list tool.

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?

Implied usage: use when you have a campaign ID. No explicit when-to-use or when-not-to-use compared to list or other tools.

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