Skip to main content
Glama
zizzfizzix

Bing Webmaster Tools MCP Server

by zizzfizzix

get_keyword

Retrieve keyword impression data from Bing Webmaster Tools for specific queries, countries, languages, and date ranges to analyze search performance.

Instructions

Get keyword impressions for a selected period.

Args: query: The keyword query country: The country code language: The language code start_date: The start date of the period end_date: The end date of the period

Returns: Optional[Keyword]: Keyword impression data, or None if no data available

Raises: BingWebmasterError: If keyword data cannot be retrieved

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selfYes
queryYes
countryYes
languageYes
start_dateYes
end_dateYes

Implementation Reference

  • Handler logic for the 'get_keyword' tool: asynchronous wrapper function that executes the underlying keyword_analysis.KeywordAnalysisService.get_keyword method via the service instance.
    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)
  • Generates the input schema for the tool by inspecting and adapting the signature of the original service method (KeywordAnalysisService.get_keyword).
    # 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)
  • Registers the 'get_keyword' tool with the MCP server by creating and assigning the wrapped handler function.
    get_keyword = wrap_service_method(mcp, service, "keywords", "get_keyword")  # noqa: F841
  • Overall registration entry point: calls add_bing_webmaster_tools which includes the specific get_keyword registration.
    add_bing_webmaster_tools(mcp, bing_service)
  • Helper mapping that provides the KeywordAnalysisService class for 'keywords' service, used for method lookup and signature introspection.
    SERVICE_CLASSES = {
        "sites": site_management.SiteManagementService,
        "submission": submission.SubmissionService,
        "traffic": traffic_analysis.TrafficAnalysisService,
        "crawling": crawling.CrawlingService,
        "keywords": keyword_analysis.KeywordAnalysisService,
        "links": link_analysis.LinkAnalysisService,
        "content": content_management.ContentManagementService,
        "blocking": content_blocking.ContentBlockingService,
        "regional": regional_settings.RegionalSettingsService,
        "urls": url_management.UrlManagementService,
    }

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