add_blocked_url
Block specific URLs or directories from Bing's search index to manage site visibility and remove unwanted content from search results.
Instructions
Add a blocked URL to a site.
Args: site_url: The URL of the site blocked_url: The URL to be blocked entity_type: The type of entity to block (Page or Directory) request_type: The type of request (CacheOnly or FullRemoval) date: The date the URL was blocked (default: minimum datetime)
Raises: BingWebmasterError: If URL cannot be blocked
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| self | Yes | ||
| site_url | Yes | ||
| blocked_url | Yes | ||
| entity_type | No | ||
| request_type | No | ||
| date | No |
Implementation Reference
- The wrapper function that serves as the MCP tool handler. It dynamically retrieves the 'blocking' service instance, gets the 'add_blocked_url' method, and calls it with the provided arguments.@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__
- mcp_server_bwt/tools/bing_webmaster.py:197-197 (registration)Specific registration of the 'add_blocked_url' tool by wrapping the corresponding service method.add_blocked_url = wrap_service_method(mcp, service, "blocking", "add_blocked_url") # noqa: F841
- mcp_server_bwt/main.py:16-17 (registration)Top-level invocation of the function that registers all Bing Webmaster tools, including 'add_blocked_url'.# Add the tools to the MCP server add_bing_webmaster_tools(mcp, bing_service)
- Initializes the ContentBlockingService instance (containing 'add_blocked_url') on the BingWebmasterService.self.blocking = content_blocking.ContentBlockingService(self.client)
- Mapping used by wrap_service_method to resolve service attribute names to their classes, including 'blocking'.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, }