bing_url_inspection
Inspect a URL's indexing and crawl status in Bing Webmaster Tools. Returns HTTP status, indexing state, crawl date, page title, link counts, and blockage info.
Instructions
Inspect a URL's indexing and crawl status in Bing Webmaster Tools. Returns HTTP status, indexing state, crawl date, page title, link counts, and whether the URL is blocked.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | The exact URL to inspect. | |
| site_url | No | Your site URL in Bing Webmaster Tools, e.g. 'https://example.com/'. Uses config default if omitted. |
Implementation Reference
- src/tools/bing/url-inspection.ts:27-71 (handler)The main tool handler that calls the Bing API GetUrlInfo endpoint, formats the response into a human-readable text output with indexing status, crawl info, link counts, redirects, and mobile status.
export const bingUrlInspection: ToolDefinition<typeof schema> = { name: "bing_url_inspection", description: "Inspect a URL's indexing and crawl status in Bing Webmaster Tools. Returns HTTP status, indexing state, crawl date, page title, link counts, and whether the URL is blocked.", schema, handler: async (args, config) => { const apiKey = getBingApiKey(); const siteUrl = args.site_url ?? config.bing?.default_site; if (!siteUrl) { throw new Error( "site_url is required. Pass it as an argument or set bing.default_site in ~/.seo-mcp/config.json" ); } const data = (await bingGet("GetUrlInfo", { siteUrl, url: args.url }, apiKey)) as BingUrlInfo | null; if (!data) { return { content: [{ type: "text", text: `No data found for URL: ${args.url}` }] }; } const lines: string[] = [ `URL: ${args.url}`, `HTTP status: ${data.HttpStatusCode ?? "—"}`, `Indexed: ${data.IsIndexed ? "Yes" : "No"}`, `Blocked: ${data.IsBlocked ? "Yes" : "No"}`, `Blocked by robots.txt: ${data.IsBlockedByRobotsTxt ? "Yes" : "No"}`, `Last crawled: ${data.CrawlTime ?? "—"}`, `Title: ${data.Title ?? "—"}`, `Content length: ${data.ContentLength ? `${data.ContentLength} bytes` : "—"}`, `Internal links: ${data.InternalLinkCount ?? "—"}`, `External links: ${data.ExternalLinkCount ?? "—"}`, `Parameter URL: ${data.IsParamUrl ? "Yes" : "No"}`, ]; if (data.RedirectTo) { lines.push(`Redirects to: ${data.RedirectTo}`); } if (data.MobileStatus) { lines.push(`Mobile status: ${data.MobileStatus}`); } return { content: [{ type: "text", text: lines.join("\n") }] }; }, }; - Zod schema defining the input parameters: required 'url' and optional 'site_url'.
const schema = z.object({ url: z.string().describe("The exact URL to inspect."), site_url: z.string().optional().describe( "Your site URL in Bing Webmaster Tools, e.g. 'https://example.com/'. Uses config default if omitted." ), }); - src/tools/bing/index.ts:7-12 (registration)Registration of bing_url_inspection in the bingTools array alongside other Bing tools.
export const bingTools: ToolDefinition[] = [ bingKeywordResearch as unknown as ToolDefinition, bingCrawlHealth as unknown as ToolDefinition, bingUrlInspection as unknown as ToolDefinition, bingSitemapList as unknown as ToolDefinition, ]; - src/server.ts:15-41 (registration)Server-side registration: the tool is registered with the MCP server using its name, description, input schema, and handler wrapper.
const allTools = [...gscTools, ...bingTools]; for (const tool of allTools) { server.registerTool( tool.name, { description: tool.description, inputSchema: tool.schema, }, async (args) => { try { const result = await tool.handler(args as never, config); return result; } catch (err) { const message = err instanceof Error ? err.message : String(err); return { content: [{ type: "text" as const, text: `Error: ${message}` }], isError: true, }; } } ); } const transport = new StdioServerTransport(); await server.connect(transport); } - src/auth/bing.ts:1-10 (helper)Helper that retrieves the Bing API key from environment variables, used by the handler.
export function getBingApiKey(): string { const key = process.env.BING_WEBMASTER_API_KEY; if (!key) { throw new Error( "BING_WEBMASTER_API_KEY not set.\n" + "Generate a key at: https://www.bing.com/webmasters → Settings → API Access" ); } return key; }