gads_campaign_assets
Retrieve campaign-linked assets with field type and status to identify active extensions on specific campaigns.
Instructions
Assets linked to campaigns with field type and status. Shows which extensions are active on which campaigns.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| customer_id | No | Override GOOGLE_ADS_CUSTOMER_ID for this call | |
| campaign_id | No | Filter to a specific campaign ID |
Implementation Reference
- src/index.ts:158-163 (registration)Registration of the 'gads_campaign_assets' tool with server.tool(), linking the name, description, schema, and handler.
server.tool( "gads_campaign_assets", "Assets linked to campaigns with field type and status. Shows which extensions are active on which campaigns.", campaignAssetsSchema, async (args) => { try { return ok(await campaignAssets(args)); } catch (e) { return err(e); } } ); - src/tools/extensions.ts:35-38 (schema)Input schema for campaign_assets: optional customer_id and campaign_id filters.
export const campaignAssetsSchema = { customer_id: z.string().optional().describe("Override GOOGLE_ADS_CUSTOMER_ID for this call"), campaign_id: z.string().optional().describe("Filter to a specific campaign ID"), }; - src/tools/extensions.ts:40-62 (handler)Handler function 'campaignAssets' that queries campaign_asset data joined with campaign and asset info, filtered by campaign_id, returning status and field_type.
export async function campaignAssets(args: z.infer<z.ZodObject<typeof campaignAssetsSchema>>) { const customer = getCustomer(args.customer_id); const campaignClause = args.campaign_id ? `AND campaign.id = ${args.campaign_id}` : ""; const rows = await customer.query(` SELECT campaign.id, campaign.name, asset.id, asset.name, asset.type, asset.sitelink_asset.link_text, asset.callout_asset.callout_text, asset.structured_snippet_asset.header, campaign_asset.status, campaign_asset.field_type FROM campaign_asset WHERE campaign_asset.status != 'REMOVED' ${campaignClause} ORDER BY campaign.name LIMIT 500 `); return { rowCount: rows.length, rows }; } - src/tools/extensions.ts:2-2 (helper)Import of getCustomer helper used to obtain the Google Ads client.
import { getCustomer } from "../client.js";