gam_pql_query
Run read-only PQL SELECT queries against Google Ad Manager Publisher Query Language tables to retrieve data not exposed by find tools, including targeting lookups.
Instructions
MODE: read-only. Run a PQL SELECT against GAM's Publisher Query Language tables (Line_Item incl. its full Targeting column for reverse targeting lookups, Ad_Unit, Placement, Programmatic_Buyer, Audience_Segment, Exchange_Rate, Browser, Device_Category, Mobile_Device, Time_Zone, Child_Publisher, MCM_Earnings, …). Column/table names are identifier-validated; literal VALUES must go in the values map (bind variables — quotes in where are rejected). OUTPUT: columns + row arrays; int64s beyond 2^53 stay strings. WHEN TO USE: data the 'find' tools don't expose, e.g. 'which line items target key X' (SELECT Id, Name, Targeting FROM Line_Item WHERE CustomTargeting LIKE …); struct columns like Targeting return as JSON. LIMITS: DateTime columns can't be filtered here (binds are text/number/boolean only); for paging beyond one page pass order_by — PQL row order is unstable without it. NOT for Change_History — use gam_change_history (it handles that table's special pagination rules).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"table": "<table>"
},
"name": "gam_pql_query"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Default 100, max 500. | |
| table | Yes | PQL table, e.g. Line_Item, Ad_Unit, Placement. | |
| where | No | WHERE clause without the keyword; NO quoted literals — reference binds like `status = :s`. | |
| offset | No | ||
| values | No | Bind variables referenced in `where` (LIKE patterns include % here, e.g. '%key=123%'). | |
| columns | No | Columns to select, e.g. ['Id','Name']. Omit only with describe=true. | |
| describe | No | DISCOVERY MODE: return the valid COLUMN NAMES for `table` instead of running a query. Do this first — PQL column names are not the REST field names and cannot be guessed. Costs one cheap API call. | |
| order_by | No | e.g. 'Id ASC'. | |
| network_code | No |