fix: Update required fields in createPullRequest and issue handling

This commit is contained in:
Robin Shen 2025-09-27 10:11:00 +08:00
parent b5c65ccb48
commit d0c7a68be9

View File

@ -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 AI
var cleanedTitle = title.replaceFirst("\\s*\\([a-zA-Z]+-\\d+\\)$", "");