sites_list
List all Google Search Console properties you have access to, providing a clear overview of your managed sites.
Instructions
List all sites (properties) you have access to in Google Search Console.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:136-150 (handler)The primary handler for the sites_list tool. It calls the Google Webmasters API GET /sites endpoint, then returns the result via toolResult() helper, or an error via errorResult() helper.
server.tool( "sites_list", "List all sites (properties) you have access to in Google Search Console.", {}, async () => { try { const result = await apiCall(`${WEBMASTERS_BASE}/sites`, { method: "GET", }); return toolResult(result); } catch (e) { return errorResult(e); } }, ); - src/index.ts:139-150 (schema)The schema (second argument to server.tool) is an empty object {}, meaning the sites_list tool takes no input parameters.
{}, async () => { try { const result = await apiCall(`${WEBMASTERS_BASE}/sites`, { method: "GET", }); return toolResult(result); } catch (e) { return errorResult(e); } }, ); - src/index.ts:136-150 (registration)Tool registered via server.tool() on the MCP server named 'gsc-mcp' version 1.3.0, with the name 'sites_list'.
server.tool( "sites_list", "List all sites (properties) you have access to in Google Search Console.", {}, async () => { try { const result = await apiCall(`${WEBMASTERS_BASE}/sites`, { method: "GET", }); return toolResult(result); } catch (e) { return errorResult(e); } }, ); - src/index.ts:806-808 (registration)Secondary registration in createSandboxServer() for Smithery sandbox mode. This version returns a stub 'sandbox' text instead of making real API calls.
sandbox.tool("sites_list", "List all sites (properties) you have access to in Google Search Console.", {}, async () => { return { content: [{ type: "text" as const, text: "sandbox" }] }; }); - src/index.ts:94-107 (helper)The apiCall helper function used by the sites_list handler. It fetches an OAuth token, makes an HTTP request with the Bearer token, and returns the response.
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 }; }