remove_site
Remove a site from Bing Webmaster Tools to stop tracking and management of that URL in your account.
Instructions
Remove a site from Bing Webmaster Tools.
Args: site_url: The URL of the site to remove
Raises: BingWebmasterError: If the site cannot be removed
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| self | Yes | ||
| site_url | Yes |
Implementation Reference
- Core handler logic for the 'remove_site' tool (shared with all tools): wraps and executes the underlying SiteManagementService.remove_site method via the BingWebmasterService instance.# 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__
- Dynamically extracts and adapts the input schema from the original service method signature for the MCP tool.# 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)
- mcp_server_bwt/tools/bing_webmaster.py:88-88 (registration)Registers the 'remove_site' tool on the MCP server instance.remove_site = wrap_service_method(mcp, service, "sites", "remove_site") # noqa: F841
- Mapping of service attributes like 'sites' to their classes, used for method resolution and schema extraction.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, }
- Instantiates the SiteManagementService (containing remove_site) as self.sites for use by tool wrappers.self.sites = site_management.SiteManagementService(self.client)