uses status

Watch a long migration finish from your phone

Problem

You kick off a database migration that will take 20–40 minutes. You want to check in from your phone without SSHing into the server or refreshing a terminal. You want a live URL that shows progress, current row counts, and a clear success/failure state when it finishes.

The MCP call

handle = status_create(
    title='Backfill: add tenant_id to shares',
    ttl_hours=4,
)
print(f'Watch at: {handle["url"]}')

# During the migration loop:
for batch_num, rows_done in enumerate(run_migration_batches()):
    pct = int(rows_done / total_rows * 100)
    status_update(
        handle['status_id'],
        message=f'Batch {batch_num} complete',
        percent=pct,
        kv={'rows_done': rows_done, 'total': total_rows},
    )

# When finished:
status_finish(
    handle['status_id'],
    success=True,
    summary_md=f'{total_rows:,} rows migrated in {elapsed}. 0 errors.',
)

What you get back

You get a URL immediately. Open it on your phone and the page shows a live progress bar, the current row count, and a timestamped log of each batch. When the migration finishes, the page shows the summary Markdown in a success state.

Follow-up calls

After the migration, call ask_user(kind='todo', ...) to leave yourself a reminder to verify the results before the next deploy.

Notes

The page is SSE-driven — it refreshes automatically without a reload. On mobile, keep the browser tab in the foreground or enable background tab support in your browser settings.