get_keyword_stats
Retrieve historical keyword performance data from Bing Webmaster Tools to analyze search trends and optimize website content.
Instructions
Get historical statistics for a specific keyword.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| site_url | Yes | ||
| query | Yes | ||
| country | No | ||
| language | No |
Implementation Reference
- mcp_server_bwt/main.py:691-722 (handler)The complete handler and registration for the 'get_keyword_stats' tool. It constructs parameters and makes an API request to Bing Webmaster Tools' GetKeywordStats endpoint, then ensures MCP type compatibility.@mcp.tool( name="get_keyword_stats", description="Get historical statistics for a specific keyword.", ) async def get_keyword_stats( site_url: Annotated[str, "The URL of the site"], query: Annotated[str, "The keyword/query to analyze"], country: Annotated[str, "Country code (e.g., 'US', 'GB')"] = "", language: Annotated[str, "Language code (e.g., 'en', 'fr')"] = "", ) -> Dict[str, Any]: """ Get historical statistics for a specific keyword. Args: site_url: The URL of the site query: The keyword/query to analyze country: Country code (optional) language: Language code (optional) Returns: Historical keyword statistics """ async with api: params = f"siteUrl={site_url}&query={query}" if country: params += f"&country={country}" if language: params += f"&language={language}" stats = await api._make_request(f"GetKeywordStats?{params}") return api._ensure_type_field(stats, "KeywordStats")