Add MCP tools for migration inspection (bd-627d Phase 3)

- Add inspect_migration() tool - calls bd migrate --inspect --json
- Add get_schema_info() tool - calls bd info --schema --json
- Implements abstract methods in BdClientBase
- CLI client calls commands directly
- Daemon client raises NotImplementedError (rare admin commands)

Phase 3 complete. Agents can now inspect migrations via MCP before running them.

Amp-Thread-ID: https://ampcode.com/threads/T-de7e1141-87ac-4b4a-9cea-1b7bc4d51da9
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Steve Yegge
2025-11-02 14:14:13 -08:00
parent 1abe4e75ad
commit 24936937f7
4 changed files with 114 additions and 0 deletions

View File

@@ -453,6 +453,31 @@ async def beads_blocked() -> list[BlockedIssue]:
return await client.blocked()
async def beads_inspect_migration() -> dict:
"""Get migration plan and database state for agent analysis.
AI agents should:
1. Review registered_migrations to understand what will run
2. Check warnings array for issues (missing config, version mismatch)
3. Verify missing_config is empty before migrating
4. Check invariants_to_check to understand safety guarantees
Returns migration plan, current db state, warnings, and invariants.
"""
client = await _get_client()
return await client.inspect_migration()
async def beads_get_schema_info() -> dict:
"""Get current database schema for inspection.
Returns tables, schema version, config, sample issue IDs, and detected prefix.
Useful for verifying database state before migrations.
"""
client = await _get_client()
return await client.get_schema_info()
async def beads_init(
prefix: Annotated[str | None, "Issue prefix (e.g., 'myproject' for myproject-1, myproject-2)"] = None,
) -> str: