get_blocked_urls
Retrieve a list of blocked pages or directories for a specific website using the Bing Webmaster Tools API to identify and manage access restrictions.
Instructions
Get a list of blocked pages/directories for a site.
Args: site_url: The URL of the site
Returns: List[BlockedUrl]: List of blocked URLs and their settings
Raises: BingWebmasterError: If blocked URLs cannot be retrieved
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| self | Yes | ||
| site_url | Yes |
Implementation Reference
- The generic wrapper function decorated with @mcp.tool() that serves as the MCP handler for get_blocked_urls (and other tools). It dynamically calls the underlying service 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:196-196 (registration)Specific registration of the 'get_blocked_urls' MCP tool by wrapping the 'blocking' service's 'get_blocked_urls' method.get_blocked_urls = wrap_service_method(mcp, service, "blocking", "get_blocked_urls") # noqa: F841
- mcp_server_bwt/main.py:17-17 (registration)Invokes the function that registers all Bing Webmaster tools, including 'get_blocked_urls'.add_bing_webmaster_tools(mcp, bing_service)
- Attaches the ContentBlockingService instance (containing get_blocked_urls method) to the BingWebmasterService as 'blocking'.self.blocking = content_blocking.ContentBlockingService(self.client)
- Maps the 'blocking' service attribute to its class for dynamic method lookup."blocking": content_blocking.ContentBlockingService,