Skip to main content
Glama
zizzfizzix

Bing Webmaster Tools MCP Server

by zizzfizzix

get_page_stats

Retrieve detailed traffic statistics for top pages of a specified website using the Bing Webmaster Tools API. Analyze query performance and page insights to optimize site visibility and user engagement.

Instructions

Get detailed traffic statistics for top pages.

Args: site_url: The URL of the site

Returns: List[QueryStats]: List of query statistics for top pages

Raises: BingWebmasterError: If statistics cannot be retrieved

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selfYes
site_urlYes

Implementation Reference

  • Registers the get_page_stats tool as an MCP tool by wrapping the traffic service's get_page_stats method.
    get_page_stats = wrap_service_method(mcp, service, "traffic", "get_page_stats") # noqa: F841
  • The handler function (wrapper) that is registered as the MCP tool. It calls the underlying Bing service method for get_page_stats.
    @mcp.tool() @wraps(original_method) async def wrapper(*args: Any, **kwargs: Any) -> Any: # Filter out any 'self' arguments that might be passed by the MCP client kwargs = {k: v for k, v in kwargs.items() if k != "self"} async with service as s: service_obj = getattr(s, service_attr) # Get the method from the instance method = getattr(service_obj, method_name) # Call the method directly - it's already bound to the instance return await method(*args, **kwargs) # Copy signature and docstring wrapper.__signature__ = new_sig # type: ignore wrapper.__doc__ = original_method.__doc__ return wrapper
  • Exposes the 'traffic' service attribute which contains the get_page_stats method.
    self.traffic = traffic_analysis.TrafficAnalysisService(self.client)
  • Invokes the addition of all Bing Webmaster tools to the MCP server, including get_page_stats.
    add_bing_webmaster_tools(mcp, bing_service)
  • The BingWebmasterService context manager that initializes the client and sub-services used by the tool handlers.
    class BingWebmasterService: def __init__(self, api_key: str) -> None: self.settings = Settings( api_key=SecretStr(api_key), base_url="https://ssl.bing.com/webmaster/api.svc/json", timeout=30, max_retries=3, rate_limit_calls=5, rate_limit_period=1, disable_destructive_operations=False, ) self.client: Optional[BingWebmasterClient] = None async def __aenter__(self) -> "BingWebmasterService": self.client = BingWebmasterClient(self.settings) await self.client.__aenter__() # Expose all services directly self.sites = site_management.SiteManagementService(self.client) self.submission = submission.SubmissionService(self.client) self.traffic = traffic_analysis.TrafficAnalysisService(self.client) self.crawling = crawling.CrawlingService(self.client) self.keywords = keyword_analysis.KeywordAnalysisService(self.client) self.links = link_analysis.LinkAnalysisService(self.client) self.content = content_management.ContentManagementService(self.client) self.blocking = content_blocking.ContentBlockingService(self.client) self.regional = regional_settings.RegionalSettingsService(self.client) self.urls = url_management.UrlManagementService(self.client) return self async def __aexit__( self, exc_type: Optional[type], exc_val: Optional[Exception], exc_tb: Optional[Any], ) -> None: if self.client: await self.client.__aexit__(exc_type, exc_val, exc_tb)

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/zizzfizzix/mcp-server-bwt'

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