Skip to main content
Glama

update_campaign

Modify existing Facebook ad campaigns by updating only specified fields such as name, status, budget, or schedule, leaving other settings unchanged.

Instructions

Update an existing campaign. Only provided fields will be modified.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
campaign_idYesCampaign ID to update
nameNoNew campaign name
statusNoNew status: ACTIVE, PAUSED, DELETED, ARCHIVED
daily_budgetNoNew daily budget in currency cents
lifetime_budgetNoNew lifetime budget in currency cents
start_timeNoNew start time (ISO 8601)
stop_timeNoNew stop time (ISO 8601)

Implementation Reference

  • The full tool definition including both schema (input validation with Zod) and handler (async function that builds params from optional fields and POSTs to /{campaign_id})
    // ─── update_campaign ───────────────────────────────────────
    server.tool(
      "update_campaign",
      "Update an existing campaign. Only provided fields will be modified.",
      {
        campaign_id: z.string().describe("Campaign ID to update"),
        name: z.string().optional().describe("New campaign name"),
        status: z.string().optional().describe("New status: ACTIVE, PAUSED, DELETED, ARCHIVED"),
        daily_budget: z.string().optional().describe("New daily budget in currency cents"),
        lifetime_budget: z.string().optional().describe("New lifetime budget in currency cents"),
        start_time: z.string().optional().describe("New start time (ISO 8601)"),
        stop_time: z.string().optional().describe("New stop time (ISO 8601)"),
      },
      async ({ campaign_id, name, status, daily_budget, lifetime_budget, start_time, stop_time }) => {
        try {
          const params: Record<string, unknown> = {};
          if (name) params.name = name;
          if (status) params.status = status;
          if (daily_budget) params.daily_budget = daily_budget;
          if (lifetime_budget) params.lifetime_budget = lifetime_budget;
          if (start_time) params.start_time = start_time;
          if (stop_time) params.stop_time = stop_time;
          const { data, rateLimit } = await client.post(`/${campaign_id}`, params);
          return { content: [{ type: "text" as const, text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] };
        } catch (error) {
          return { content: [{ type: "text" as const, text: `Failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
        }
      }
    );
  • Zod schema defining input validation: required campaign_id string, optional name, status, daily_budget, lifetime_budget, start_time, stop_time
    {
      campaign_id: z.string().describe("Campaign ID to update"),
      name: z.string().optional().describe("New campaign name"),
      status: z.string().optional().describe("New status: ACTIVE, PAUSED, DELETED, ARCHIVED"),
      daily_budget: z.string().optional().describe("New daily budget in currency cents"),
      lifetime_budget: z.string().optional().describe("New lifetime budget in currency cents"),
      start_time: z.string().optional().describe("New start time (ISO 8601)"),
      stop_time: z.string().optional().describe("New stop time (ISO 8601)"),
    },
  • Tool registered on MCP server via server.tool() with name 'update_campaign' inside registerCampaignTools()
    server.tool(
      "update_campaign",
      "Update an existing campaign. Only provided fields will be modified.",
      {
        campaign_id: z.string().describe("Campaign ID to update"),
        name: z.string().optional().describe("New campaign name"),
        status: z.string().optional().describe("New status: ACTIVE, PAUSED, DELETED, ARCHIVED"),
        daily_budget: z.string().optional().describe("New daily budget in currency cents"),
        lifetime_budget: z.string().optional().describe("New lifetime budget in currency cents"),
        start_time: z.string().optional().describe("New start time (ISO 8601)"),
        stop_time: z.string().optional().describe("New stop time (ISO 8601)"),
      },
      async ({ campaign_id, name, status, daily_budget, lifetime_budget, start_time, stop_time }) => {
        try {
          const params: Record<string, unknown> = {};
          if (name) params.name = name;
          if (status) params.status = status;
          if (daily_budget) params.daily_budget = daily_budget;
          if (lifetime_budget) params.lifetime_budget = lifetime_budget;
          if (start_time) params.start_time = start_time;
          if (stop_time) params.stop_time = stop_time;
          const { data, rateLimit } = await client.post(`/${campaign_id}`, params);
          return { content: [{ type: "text" as const, text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] };
        } catch (error) {
          return { content: [{ type: "text" as const, text: `Failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
        }
      }
    );
  • The AdsClient.post() convenience method used by the handler to make the POST request to Meta Ads API
    async post(
      path: string,
      params?: Record<string, unknown>
    ): Promise<ClientResponse> {
      return this.request("POST", path, params);
    }
Behavior3/5

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

No annotations provided, so description carries full burden. It discloses that only provided fields are modified, but fails to mention permissions, error handling, idempotency, or response behavior. This is minimal transparency.

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. Action verb is front-loaded, and the partial update qualifier is given immediately. Excellent conciseness.

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?

For a simple update tool with 7 parameters and no output schema, the description is adequate but could be richer. Missing details like return value, error cases, or required permissions. The schema provides sufficient parameter documentation, but context is minimal.

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 covers 100% of parameters with descriptions. The description adds value by explaining partial update semantics ('only provided fields will be modified'), which is not explicit in the schema. This justifies above baseline.

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?

Description explicitly states 'Update an existing campaign' with clear verb and resource. The phrase 'Only provided fields will be modified' distinguishes it from create/delete and clarifies partial update behavior.

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?

No explicit when-to-use or alternatives are mentioned. However, sibling tools like create_campaign and delete_campaign imply the appropriate context. The description lacks guidance on when not to use this tool.

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/mikusnuz/meta-ads-mcp'

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