google_indexing_submit
Submit URLs to Google Indexing API for fast crawling and indexing. Use to notify Google about new, updated, or deleted web pages.
Instructions
Submit URLs to Google Indexing API for fast crawling and indexing. Requires a Google service account access token with Indexing API permissions.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| urls | Yes | List of URLs to submit | |
| access_token | Yes | Google OAuth2 access token with Indexing API scope | |
| type | No | Notification type: URL_UPDATED (new/changed) or URL_DELETED (removed). Default: URL_UPDATED |
Implementation Reference
- src/index.ts:102-141 (handler)The submitToGoogleIndexing helper function executes the actual POST request to the Google Indexing API.
async function submitToGoogleIndexing( urls: string[], accessToken: string, type: "URL_UPDATED" | "URL_DELETED" = "URL_UPDATED" ): Promise<GoogleIndexResult[]> { const results: GoogleIndexResult[] = []; for (const url of urls) { try { const response = await fetch(GOOGLE_INDEXING_API_URL, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${accessToken}`, }, body: JSON.stringify({ url, type, }), signal: AbortSignal.timeout(15000), }); const data = await response.json(); results.push({ url, success: response.status >= 200 && response.status < 300, status: response.status, message: response.ok ? `Submitted (${type})` : data.error?.message || `HTTP ${response.status}`, }); } catch (error) { results.push({ url, success: false, status: 0, message: error instanceof Error ? error.message : "Unknown error", }); } - src/index.ts:251-276 (registration)Registration of the google_indexing_submit tool using server.tool.
// Tool: Submit to Google Indexing API server.tool( "google_indexing_submit", "Submit URLs to Google Indexing API for fast crawling and indexing. Requires a Google service account access token with Indexing API permissions.", { urls: z.array(z.string().url()).describe("List of URLs to submit"), access_token: z.string().describe("Google OAuth2 access token with Indexing API scope"), type: z .enum(["URL_UPDATED", "URL_DELETED"]) .optional() .describe("Notification type: URL_UPDATED (new/changed) or URL_DELETED (removed). Default: URL_UPDATED"), }, async ({ urls, access_token, type }) => { const results = await submitToGoogleIndexing(urls, access_token, type || "URL_UPDATED"); const successful = results.filter((r) => r.success).length; let output = `## Google Indexing API Results\n\n`; output += `**URLs submitted:** ${urls.length}\n`; output += `**Successful:** ${successful}/${urls.length}\n`; output += `**Type:** ${type || "URL_UPDATED"}\n\n`; output += `| URL | Status | Result |\n|-----|--------|--------|\n`; for (const r of results) { const shortUrl = r.url.length > 60 ? r.url.substring(0, 57) + "..." : r.url; output += `| ${shortUrl} | ${r.status} | ${r.message} |\n`; } - src/index.ts:255-262 (schema)Input schema validation for google_indexing_submit.
{ urls: z.array(z.string().url()).describe("List of URLs to submit"), access_token: z.string().describe("Google OAuth2 access token with Indexing API scope"), type: z .enum(["URL_UPDATED", "URL_DELETED"]) .optional() .describe("Notification type: URL_UPDATED (new/changed) or URL_DELETED (removed). Default: URL_UPDATED"), },