get_query_stats
Retrieve detailed traffic statistics for top search queries from Bing Webmaster Tools to analyze website performance and optimize content.
Instructions
Get detailed traffic statistics for top queries.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| site_url | Yes |
Implementation Reference
- mcp_server_bwt/main.py:199-202 (registration)Registers the 'get_query_stats' tool with the MCP server using the @mcp.tool decorator, specifying the name and description.@mcp.tool( name="get_query_stats", description="Get detailed traffic statistics for top queries.", )
- mcp_server_bwt/main.py:203-218 (handler)The main handler function for the 'get_query_stats' tool. It accepts a site_url parameter, uses the BingWebmasterAPI to make a request to the 'GetQueryStats' endpoint, processes the response by adding the appropriate __type field for MCP compatibility, and returns a list of query statistics including clicks, impressions, CTR, and average position.async def get_query_stats( site_url: Annotated[str, "The URL of the site"] ) -> List[Dict[str, Any]]: """ Get detailed traffic statistics for top queries. Args: site_url: The URL of the site Returns: List of query statistics with clicks, impressions, CTR, and position """ async with api: stats = await api._make_request(f"GetQueryStats?siteUrl={site_url}") return api._ensure_type_field(stats, "QueryStats")