feat(mcp): Add reopen command support for closed issues
Implements the `bd` reopen command across the entire MCP stack, enabling agents to reopen closed issues with optional reason tracking for audit trails. This addresses the need to handle regressions and incorrectly closed issues without manual `bd` CLI intervention. The reopen command is more explicit than `bd update --status open` and emits a dedicated Reopened event in the audit log, making it easier to track why issues were reopened during analysis. Changes: - `models.py`: Add ReopenIssueParams with issue_ids list and optional reason - `bd_client.py`: Implement reopen() method with JSON response parsing - `tools.py`: Add beads_reopen_issue() wrapper with Annotated types for MCP - `server.py`: Register 'reopen' MCP tool with description and parameters Testing (10 new): - `test_bd_client.py`: 4 unit tests (mocked subprocess) - `test_bd_client_integration.py`: 3 integration tests (real `bd` CLI) - `test_mcp_server_integration.py`: 3 MCP integration tests (FastMCP Client) - `test_tools.py`: 3 tools wrapper tests (mocked BdClient) Also updated `README.md`.
This commit is contained in:
committed by
Steve Yegge
parent
331a435418
commit
32a718dacd
@@ -14,6 +14,7 @@ from beads_mcp.tools import (
|
||||
beads_list_issues,
|
||||
beads_quickstart,
|
||||
beads_ready_work,
|
||||
beads_reopen_issue,
|
||||
beads_show_issue,
|
||||
beads_stats,
|
||||
beads_update_issue,
|
||||
@@ -153,6 +154,15 @@ async def close_issue(issue_id: str, reason: str = "Completed") -> list[Issue]:
|
||||
return await beads_close_issue(issue_id=issue_id, reason=reason)
|
||||
|
||||
|
||||
@mcp.tool(
|
||||
name="reopen",
|
||||
description="Reopen one or more closed issues. Sets status to 'open' and clears closed_at timestamp.",
|
||||
)
|
||||
async def reopen_issue(issue_ids: list[str], reason: str | None = None) -> list[Issue]:
|
||||
"""Reopen one or more closed issues."""
|
||||
return await beads_reopen_issue(issue_ids=issue_ids, reason=reason)
|
||||
|
||||
|
||||
@mcp.tool(
|
||||
name="dep",
|
||||
description="""Add a dependency between issues. Types: blocks (hard blocker),
|
||||
|
||||
Reference in New Issue
Block a user