get_url_links
Retrieve inbound links for a specific URL from Bing Webmaster Tools to analyze backlink profiles and understand referral traffic sources.
Instructions
Retrieve inbound links for a specific URL.
Args: site_url: The URL of the site link: The specific URL to get inbound links for page: The page number of results to retrieve
Returns: LinkDetails: Details about inbound links
Raises: BingWebmasterError: If link details cannot be retrieved
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| self | Yes | ||
| site_url | Yes | ||
| link | Yes | ||
| page | No |
Implementation Reference
- The MCP tool handler implementation (shared for all tools including get_url_links). Decorated with @mcp.tool(), it executes the underlying links.get_url_links method on the service 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__ return wrapper
- mcp_server_bwt/tools/bing_webmaster.py:161-161 (registration)Registers the get_url_links MCP tool by creating a wrapped handler from the links service method.get_url_links = wrap_service_method(mcp, service, "links", "get_url_links") # noqa: F841
- mcp_server_bwt/main.py:17-17 (registration)Top-level registration invocation that adds the get_url_links tool (among others) to the MCP server.add_bing_webmaster_tools(mcp, bing_service)
- Mapping of service attributes to classes, used to fetch original method signature for get_url_links ('links' -> LinkAnalysisService).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 LinkAnalysisService as self.links on the BingWebmasterService, providing the underlying get_url_links method.self.links = link_analysis.LinkAnalysisService(self.client)