submit_url_batch
Submit multiple URLs to Bing Webmaster Tools for indexing to improve search engine visibility and crawl efficiency.
Instructions
Submit multiple URLs for indexing.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| site_url | Yes | ||
| urls | Yes |
Implementation Reference
- mcp_server_bwt/main.py:321-339 (handler)The handler function decorated with @mcp.tool, implementing the submit_url_batch tool. It takes site_url and list of urls, calls the Bing API endpoint SubmitUrlBatch via the api client, and returns a success message with the result.@mcp.tool(name="submit_url_batch", description="Submit multiple URLs for indexing.") async def submit_url_batch( site_url: Annotated[str, "The URL of the site"], urls: List[str] ) -> Dict[str, Any]: """ Submit multiple URLs for indexing. Args: site_url: The URL of the site urls: List of URLs to submit Returns: Submission result """ async with api: result = await api._make_request( "SubmitUrlBatch", "POST", {"siteUrl": site_url, "urlList": urls} ) return {"message": f"Submitted {len(urls)} URLs", "result": result}
- mcp_server_bwt/main.py:321-321 (registration)The @mcp.tool decorator registers the submit_url_batch tool with the MCP server, specifying its name and description.@mcp.tool(name="submit_url_batch", description="Submit multiple URLs for indexing.")
- mcp_server_bwt/main.py:59-104 (helper)The _make_request method of BingWebmasterAPI class used by the handler to perform the actual POST request to the SubmitUrlBatch API endpoint.async def _make_request( self, endpoint: str, method: str = "GET", json_data: Optional[Dict[str, Any]] = None, params: Optional[Dict[str, Any]] = None, ) -> Any: """Make a request to the Bing API and handle OData responses.""" if not self.client: raise RuntimeError( "API client not initialized. Use 'async with api:' context manager." ) headers = {"Content-Type": "application/json; charset=utf-8"} # Build URL with API key if "?" in endpoint: url = f"{self.base_url}/{endpoint}&apikey={self.api_key}" else: url = f"{self.base_url}/{endpoint}?apikey={self.api_key}" # Add additional parameters if provided if params: for key, value in params.items(): url += f"&{key}={value}" try: if method == "GET": response = await self.client.get(url, headers=headers) else: response = await self.client.request( method, url, headers=headers, json=json_data ) if response.status_code != 200: error_text = response.text logger.error(f"API error {response.status_code}: {error_text}") raise Exception(f"API error {response.status_code}: {error_text}") data = response.json() # Handle OData response format if "d" in data: return data["d"] return data