indexing_get_metadata
Obtain the timestamps of URL_UPDATED and URL_DELETED notifications for a URL from Google Search Console to monitor indexing status.
Instructions
Get the latest indexing notification metadata for a URL. Returns the latest URL_UPDATED and URL_DELETED notification timestamps.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | The fully-qualified URL to check notification status for |
Implementation Reference
- src/index.ts:563-583 (handler)Main handler that registers the tool via server.tool() and makes a GET request to the Google Indexing API at /urlNotifications/metadata?url=... to retrieve latest notification timestamps for a URL.
// ── indexing_get_metadata ── server.tool( "indexing_get_metadata", "Get the latest indexing notification metadata for a URL. Returns the latest URL_UPDATED and URL_DELETED notification timestamps.", { url: z .string() .describe("The fully-qualified URL to check notification status for"), }, async ({ url }) => { try { const result = await apiCall( `${INDEXING_BASE}/urlNotifications/metadata?url=${encodeURIComponent(url)}`, { method: "GET" }, ); return toolResult(result); } catch (e) { return errorResult(e); } }, ); - src/index.ts:567-571 (schema)Zod schema defining the single input parameter: 'url' (string) describing the URL to check notification status for.
{ url: z .string() .describe("The fully-qualified URL to check notification status for"), }, - src/index.ts:563-583 (registration)Tool registration via server.tool() on the McpServer instance, registering it under the name 'indexing_get_metadata' with a description and schema.
// ── indexing_get_metadata ── server.tool( "indexing_get_metadata", "Get the latest indexing notification metadata for a URL. Returns the latest URL_UPDATED and URL_DELETED notification timestamps.", { url: z .string() .describe("The fully-qualified URL to check notification status for"), }, async ({ url }) => { try { const result = await apiCall( `${INDEXING_BASE}/urlNotifications/metadata?url=${encodeURIComponent(url)}`, { method: "GET" }, ); return toolResult(result); } catch (e) { return errorResult(e); } }, ); - src/index.ts:886-890 (registration)Sandbox/stub registration in the createSandboxServer() function, returning a placeholder 'sandbox' response.
sandbox.tool("indexing_get_metadata", "Get the latest indexing notification metadata for a URL.", { url: z.string().describe("The fully-qualified URL to check notification status for"), }, async () => { return { content: [{ type: "text" as const, text: "sandbox" }] }; }); - src/index.ts:94-107 (helper)Helper function that performs the actual HTTP fetch call with an OAuth2 access token, used by the tool handler to call the Indexing API.
async function apiCall( url: string, options: RequestInit = {}, ): Promise<{ ok: boolean; status: number; body: string }> { const token = await getAccessToken(); const headers: Record<string, string> = { Authorization: `Bearer ${token}`, ...((options.headers as Record<string, string>) || {}), }; const res = await fetch(url, { ...options, headers }); const body = await res.text(); return { ok: res.ok, status: res.status, body }; }