check_sync_status
Monitor background sync job progress for Google Search Console data downloads. Check specific jobs or view all active/recent syncs to track data import status.
Instructions
Check the status of a background sync job. If no jobId provided, returns all active and recent jobs. Use after sync_gsc_data or sync_all_properties to monitor progress.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| jobId | No | Job ID from sync_gsc_data or sync_all_properties. Omit to see all jobs. |
Implementation Reference
- src/server.ts:431-438 (handler)Handler function for check_sync_status tool that calls syncManager.getStatus() and returns JSON status. Handles errors and returns them as error responses.
async (args) => { try { const status = syncManager.getStatus(args.jobId); return { content: [{ type: 'text', text: JSON.stringify(status, null, 2) }] }; } catch (error) { return { content: [{ type: 'text', text: JSON.stringify({ error: (error as Error).message }) }], isError: true }; } } - src/core/SyncManager.ts:107-129 (handler)Core getStatus method that retrieves status for a specific jobId or returns all jobs. Returns SyncStatus object(s) with job progress, results, and error information.
getStatus(jobId?: string): SyncStatus | SyncStatus[] { if (jobId) { const job = this.jobs.get(jobId); if (!job) { return { jobId, status: 'failed', totalProperties: 0, completedProperties: 0, currentProperty: null, rowsFetched: 0, estimatedTotalRows: null, apiCallsMade: 0, startedAt: '', elapsedMs: 0, results: [], error: `Job ${jobId} not found. It may have expired from history.`, }; } return this.jobToStatus(job); } return this.jobOrder.map(id => this.jobToStatus(this.jobs.get(id)!)); } - src/server.ts:425-439 (registration)Registration of check_sync_status tool with MCP server. Defines tool name, description, input schema (optional jobId parameter), and handler function.
server.tool( 'check_sync_status', 'Check the status of a background sync job. If no jobId provided, returns all active and recent jobs. Use after sync_gsc_data or sync_all_properties to monitor progress.', { jobId: z.string().optional().describe('Job ID from sync_gsc_data or sync_all_properties. Omit to see all jobs.'), }, async (args) => { try { const status = syncManager.getStatus(args.jobId); return { content: [{ type: 'text', text: JSON.stringify(status, null, 2) }] }; } catch (error) { return { content: [{ type: 'text', text: JSON.stringify({ error: (error as Error).message }) }], isError: true }; } } ); - src/core/SyncManager.ts:31-44 (schema)SyncStatus interface defining the structure of sync job status returned by check_sync_status. Includes jobId, status, progress metrics, timing, and results array.
export interface SyncStatus { jobId: string; status: SyncJobStatus; totalProperties: number; completedProperties: number; currentProperty: string | null; rowsFetched: number; estimatedTotalRows: number | null; apiCallsMade: number; startedAt: string; elapsedMs: number; results: SyncJobResult[]; error?: string; }