Skip to main content
Glama

delete_block_list

Delete a publisher block list permanently to remove outdated or unwanted lists from your ad account.

Instructions

Delete a publisher block list. This action is irreversible.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
list_idYesBlock list ID to delete

Implementation Reference

  • The async handler that executes the delete_block_list tool logic. It takes a list_id, calls client.delete(`/${list_id}`) to delete the block list, and returns a success/error response.
      async ({ list_id }) => {
        try {
          const { data, rateLimit } = await client.delete(`/${list_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 validation schema for delete_block_list, requiring a single string parameter 'list_id' described as 'Block list ID to delete'.
    {
      list_id: z.string().describe("Block list ID to delete"),
    },
  • Registration of the 'delete_block_list' tool via server.tool() with description 'Delete a publisher block list. This action is irreversible.'
    server.tool(
      "delete_block_list",
      "Delete a publisher block list. This action is irreversible.",
      {
        list_id: z.string().describe("Block list ID to delete"),
      },
      async ({ list_id }) => {
        try {
          const { data, rateLimit } = await client.delete(`/${list_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 };
        }
      }
    );
  • The containing function registerBrandSafetyTools() that is called from src/index.ts (line 86) to register this tool on the MCP server.
    export function registerBrandSafetyTools(server: McpServer, client: AdsClient): void {
      // ─── list_block_lists ─────────────────────────────────────────
      server.tool(
        "list_block_lists",
        "List publisher block lists 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}/publisher_block_lists`, 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_block_list ────────────────────────────────────────
      server.tool(
        "create_block_list",
        "Create a new publisher block list for the ad account.",
        {
          name: z.string().describe("Name for the block list"),
        },
        async ({ name }) => {
          try {
            const params: Record<string, unknown> = { name };
            const { data, rateLimit } = await client.post(`${client.accountPath}/publisher_block_lists`, 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 };
          }
        }
      );
    
      // ─── add_to_block_list ────────────────────────────────────────
      server.tool(
        "add_to_block_list",
        "Add publisher URLs to an existing block list.",
        {
          list_id: z.string().describe("Block list ID"),
          urls: z.string().describe("JSON array of URLs to block (e.g. '[\"example.com\",\"bad-site.com\"]')"),
        },
        async ({ list_id, urls }) => {
          try {
            const params: Record<string, unknown> = { urls };
            const { data, rateLimit } = await client.post(`/${list_id}/publisher_urls`, 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 };
          }
        }
      );
    
      // ─── remove_from_block_list ───────────────────────────────────
      server.tool(
        "remove_from_block_list",
        "Remove publisher URLs from an existing block list.",
        {
          list_id: z.string().describe("Block list ID"),
          urls: z.string().describe("JSON array of URLs to remove (e.g. '[\"example.com\"]')"),
        },
        async ({ list_id, urls }) => {
          try {
            const { data, rateLimit } = await client.delete(`/${list_id}/publisher_urls`, { urls });
            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 };
          }
        }
      );
    
      // ─── delete_block_list ────────────────────────────────────────
      server.tool(
        "delete_block_list",
        "Delete a publisher block list. This action is irreversible.",
        {
          list_id: z.string().describe("Block list ID to delete"),
        },
        async ({ list_id }) => {
          try {
            const { data, rateLimit } = await client.delete(`/${list_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 };
          }
        }
      );
Behavior3/5

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

States 'This action is irreversible,' which is a key behavioral trait beyond the schema. However, no annotations exist, so description carries full burden—missing details like permission requirements or side effects.

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 zero redundancy. Critical information (purpose + irreversibility) is front-loaded and to the point.

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 single-parameter delete tool with no output schema, the description covers purpose and irreversibility adequately. Could mention return value or error cases, but not essential given simplicity.

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 provides 100% coverage for list_id with description 'Block list ID to delete'. Description adds no additional meaning, so baseline score of 3 is appropriate.

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 clearly states 'Delete a publisher block list' – specific verb and resource. Among siblings like create_block_list and add_to_block_list, 'delete' uniquely identifies the destructive operation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives (e.g., remove_from_block_list or other delete tools). No context about prerequisites or conditions.

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