add_page_preview_block
Block specific URLs from appearing in Bing search previews to control content visibility and manage user experience on your website.
Instructions
Add a page preview block.
Args: site_url: The URL of the site url: The URL to block from page preview reason: The reason for blocking the page preview
Raises: BingWebmasterError: If preview block cannot be added
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| self | Yes | ||
| site_url | Yes | ||
| url | Yes | ||
| reason | Yes |
Implementation Reference
- Generic async wrapper function decorated as MCP tool that executes the underlying BingWebmasterService.blocking.add_page_preview_block method.# 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
- mcp_server_bwt/tools/bing_webmaster.py:204-206 (registration)Specific registration of the 'add_page_preview_block' tool by wrapping the content_blocking service method.add_page_preview_block = wrap_service_method( # noqa: F841 mcp, service, "blocking", "add_page_preview_block" )
- mcp_server_bwt/main.py:17-17 (registration)Top-level call to register all Bing Webmaster tools, including 'add_page_preview_block'.add_bing_webmaster_tools(mcp, bing_service)
- Instantiates the ContentBlockingService instance (self.blocking) that provides the add_page_preview_block method.self.blocking = content_blocking.ContentBlockingService(self.client)
- Maps 'blocking' service attribute to ContentBlockingService class for dynamic access."blocking": content_blocking.ContentBlockingService,