The Unified and Autonomous Development Platform
fix: Update required fields in createPullRequest and issue handling
Robin Shend0c7a68be94e
diff --git a/server-core/src/main/java/io/onedev/server/rest/resource/McpHelperResource.java b/server-core/src/main/java/io/onedev/server/rest/resource/McpHelperResource.javaindex c36b56cba7..069bd6fa54 100644--- a/server-core/src/main/java/io/onedev/server/rest/resource/McpHelperResource.java+++ b/server-core/src/main/java/io/onedev/server/rest/resource/McpHelperResource.java@@ -797,7 +797,7 @@ public class McpHelperResource {createPullRequestInputSchema.put("Type", "object");createPullRequestInputSchema.put("Properties", createPullRequestProperties);- createPullRequestInputSchema.put("Required", List.of("sourceBranch"));+ createPullRequestInputSchema.put("Required", List.of("sourceBranch", "title"));inputSchemas.put("createPullRequest", createPullRequestInputSchema);@@ -1078,7 +1078,7 @@ public class McpHelperResource {Issue issue = new Issue();var title = (String) data.remove("title");if (title == null)- throw new NotAcceptableException("title is required");+ throw new NotAcceptableException("Title is required");issue.setTitle(title);var description = (String) data.remove("description");issue.setDescription(description);@@ -1218,7 +1218,7 @@ public class McpHelperResource {normalizeIssueData(data);var state = (String) data.remove("state");if (state == null)- throw new NotAcceptableException("state is required");+ throw new NotAcceptableException("State is required");var comment = (String) data.remove("comment");ManualSpec transition = settingManager.getIssueSetting().getManualSpec(issue, state);if (transition == null) {@@ -1648,6 +1648,8 @@ public class McpHelperResource {throw new NotAcceptableException("No code in target project: " + targetProject.getPath());var sourceBranch = (String) data.remove("sourceBranch");+ if (sourceBranch == null)+ throw new NotAcceptableException("Source branch is required");var target = new ProjectAndBranch(targetProject, targetBranch);var source = new ProjectAndBranch(sourceProject, sourceBranch);@@ -1676,6 +1678,8 @@ public class McpHelperResource {throw new NotAcceptableException("No common base for source and target branches");var title = (String) data.remove("title");+ if (title == null)+ throw new NotAcceptableException("Title is required");// Remove issue number suffix generated by AIvar cleanedTitle = title.replaceFirst("\\s*\\([a-zA-Z]+-\\d+\\)$", "");