indexnow_submit_sitemap
Submit URLs from an XML sitemap to IndexNow for instant search engine indexing. This tool extracts URLs and sends them directly to search engines to accelerate content discovery.
Instructions
Fetch a sitemap XML, extract all URLs, and submit them to IndexNow for instant indexing.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sitemap_url | Yes | URL of the XML sitemap to process | |
| api_key | Yes | Your IndexNow API key | |
| host | Yes | Your website hostname (e.g., example.com) | |
| engines | No | Search engines to submit to (default: all) | |
| limit | No | Max URLs to submit (default: all) |
Implementation Reference
- src/index.ts:320-373 (handler)The handler function for the `indexnow_submit_sitemap` tool, which fetches a sitemap, parses it, and submits URLs to IndexNow.
async ({ sitemap_url, api_key, host, engines, limit }) => { try { const response = await fetch(sitemap_url, { signal: AbortSignal.timeout(30000), }); if (!response.ok) { return { content: [ { type: "text" as const, text: `Error: Failed to fetch sitemap (HTTP ${response.status})`, }, ], }; } const xml = await response.text(); let urls = parseSitemap(xml); if (urls.length === 0) { return { content: [ { type: "text" as const, text: "Error: No URLs found in sitemap. Make sure it's a valid XML sitemap with <loc> tags.", }, ], }; } const totalFound = urls.length; if (limit && limit > 0) { urls = urls.slice(0, limit); } if (urls.length > 10000) { urls = urls.slice(0, 10000); } const results = await submitToIndexNow(urls, api_key, host, undefined, engines); const successful = results.filter((r) => r.success).length; let output = `## Sitemap IndexNow Submission\n\n`; output += `**Sitemap:** ${sitemap_url}\n`; output += `**URLs found:** ${totalFound}\n`; output += `**URLs submitted:** ${urls.length}\n`; output += `**Engines successful:** ${successful}/${results.length}\n\n`; output += `| Engine | Status | Result |\n|--------|--------|--------|\n`; for (const r of results) { output += `| ${r.engine} | ${r.status} | ${r.success ? "Success" : "Failed"} - ${r.message} |\n`; } return { content: [{ type: "text" as const, text: output }] }; - src/index.ts:307-319 (registration)Tool registration for `indexnow_submit_sitemap` including its description and input schema.
server.tool( "indexnow_submit_sitemap", "Fetch a sitemap XML, extract all URLs, and submit them to IndexNow for instant indexing.", { sitemap_url: z.string().url().describe("URL of the XML sitemap to process"), api_key: z.string().describe("Your IndexNow API key"), host: z.string().describe("Your website hostname (e.g., example.com)"), engines: z .array(z.enum(["bing", "yandex", "naver", "seznam", "indexnow"])) .optional() .describe("Search engines to submit to (default: all)"), limit: z.number().optional().describe("Max URLs to submit (default: all)"), },