Skip to main content
Glama

delete_budget_schedule

Remove a budget schedule permanently. This action cannot be undone.

Instructions

Delete a budget schedule. This action is irreversible.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
schedule_idYesBudget schedule ID to delete

Implementation Reference

  • The handler function for the 'delete_budget_schedule' tool. Takes a schedule_id parameter, sends a DELETE request to the Meta Ads API via client.delete(`/${schedule_id}`), and returns a success response. The tool description is 'Delete a budget schedule. This action is irreversible.'
    // ─── delete_budget_schedule ───────────────────────────────────
    server.tool(
      "delete_budget_schedule",
      "Delete a budget schedule. This action is irreversible.",
      {
        schedule_id: z.string().describe("Budget schedule ID to delete"),
      },
      async ({ schedule_id }) => {
        try {
          const { data, rateLimit } = await client.delete(`/${schedule_id}`);
          return { content: [{ type: "text" as const, text: JSON.stringify({ success: true, ...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 };
        }
      }
    );
  • Input schema for 'delete_budget_schedule' — requires a single 'schedule_id' string parameter describing the budget schedule ID to delete.
    {
      schedule_id: z.string().describe("Budget schedule ID to delete"),
  • Registration of the 'delete_budget_schedule' tool via server.tool() with the name 'delete_budget_schedule' inside the registerBudgetTools function.
    server.tool(
      "delete_budget_schedule",
      "Delete a budget schedule. This action is irreversible.",
  • The AdsClient.delete() helper method used by the handler. Delegates to the internal request() method with method 'DELETE', appending parameters as query string.
    async delete(
      path: string,
      params?: Record<string, unknown>
    ): Promise<ClientResponse> {
      return this.request("DELETE", path, params);
    }
  • The registerBudgetTools function that registers all budget tools (including delete_budget_schedule) on the MCP server. Called from src/index.ts at line 82.
    export function registerBudgetTools(server: McpServer, client: AdsClient): void {
      // ─── list_budget_schedules ────────────────────────────────────
      server.tool(
        "list_budget_schedules",
        "List ad budget schedules for the ad account. Returns paginated results.",
        {
          fields: z.string().optional().describe("Comma-separated fields to return"),
          limit: z.number().optional().default(25).describe("Number of results (default 25)"),
          after: z.string().optional().describe("Pagination cursor for next page"),
        },
        async ({ fields, limit, after }) => {
          try {
            const params: Record<string, unknown> = {};
            if (fields) params.fields = fields;
            if (limit) params.limit = limit;
            if (after) params.after = after;
            const { data, rateLimit } = await client.get(`${client.accountPath}/adbudgetschedules`, 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 };
          }
        }
      );
    
      // ─── create_budget_schedule ───────────────────────────────────
      server.tool(
        "create_budget_schedule",
        "Create a new ad budget schedule for the ad account.",
        {
          budget_value: z.string().describe("Budget amount in account currency cents"),
          budget_value_type: z.string().describe("Budget value type (e.g. ABSOLUTE, MULTIPLIER)"),
          time_start: z.string().describe("Schedule start time (ISO 8601 or Unix timestamp)"),
          time_end: z.string().describe("Schedule end time (ISO 8601 or Unix timestamp)"),
        },
        async ({ budget_value, budget_value_type, time_start, time_end }) => {
          try {
            const params: Record<string, unknown> = {
              budget_value,
              budget_value_type,
              time_start,
              time_end,
            };
            const { data, rateLimit } = await client.post(`${client.accountPath}/adbudgetschedules`, 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 };
          }
        }
      );
    
      // ─── update_budget_schedule ───────────────────────────────────
      server.tool(
        "update_budget_schedule",
        "Update an existing budget schedule. Only provided fields will be modified.",
        {
          schedule_id: z.string().describe("Budget schedule ID to update"),
          budget_value: z.string().optional().describe("New budget amount in account currency cents"),
          time_start: z.string().optional().describe("New schedule start time"),
          time_end: z.string().optional().describe("New schedule end time"),
        },
        async ({ schedule_id, budget_value, time_start, time_end }) => {
          try {
            const params: Record<string, unknown> = {};
            if (budget_value) params.budget_value = budget_value;
            if (time_start) params.time_start = time_start;
            if (time_end) params.time_end = time_end;
            const { data, rateLimit } = await client.post(`/${schedule_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 };
          }
        }
      );
    
      // ─── delete_budget_schedule ───────────────────────────────────
      server.tool(
        "delete_budget_schedule",
        "Delete a budget schedule. This action is irreversible.",
        {
          schedule_id: z.string().describe("Budget schedule ID to delete"),
        },
        async ({ schedule_id }) => {
          try {
            const { data, rateLimit } = await client.delete(`/${schedule_id}`);
            return { content: [{ type: "text" as const, text: JSON.stringify({ success: true, ...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 };
          }
        }
      );
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.2.0

TDQS

A3.8/5.0
Behavior3/5

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

With no annotations, the description must carry the full behavioral burden. It discloses a key trait—irreversibility—which is critical for a delete operation. However, it does not mention permissions, effects on linked resources, or what happens if the schedule is in use, leaving some behavioral gaps.

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 two sentences long, front-loaded with the action, and every word is purposeful. The irreversibility warning is concise yet meaningful, achieving maximum clarity in minimal space.

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?

For a simple delete operation with one parameter and no output schema, the description covers the essential purpose and a key consequence. It does not explain what a budget schedule is or prerequisites, but the sibling tools provide enough context to infer usage. Minor omissions like the return value or not-found behavior prevent a higher score.

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?

The schema already provides 100% coverage of the single parameter (schedule_id) with a clear description. The tool description adds no additional semantics about the parameter, so it meets the baseline but does not enhance understanding.

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 uses a specific verb ('Delete') and a clear resource ('budget schedule'), making the tool's purpose immediately obvious. It also adds the caveat 'irreversible' for emphasis, distinguishing it from create/update/list siblings without confusion.

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 (delete when you want to remove a budget schedule) but does not explicitly state when to use it versus alternatives or provide prerequisites. The irreversibility warning is a caution, not a usage guideline, so it falls short of clear context with exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools