bing_sitemap_list
Retrieve all sitemaps submitted to Bing Webmaster Tools for a site, showing URL counts, indexed counts, errors, and last crawl time.
Instructions
List all sitemaps submitted to Bing Webmaster Tools for a site, including URL counts, indexed counts, errors, and last crawl time.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| 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/sitemap-list.ts:24-69 (handler)Core handler for bing_sitemap_list tool. Calls Bing 'GetFeeds' API, formats sitemap data (URL counts, errors, warnings, crawl times) into a human-readable text response.
export const bingSitemapList: ToolDefinition<typeof schema> = { name: "bing_sitemap_list", description: "List all sitemaps submitted to Bing Webmaster Tools for a site, including URL counts, indexed counts, errors, and last crawl time.", 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("GetFeeds", { siteUrl }, apiKey)) as BingFeed[] | null; const feeds = Array.isArray(data) ? data : []; if (feeds.length === 0) { return { content: [{ type: "text", text: `No sitemaps found for ${siteUrl} in Bing Webmaster Tools.` }], }; } const lines = feeds.map((f) => { const statusParts = []; if ((f.ErrorCount ?? 0) > 0) statusParts.push(`${f.ErrorCount} errors`); if ((f.WarningCount ?? 0) > 0) statusParts.push(`${f.WarningCount} warnings`); const status = statusParts.length > 0 ? statusParts.join(", ") : f.Status ?? "OK"; return [ `URL: ${f.FeedUrl ?? "—"}`, ` Type: ${f.Type ?? "—"} | Status: ${status}`, ` URLs: ${f.UrlCount ?? "—"} submitted, ${f.IndexedUrlCount ?? "—"} indexed`, ` Submitted: ${f.SubmitTime ?? "—"} | Last crawled: ${f.LastCrawlTime ?? "—"}`, f.FileSize ? ` File size: ${(f.FileSize / 1024).toFixed(1)} KB` : "", ] .filter(Boolean) .join("\n"); }); return { content: [{ type: "text", text: `Sitemaps for ${siteUrl} in Bing (${feeds.length} total):\n\n${lines.join("\n\n")}` }], }; }, }; - src/tools/bing/sitemap-list.ts:18-22 (schema)Zod schema defining optional site_url input parameter.
const schema = z.object({ 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 bingSitemapList in the array of Bing tools exported from the bing index module.
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/auth/bing.ts:1-37 (helper)Helper functions getBingApiKey() and bingGet() used by the handler to authenticate and call the Bing Webmaster Tools API.
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; } const BING_BASE_URL = "https://ssl.bing.com/webmaster/api.svc/json"; export async function bingGet( method: string, params: Record<string, string | number | undefined>, apiKey: string ): Promise<unknown> { const url = new URL(`${BING_BASE_URL}/${method}`); url.searchParams.set("apikey", apiKey); for (const [k, v] of Object.entries(params)) { if (v !== undefined) url.searchParams.set(k, String(v)); } const res = await fetch(url.toString(), { headers: { Accept: "application/json" }, }); if (!res.ok) { const body = await res.text().catch(() => ""); throw new Error(`Bing API error ${res.status} on ${method}: ${body}`); } const json = (await res.json()) as { d?: unknown }; return json.d ?? json; }