Skip to main content
Glama
zizzfizzix

Bing Webmaster Tools MCP Server

by zizzfizzix

get_query_traffic_stats

Retrieve detailed traffic statistics for specific search queries from Bing Webmaster Tools to analyze query performance and optimize site visibility.

Instructions

Get detailed traffic statistics for a specific query.

Args: site_url: The URL of the site query: The search query to get statistics for

Returns: List[RankAndTrafficStats]: List of traffic statistics for the query

Raises: BingWebmasterError: If statistics cannot be retrieved

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selfYes
site_urlYes
queryYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Generic handler wrapper that executes all Bing Webmaster MCP tools, including get_query_traffic_stats. It dynamically creates an async function decorated with @mcp.tool(), adjusts the signature, and delegates to the corresponding service method (traffic.get_query_traffic_stats).
    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
  • Registers the 'get_query_traffic_stats' MCP tool by invoking wrap_service_method to create and decorate the handler function with @mcp.tool().
    get_query_traffic_stats = wrap_service_method(  # noqa: F841
        mcp, service, "traffic", "get_query_traffic_stats"
    )
  • Calls add_bing_webmaster_tools to register all Bing Webmaster tools on the MCP server, including get_query_traffic_stats.
    add_bing_webmaster_tools(mcp, bing_service)
  • Initializes the TrafficAnalysisService instance (self.traffic) used by the get_query_traffic_stats tool handler.
    self.traffic = traffic_analysis.TrafficAnalysisService(self.client)
  • Maps the 'traffic' service attribute to TrafficAnalysisService class for use in wrap_service_method to fetch original method signature.
    "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 'Raises: BingWebmasterError: If statistics cannot be retrieved,' which adds some error-handling context. However, it lacks details on permissions, rate limits, data freshness, or side effects (e.g., whether it's a read-only operation or has caching implications), which are critical for a tool interacting with a webmaster API.

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 well-structured with clear sections (Args, Returns, Raises) and uses bullet-like formatting. It is front-loaded with the core purpose and avoids unnecessary fluff. However, the omission of 'self' in Args and lack of sibling differentiation slightly reduce efficiency, but overall it is concise and organized.

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?

Given the tool's complexity (3 parameters, no annotations, but with an output schema), the description is moderately complete. The output schema likely covers return values, reducing the need for detailed output explanation. However, it lacks behavioral context (e.g., read-only nature, error conditions beyond BingWebmasterError) and does not fully address parameter semantics, leaving gaps for effective agent use.

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

Parameters3/5

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

Schema description coverage is 0%, meaning parameters are undocumented in the schema. The description lists 'site_url' and 'query' in the Args section, clarifying their purpose, but omits 'self' entirely. This adds value for two parameters but leaves one unexplained, resulting in partial compensation for the schema gap. The baseline is 3 due to moderate improvement over the schema.

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 query.' It specifies the verb ('Get'), resource ('traffic statistics'), and scope ('for a specific query'), which is clear and actionable. However, it does not explicitly differentiate from sibling tools like 'get_query_stats' or 'get_rank_and_traffic_stats', which appear related but have unspecified differences.

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 does not mention sibling tools like 'get_query_stats' or 'get_rank_and_traffic_stats', nor does it specify prerequisites, exclusions, or contextual cues for usage. The only implied usage is retrieving statistics for a query, but this is too vague for effective tool selection.

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