Skip to main content
Glama
ZLeventer

google-ads-mcp

gads_budget_pacing

Monitor campaign budget pacing by comparing actual cost to budget, identifying over- and under-spending campaigns with utilization percentages for any date range.

Instructions

Cost vs budget per campaign for the specified period with utilization percentage. Flags over- and under-pacing campaigns. Default last 28 days.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
customer_idNoOverride GOOGLE_ADS_CUSTOMER_ID for this call
start_dateNoStart date: YYYY-MM-DD, NdaysAgo, yesterday, or today28daysAgo
end_dateNoEnd date: YYYY-MM-DD, NdaysAgo, yesterday, or todayyesterday

Implementation Reference

  • The budgetPacing async function that executes the tool logic. It queries Google Ads for campaign cost vs budget data, computes utilization percentages (spent/budget * 100), and returns enriched rows with pacing info.
    export async function budgetPacing(args: z.infer<z.ZodObject<typeof budgetPacingSchema>>) {
      const customer = getCustomer(args.customer_id);
      const start = resolveDate(args.start_date);
      const end = resolveDate(args.end_date);
      const rows = await customer.query(`
        SELECT
          campaign.id,
          campaign.name,
          campaign.status,
          campaign_budget.id,
          campaign_budget.name,
          campaign_budget.amount_micros,
          campaign_budget.delivery_method,
          campaign_budget.period,
          metrics.cost_micros
        FROM campaign
        WHERE segments.date BETWEEN '${start}' AND '${end}'
          AND campaign.status = 'ENABLED'
        ORDER BY metrics.cost_micros DESC
        LIMIT 200
      `);
      const enriched = rows.map((r: any) => {
        const budget = microsToDollars(r.campaign_budget?.amount_micros);
        const spent = microsToDollars(r.metrics?.cost_micros);
        const pct = budget > 0 ? (spent / budget) * 100 : null;
        return {
          ...r,
          pacing: {
            budget_dollars: budget,
            spent_dollars: spent,
            utilization_pct: pct !== null ? Number(pct.toFixed(1)) : null,
          },
        };
      });
      return { rowCount: enriched.length, rows: enriched };
    }
  • Input schema for the budgetPacing tool, defining optional customer_id, start_date (default 28daysAgo), and end_date (default yesterday) with Zod validation.
    export const budgetPacingSchema = {
      customer_id: z.string().optional().describe("Override GOOGLE_ADS_CUSTOMER_ID for this call"),
      start_date: z.string().default(DEFAULT_START).describe("Start date: YYYY-MM-DD, NdaysAgo, yesterday, or today"),
      end_date: z.string().default(DEFAULT_END).describe("End date: YYYY-MM-DD, NdaysAgo, yesterday, or today"),
    };
  • src/index.ts:220-225 (registration)
    Registration of the 'gads_budget_pacing' tool on the MCP server with its description, schema, and handler wrapper.
    server.tool(
      "gads_budget_pacing",
      "Cost vs budget per campaign for the specified period with utilization percentage. Flags over- and under-pacing campaigns. Default last 28 days.",
      budgetPacingSchema,
      async (args) => { try { return ok(await budgetPacing(args)); } catch (e) { return err(e); } }
    );
  • Helper function microsToDollars used to convert Google Ads micros (smallest currency unit) to dollars.
    function microsToDollars(micros: number | string | undefined): number {
      const n = Number(micros ?? 0);
      return Number.isFinite(n) ? n / 1_000_000 : 0;
    }
  • Default date constants (DEFAULT_START='28daysAgo', DEFAULT_END='yesterday') and resolveDate helper used by the handler to parse date strings.
    export const DEFAULT_START = "28daysAgo";
    export const DEFAULT_END = "yesterday";
    
    export function resolveDate(d: string): string {
      if (/^\d{4}-\d{2}-\d{2}$/.test(d)) return d;
      if (d === "today") return toISO(new Date());
      if (d === "yesterday") return toISO(offsetDays(new Date(), -1));
      const m = d.match(/^(\d+)daysAgo$/);
      if (m) return toISO(offsetDays(new Date(), -parseInt(m[1], 10)));
      throw new GoogleAdsError(`Unrecognized date: ${d}. Use YYYY-MM-DD, today, yesterday, or NdaysAgo.`);
    }
    
    function offsetDays(d: Date, n: number): Date {
      const out = new Date(d);
      out.setUTCDate(out.getUTCDate() + n);
      return out;
    }
    
    function toISO(d: Date): string {
      return d.toISOString().slice(0, 10);
    }
Behavior2/5

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

No annotations are provided, so the description must disclose behavioral traits. It mentions flagging over- and under-pacing but does not clarify whether the tool is read-only, what thresholds are used, or any side effects. The safety profile is unclear.

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 redundant words, front-loaded with the key output. Every sentence adds value.

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 no output schema, the description adequately explains the return (cost vs budget, utilization, flags). It could mention whether results are per campaign or aggregated, but is mostly complete for a reporting tool.

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?

Input schema covers all 3 parameters with descriptions. The description adds minor value by stating 'Default last 28 days', which is already implicit in the schema defaults. No additional meaning beyond schema.

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 tool compares cost vs budget per campaign, calculates utilization percentage, and flags over- and under-pacing. This specific verb+resource combination distinguishes it from siblings like gads_campaign_performance or gads_list_campaigns.

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 budget pacing analysis with a default period, but does not explicitly state when to use this tool versus siblings or when not to use it. No alternatives or exclusions are mentioned.

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/ZLeventer/google-ads-mcp'

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