[
{ tool_name: 'gsc_page_metrics',
description: '[Search Console] Get aggregated search metrics for a specific page URL. ' \
'Returns total clicks, impressions, average CTR, and average position.',
params: {
type: 'object',
properties: {
page_url: { type: 'string', description: 'Full URL of the page (e.g., "https://www.warmlyyours.com/en-US/posts/my-article")' },
start_date: { type: 'string', description: 'Start date (YYYY-MM-DD format)' },
end_date: { type: 'string', description: 'End date (YYYY-MM-DD format)' }
},
required: %w[page_url start_date end_date]
},
execute: ->(page_url:, start_date:, end_date:, **_) {
client = Seo::GscApiClient.new
result = client.page_metrics(page_url: page_url, start_date: start_date, end_date: end_date)
(result || { message: 'No data found for this URL' }).to_json
} },
{ tool_name: 'gsc_page_queries',
description: '[Search Console] Get top search queries driving traffic to a specific page. ' \
'Shows which keywords people search for that lead to this page, with clicks, impressions, CTR, and position.',
params: {
type: 'object',
properties: {
page_url: { type: 'string', description: 'Full URL of the page' },
start_date: { type: 'string', description: 'Start date (YYYY-MM-DD format)' },
end_date: { type: 'string', description: 'End date (YYYY-MM-DD format, defaults to today)' },
limit: { type: 'integer', description: 'Max queries to return (default: 50)' }
},
required: %w[page_url start_date]
},
execute: ->(page_url:, start_date:, end_date: Date.today.to_s, limit: 50, **_) {
client = Seo::GscApiClient.new
results = client.page_queries(page_url: page_url, start_date: start_date, end_date: end_date, limit: limit.to_i)
Assistant::ChatToolBuilder.truncate_result(results.to_json)
} }
].freeze