indexnow_generate_key
Generate an IndexNow API key and verification file content to submit URLs for instant indexing, requiring hosting the file at your domain root.
Instructions
Generate an IndexNow API key and the verification file content. You need to host this file at your domain root.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| custom_key | No | Custom API key (optional — a UUID will be generated if not provided) |
Implementation Reference
- src/index.ts:394-410 (handler)Handler implementation for indexnow_generate_key tool.
async ({ custom_key }) => { const key = custom_key || crypto.randomUUID(); const fileContent = generateApiKeyFile(key); let output = `## IndexNow API Key Generated\n\n`; output += `**Your API Key:** \`${key}\`\n\n`; output += `### Setup Instructions\n\n`; output += `1. Create a file named \`${key}.txt\` in your website's root directory\n`; output += `2. The file should contain only: \`${fileContent}\`\n`; output += `3. Verify it's accessible at: \`https://yourdomain.com/${key}.txt\`\n\n`; output += `### File Content\n\`\`\`\n${fileContent}\n\`\`\`\n\n`; output += `### Quick Setup Commands\n\`\`\`bash\n`; output += `# For static sites\necho "${key}" > public/${key}.txt\n\n`; output += `# For Next.js\necho "${key}" > public/${key}.txt\n\n`; output += `# For WordPress\necho "${key}" > ${key}.txt\n`; output += `# Upload to your WordPress root directory\n\`\`\`\n\n`; output += `### Supported Search Engines\n`; - src/index.ts:388-410 (registration)Registration of indexnow_generate_key tool.
server.tool( "indexnow_generate_key", "Generate an IndexNow API key and the verification file content. You need to host this file at your domain root.", { custom_key: z.string().optional().describe("Custom API key (optional — a UUID will be generated if not provided)"), }, async ({ custom_key }) => { const key = custom_key || crypto.randomUUID(); const fileContent = generateApiKeyFile(key); let output = `## IndexNow API Key Generated\n\n`; output += `**Your API Key:** \`${key}\`\n\n`; output += `### Setup Instructions\n\n`; output += `1. Create a file named \`${key}.txt\` in your website's root directory\n`; output += `2. The file should contain only: \`${fileContent}\`\n`; output += `3. Verify it's accessible at: \`https://yourdomain.com/${key}.txt\`\n\n`; output += `### File Content\n\`\`\`\n${fileContent}\n\`\`\`\n\n`; output += `### Quick Setup Commands\n\`\`\`bash\n`; output += `# For static sites\necho "${key}" > public/${key}.txt\n\n`; output += `# For Next.js\necho "${key}" > public/${key}.txt\n\n`; output += `# For WordPress\necho "${key}" > ${key}.txt\n`; output += `# Upload to your WordPress root directory\n\`\`\`\n\n`; output += `### Supported Search Engines\n`; - src/index.ts:189-191 (helper)Helper function to generate the content for the API key file.
function generateApiKeyFile(apiKey: string): string { return apiKey; }