gsc_performance_overview
Retrieve total clicks, impressions, average CTR, and average position for a specified site and date range.
Instructions
Summary of site performance (total clicks, impressions, avg CTR, avg position).
Args: site_url: Site URL (e.g. "https://example.com/" or "sc-domain:example.com"). date_from: Start date (YYYY-MM-DD). date_to: End date (YYYY-MM-DD).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| site_url | Yes | ||
| date_from | Yes | ||
| date_to | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- The handler function for the 'gsc_performance_overview' tool. It calls the Search Analytics API (no dimensions) to fetch aggregate metrics (clicks, impressions, CTR, avg position) for the given site and date range, and returns them as a JSON string.
@mcp.tool() def gsc_performance_overview(site_url: str, date_from: str, date_to: str) -> str: """Summary of site performance (total clicks, impressions, avg CTR, avg position). Args: site_url: Site URL (e.g. "https://example.com/" or "sc-domain:example.com"). date_from: Start date (YYYY-MM-DD). date_to: End date (YYYY-MM-DD). """ encoded = urllib.parse.quote(site_url, safe="") data = _api_post( f"{BASE}/sites/{encoded}/searchAnalytics/query", {"startDate": date_from, "endDate": date_to}, ) rows = data.get("rows", []) if not rows: return json.dumps({"clicks": 0, "impressions": 0, "ctr": "0.0000", "position": "0.0"}) row = rows[0] return json.dumps( { "clicks": row.get("clicks", 0), "impressions": row.get("impressions", 0), "ctr": f"{row.get('ctr', 0):.4f}", "position": f"{row.get('position', 0):.1f}", }, indent=2, ) - Docstring/type definitions for the tool's inputs (site_url: str, date_from: str, date_to: str).
"""Summary of site performance (total clicks, impressions, avg CTR, avg position). Args: site_url: Site URL (e.g. "https://example.com/" or "sc-domain:example.com"). date_from: Start date (YYYY-MM-DD). date_to: End date (YYYY-MM-DD). """ - src/google_search_console_mcp/server.py:155-155 (registration)The @mcp.tool() decorator that registers the function as an MCP tool with the FastMCP server.
@mcp.tool()