create_block_list
Create a publisher block list to exclude specific publishers from your ad placements in Facebook and Instagram campaigns.
Instructions
Create a new publisher block list for the ad account.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name for the block list |
Implementation Reference
- src/tools/brand_safety.ts:30-45 (handler)The handler function for the create_block_list tool. It accepts a 'name' parameter and POSTs to the Meta Ads API endpoint /publisher_block_lists to create a new publisher 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 }; } } ); - src/tools/brand_safety.ts:33-35 (schema)Zod schema defining the input for create_block_list: a required string field 'name'.
{ name: z.string().describe("Name for the block list"), }, - src/tools/brand_safety.ts:5-5 (registration)Registration function that registers all brand safety tools (including create_block_list) on the MCP server.
export function registerBrandSafetyTools(server: McpServer, client: AdsClient): void { - src/index.ts:86-86 (registration)The call site where registerBrandSafetyTools is invoked in the main server setup.
registerBrandSafetyTools(server, client); - src/services/ads-client.ts:187-192 (helper)The AdsClient.post method used by the handler to send the POST request to the Meta Ads API.
async post( path: string, params?: Record<string, unknown> ): Promise<ClientResponse> { return this.request("POST", path, params); }