list_properties
View all Google Search Console properties accessible to your service account, including permission levels and local sync status for SEO analysis.
Instructions
List all Google Search Console properties accessible via the service account, with permission level and local sync status. Usually not needed — setup handles this automatically.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/list-properties.ts:8-40 (handler)Main handler function that executes the list_properties tool logic. Calls GscClient.listProperties() to fetch properties from the API, then enriches each property with local sync status (lastSyncedAt, rowCount, dbPath) by checking for existing database files.
export async function listProperties(gscClient: GscClient): Promise<PropertyStatus[]> { const properties = await gscClient.listProperties(); const dataDir = getDataDir(); const results: PropertyStatus[] = []; for (const prop of properties) { const dbFilename = sanitizeSiteUrl(prop.siteUrl) + '.db'; const dbPath = join(dataDir, dbFilename); let lastSyncedAt: string | null = null; let rowCount: number | null = null; if (existsSync(dbPath)) { const db = new Database(dbPath); try { const meta = db.getPropertyMeta(prop.siteUrl); lastSyncedAt = meta?.lastSyncedAt || null; rowCount = db.getRowCount(); } finally { db.close(); } } results.push({ siteUrl: prop.siteUrl, permissionLevel: prop.permissionLevel, lastSyncedAt, rowCount, dbPath: existsSync(dbPath) ? dbPath : null, }); } return results; } - src/server.ts:336-348 (registration)Tool registration for 'list_properties'. Takes no input parameters (empty schema) and returns a JSON array of PropertyStatus objects. Wraps the listProperties handler function with error handling.
server.tool( 'list_properties', 'List all Google Search Console properties accessible via the service account, with permission level and local sync status. Usually not needed — setup handles this automatically.', {}, async () => { try { const properties = await listProperties(gscClient); return { content: [{ type: 'text', text: JSON.stringify(properties, null, 2) }] }; } catch (error) { return { content: [{ type: 'text', text: JSON.stringify({ error: (error as Error).message }) }], isError: true }; } } ); - src/types/index.ts:8-12 (schema)Type definition for the tool's output. PropertyStatus extends GscProperty with local sync metadata: lastSyncedAt timestamp, rowCount of synced data, and dbPath to the local database file.
export interface PropertyStatus extends GscProperty { lastSyncedAt: string | null; rowCount: number | null; dbPath: string | null; } - src/core/GscClient.ts:43-50 (helper)Core API client method that calls the Google Search Console API to list all accessible properties. Returns array of GscProperty objects with siteUrl and permissionLevel.
async listProperties(): Promise<GscProperty[]> { const response: any = await withRetry(() => this.searchconsole.sites.list()); const sites = response.data.siteEntry || []; return sites.map((site: any) => ({ siteUrl: site.siteUrl, permissionLevel: site.permissionLevel, })); }