remove_site_role
Remove a user's role and access permissions for a specific site in Bing Webmaster Tools. Specify the site URL and the role to revoke permissions effectively.
Instructions
Remove a user's site access.
Args: site_url: The URL of the site site_role: The site role to remove
Raises: BingWebmasterError: If the role cannot be removed
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| self | Yes | ||
| site_role | Yes | ||
| site_url | Yes |
Implementation Reference
- The dynamically created async function decorated with @mcp.tool(), serving as the core handler for the remove_site_role tool. It extracts the service instance, binds the method, and executes it with provided arguments.# 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__
- mcp_server_bwt/tools/bing_webmaster.py:91-91 (registration)Registers the remove_site_role MCP tool by invoking wrap_service_method with the 'sites' service and method name, creating the handler.remove_site_role = wrap_service_method(mcp, service, "sites", "remove_site_role") # noqa: F841
- mcp_server_bwt/main.py:17-17 (registration)Invokes the function that registers all Bing Webmaster tools, including remove_site_role, to the MCP server instance.add_bing_webmaster_tools(mcp, bing_service)
- Initializes and exposes the SiteManagementService as self.sites on BingWebmasterService, which is used by the tool wrapper to access the remove_site_role method.# Expose all services directly self.sites = site_management.SiteManagementService(self.client)
- Maps service attribute names like 'sites' to their classes, used in wrap_service_method to get original method signatures.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, }