Skip to content

πŸ™Œ OpenHands: AI-Driven Development

[Fix]: allow agent to configure draft status for opened prs/mrs via git mcp (#9117)

Rohit Malhotra53623c76b599
diff --git a/openhands/integrations/gitlab/gitlab_service.py b/openhands/integrations/gitlab/gitlab_service.py
index 110afe6ff3..6126152a9a 100644
--- a/openhands/integrations/gitlab/gitlab_service.py
+++ b/openhands/integrations/gitlab/gitlab_service.py
@@ -470,7 +470,6 @@ class GitLabService(BaseGitService, GitService):
target_branch: The name of the branch you want the changes merged into
title: The title of the merge request (optional, defaults to a generic title)
description: The description of the merge request (optional)
- draft: Whether to create the MR as a draft (optional, defaults to False)
Returns:
- MR URL when successful
diff --git a/openhands/server/routes/mcp.py b/openhands/server/routes/mcp.py
index 5d3364e32f..50fc0b84eb 100644
--- a/openhands/server/routes/mcp.py
+++ b/openhands/server/routes/mcp.py
@@ -87,6 +87,7 @@ async def create_pr(
target_branch: Annotated[str, Field(description='Target branch on repo')],
title: Annotated[str, Field(description='PR Title')],
body: Annotated[str | None, Field(description='PR body')],
+ draft: Annotated[bool, Field(description='Whether PR opened is a draft')] = True
) -> str:
"""Open a PR in GitHub"""
@@ -126,6 +127,7 @@ async def create_pr(
target_branch=target_branch,
title=title,
body=body,
+ draft=draft
)
if conversation_id:
@@ -146,7 +148,7 @@ async def create_mr(
],
source_branch: Annotated[str, Field(description='Source branch on repo')],
target_branch: Annotated[str, Field(description='Target branch on repo')],
- title: Annotated[str, Field(description='MR Title')],
+ title: Annotated[str, Field(description='MR Title. Start title with `DRAFT:` or `WIP:` if applicable.')],
description: Annotated[str | None, Field(description='MR description')],
) -> str:
"""Open a MR in GitLab"""