Skip to main content
Glama
zizzfizzix

Bing Webmaster Tools MCP Server

by zizzfizzix

get_page_query_stats

Retrieve detailed traffic statistics for a specific webpage from Bing Webmaster Tools, showing query performance and search analytics data.

Instructions

Get detailed traffic statistics for a specific page.

Args: site_url: The URL of the site page: The specific page URL to get statistics for

Returns: List[QueryStats]: List of query statistics for the specified page

Raises: BingWebmasterError: If statistics cannot be retrieved

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selfYes
site_urlYes
pageYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Generic handler factory that creates and registers (@mcp.tool()) the tool handler for get_page_query_stats (and others) by inspecting the original service method signature, creating a wrapper that delegates execution to the BingWebmasterService.traffic.get_page_query_stats method, and preserving schema/docstring.
    def wrap_service_method(
        mcp: FastMCP, service: BingWebmasterService, service_attr: str, method_name: str
    ) -> Callable[..., Any]:
        """Helper function to wrap a service method with mcp.tool() while preserving its signature and docstring.
    
        Args:
            mcp: The MCP server instance
            service: The BingWebmasterService instance
            service_attr: The service attribute name (e.g., 'sites', 'submission')
            method_name: The method name to wrap
    
        Returns:
            The wrapped method as an MCP tool
        """
        # Get the service class from our mapping
        service_class = SERVICE_CLASSES[service_attr]
        # Get the original method
        original_method = getattr(service_class, method_name)
        # Get the signature
        sig = inspect.signature(original_method)
        # Remove 'self' parameter from signature
        parameters = list(sig.parameters.values())[1:]  # Skip 'self'
    
        # Create new signature without 'self'
        new_sig = sig.replace(parameters=parameters)
    
        # Create wrapper function with same signature
        @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
  • Specific registration of the "get_page_query_stats" tool by invoking the wrap_service_method factory with the appropriate service attribute ("traffic") and method name.
    get_page_query_stats = wrap_service_method(  # noqa: F841
        mcp, service, "traffic", "get_page_query_stats"
  • Initializes the BingWebmasterService instance required for all tools and calls add_bing_webmaster_tools to register all Bing Webmaster MCP tools, including get_page_query_stats.
    bing_service = BingWebmasterService(api_key=api_key)
    
    # Add the tools to the MCP server
    add_bing_webmaster_tools(mcp, bing_service)
  • Attaches the external TrafficAnalysisService instance as self.traffic on BingWebmasterService, which provides the underlying get_page_query_stats method implementation (delegated by the wrapper).
    self.traffic = traffic_analysis.TrafficAnalysisService(self.client)
  • Maps the service attribute name 'traffic' to TrafficAnalysisService class, used by wrap_service_method to get original method signature for schema preservation.
    "traffic": traffic_analysis.TrafficAnalysisService,
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions that it 'Returns: List[QueryStats]' and 'Raises: BingWebmasterError', which adds some context about outputs and errors. However, it doesn't describe critical behavioral traits such as whether this is a read-only operation, rate limits, authentication needs, or what 'QueryStats' entails. For a tool with no annotations, this leaves significant gaps in understanding its behavior.

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

Conciseness5/5

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

The description is appropriately sized and well-structured. It starts with a clear purpose statement, followed by sections for Args, Returns, and Raises. Each section is brief and to the point, with no wasted words. The front-loaded purpose makes it easy to understand quickly.

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

Completeness4/5

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

Given that there is an output schema (implied by 'Returns: List[QueryStats]'), the description doesn't need to detail return values. It covers the purpose, parameters, and error handling adequately. However, with no annotations and incomplete parameter documentation (missing 'self'), it could benefit from more behavioral context, such as read-only status or data source specifics, to be fully complete for a tool with three parameters.

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?

The schema description coverage is 0%, so the description must compensate. It adds meaning by explaining the parameters: 'site_url: The URL of the site' and 'page: The specific page URL to get statistics for'. However, it doesn't document the 'self' parameter mentioned in the schema, leaving one parameter unexplained. Since it covers 2 out of 3 parameters, it partially compensates for the low schema coverage.

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?

The description clearly states the tool's purpose: 'Get detailed traffic statistics for a specific page.' It specifies the verb ('Get') and resource ('traffic statistics for a specific page'), making the function unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'get_page_stats' or 'get_query_page_stats', which likely provide related statistics.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'get_page_stats' or 'get_query_page_stats', nor does it specify prerequisites or contexts for usage. The only implied usage is retrieving statistics for a page, but no exclusions or comparisons are provided.

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

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