Query search analytics
search_analytics_queryRuns a Google Search Console Search Analytics query on the site’s connected property: clicks, impressions, CTR and average position, grouped by any dimensions and filtered like the Search Console API. Rows are Google’s raw data. To compare periods, query each period and compare the rows. To leave out site: and other search-operator queries by the rule the insight tools use, add a query filter with excludingRegex "(?i)(?:^|\s)-?(?:site|inurl|allinurl|intitle|allintitle|intext|allintext|related|cache|filetype|ext|before|after):\S". Page through large results with startRow and nextStartRow. When dataState is omitted only final data is returned, which usually leaves out the latest days. With dataState "all" or "hourly_all", metadata.firstIncompleteDate or firstIncompleteHour marks where data is not final yet; metadata is null otherwise.
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": {
"projectId": "<projectId>"
},
"name": "search_analytics_query"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | No | Search type. | web |
| endDate | No | Last day, YYYY-MM-DD. Defaults to two days ago, as Search Console data lags. | |
| rowLimit | No | ||
| startRow | No | ||
| dataState | No | "all" includes fresh, not yet final data. The hour dimension requires "hourly_all", which is used when omitted. | |
| projectId | Yes | Site to act on, from list_sites. Only its connected Search Console property is used. | |
| startDate | No | First day, YYYY-MM-DD. Defaults to 28 days ending on endDate. | |
| dimensions | No | Group rows by these, in order. Omit for property totals. | |
| aggregationType | No | "byProperty" is not allowed when grouping or filtering by page. | |
| dimensionFilterGroups | No |