@@ -2047,6 +2047,12 @@ var issueWriteFormParams = map[string]struct{}{
20472047 "_ui_submitted" : {},
20482048}
20492049
2050+ func shouldIssueWriteDeferToForm (ctx context.Context , deps ToolDependencies , req * mcp.CallToolRequest , args map [string ]any ) bool {
2051+ issueType , issueTypeProvided , err := OptionalParamOK [string ](args , "type" )
2052+ explicitTypeClear := err == nil && issueTypeProvided && issueType == "" && args ["method" ] == "update"
2053+ return ! explicitTypeClear && shouldDeferToForm (ctx , deps , req , args , issueWriteFormParams )
2054+ }
2055+
20502056// issueWriteAwaitingFormResult builds the "awaiting form submission" stub
20512057// returned when issue_write hands off to the MCP App form. The body is shared
20522058// by IssueWrite and LegacyIssueWrite. The result is marked IsError=true so
@@ -2224,7 +2230,7 @@ Options are:
22242230
22252231 // Hand off to the interactive MCP App form unless this call must
22262232 // execute now (see shouldDeferToForm).
2227- if shouldDeferToForm (ctx , deps , req , args , issueWriteFormParams ) {
2233+ if shouldIssueWriteDeferToForm (ctx , deps , req , args ) {
22282234 issueNumber := 0
22292235 if method == "update" {
22302236 n , numErr := RequiredInt (args , "issue_number" )
@@ -2336,7 +2342,7 @@ Options are:
23362342 result , err := UpdateIssue (ctx , client , gqlClient , owner , repo , issueNumber , title , body , assignees , labels , milestoneNum , issueType , issueFieldValues , fieldIDsToDelete , state , stateReason , duplicateOf , UpdateIssueOptions {
23372343 AssigneesProvided : assigneesProvided ,
23382344 LabelsProvided : labelsProvided ,
2339- ClearIssueType : issueTypeProvided && issueType == "" ,
2345+ IssueTypeProvided : issueTypeProvided ,
23402346 })
23412347 return result , nil , err
23422348 default :
@@ -2407,8 +2413,8 @@ type UpdateIssueOptions struct {
24072413 AssigneesProvided bool
24082414 // LabelsProvided sends the labels field even when the slice is empty.
24092415 LabelsProvided bool
2410- // ClearIssueType sends an explicit null issue type .
2411- ClearIssueType bool
2416+ // IssueTypeProvided sends the type field, including an explicit clear for an empty value .
2417+ IssueTypeProvided bool
24122418}
24132419
24142420func UpdateIssue (ctx context.Context , client * github.Client , gqlClient * githubv4.Client , owner string , repo string , issueNumber int , title string , body string , assignees []string , labels []string , milestoneNum int , issueType string , issueFieldValues []* github.IssueRequestFieldValue , fieldIDsToDelete []int64 , state string , stateReason string , duplicateOf int , opts ... UpdateIssueOptions ) (* mcp.CallToolResult , error ) {
@@ -2419,7 +2425,7 @@ func UpdateIssue(ctx context.Context, client *github.Client, gqlClient *githubv4
24192425 for _ , opt := range opts {
24202426 updateOptions .AssigneesProvided = updateOptions .AssigneesProvided || opt .AssigneesProvided
24212427 updateOptions .LabelsProvided = updateOptions .LabelsProvided || opt .LabelsProvided
2422- updateOptions .ClearIssueType = updateOptions .ClearIssueType || opt .ClearIssueType
2428+ updateOptions .IssueTypeProvided = updateOptions .IssueTypeProvided || opt .IssueTypeProvided
24232429 }
24242430
24252431 // Create the issue request with only provided fields
@@ -2493,7 +2499,7 @@ func UpdateIssue(ctx context.Context, client *github.Client, gqlClient *githubv4
24932499 }
24942500 }
24952501
2496- updatedIssue , resp , err := patchIssue (ctx , client , owner , repo , issueNumber , issueRequest , updateOptions .ClearIssueType )
2502+ updatedIssue , resp , err := patchIssue (ctx , client , owner , repo , issueNumber , issueRequest , issueType , updateOptions .IssueTypeProvided )
24972503 if err != nil {
24982504 return ghErrors .NewGitHubAPIErrorResponse (ctx ,
24992505 "failed to update issue" ,
@@ -2631,8 +2637,8 @@ type updateIssueRequestWithNullableType struct {
26312637 Type * string `json:"type"`
26322638}
26332639
2634- func patchIssue (ctx context.Context , client * github.Client , owner , repo string , issueNumber int , issueRequest github.UpdateIssueRequest , clearIssueType bool ) (* github.Issue , * github.Response , error ) {
2635- if ! clearIssueType {
2640+ func patchIssue (ctx context.Context , client * github.Client , owner , repo string , issueNumber int , issueRequest github.UpdateIssueRequest , issueType string , issueTypeProvided bool ) (* github.Issue , * github.Response , error ) {
2641+ if ! issueTypeProvided || issueType != "" {
26362642 return client .Issues .Update (ctx , owner , repo , issueNumber , issueRequest )
26372643 }
26382644
0 commit comments