Skip to main content
Glama
acamolese

Google Search Console Audit MCP

gsc_query

Retrieve top search queries and pages with performance metrics from Google Search Console for a specified site and date range, customizable by dimensions like device or country.

Instructions

Search Console performance report (top queries and pages with metrics).

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). dimensions: Comma-separated dimensions (query, page, country, device, date). row_limit: Maximum rows (default 100, max 25000).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
site_urlYes
date_fromYes
date_toYes
dimensionsNoquery
row_limitNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'gsc_query' tool. Calls the Google Search Console Search Analytics API to fetch performance data (clicks, impressions, CTR, position) grouped by user-specified dimensions (query, page, country, device, date). Returns formatted JSON results.
    @mcp.tool()
    def gsc_query(
        site_url: str,
        date_from: str,
        date_to: str,
        dimensions: str = "query",
        row_limit: int = 100,
    ) -> str:
        """Search Console performance report (top queries and pages with metrics).
    
        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).
            dimensions: Comma-separated dimensions (query, page, country, device, date).
            row_limit: Maximum rows (default 100, max 25000).
        """
        encoded = urllib.parse.quote(site_url, safe="")
        dims = [d.strip() for d in dimensions.split(",")]
        data = _api_post(
            f"{BASE}/sites/{encoded}/searchAnalytics/query",
            {
                "startDate": date_from,
                "endDate": date_to,
                "dimensions": dims,
                "rowLimit": min(row_limit, 25000),
            },
        )
        results = []
        for row in data.get("rows", []):
            entry = {}
            for i, dim in enumerate(dims):
                entry[dim] = row["keys"][i]
            entry["clicks"] = row.get("clicks", 0)
            entry["impressions"] = row.get("impressions", 0)
            entry["ctr"] = f"{row.get('ctr', 0):.4f}"
            entry["position"] = f"{row.get('position', 0):.1f}"
            results.append(entry)
        return json.dumps(results, indent=2, ensure_ascii=False)
  • Registration of gsc_query as an MCP tool via the @mcp.tool() decorator on line 114. (The decorator itself is at line 102 for the prior tool; gsc_query uses the same @mcp.tool() pattern on line 114.)
    @mcp.tool()
    def gsc_site_details(site_url: str) -> str:
  • The _api_post helper function used by gsc_query to POST JSON to the Google Webmasters API with OAuth Bearer token authentication.
    def _api_post(url: str, body: dict) -> dict:
        data = json.dumps(body).encode()
        req = urllib.request.Request(
            url,
            data=data,
            headers={
                "Authorization": f"Bearer {_get_token()}",
                "Content-Type": "application/json",
            },
        )
        with urllib.request.urlopen(req) as resp:
            return json.loads(resp.read())
  • The FastMCP server instance (mcp) used by @mcp.tool() to register gsc_query as a tool.
    from mcp.server.fastmcp import FastMCP
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, and the description does not disclose behavioral traits such as rate limits, authentication requirements, or side effects. It only describes parameters without context on tool behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is structured as a clear list of parameter definitions with defaults and examples. It is mostly concise, though the 'Args:' section could be slightly more compact.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return value explanation is not required. However, with no annotations, the description lacks behavioral context (e.g., pagination, response format). Adequate for a straightforward query tool but could be more complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description carries full burden. It adds meaningful context: site_url format examples, date format, dimensions list, row_limit default and max. This significantly aids in correct parameter usage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description states it provides a 'Search Console performance report (top queries and pages with metrics)', making the purpose clear. However, it does not differentiate from sibling tools like gsc_audit or gsc_performance_overview, which may also query performance data.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives. The description only explains what the tool does, not when to choose it over others such as gsc_audit or gsc_performance_overview.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/acamolese/google-search-console-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server