Skip to content

Commit e733f06

Browse files
committed
feat: add type to issues
1 parent c17ebfe commit e733f06

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

pkg/github/issues.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,9 @@ func CreateIssue(getClient GetClientFn, t translations.TranslationHelperFunc) (t
283283
mcp.WithNumber("milestone",
284284
mcp.Description("Milestone number"),
285285
),
286+
mcp.WithString("type",
287+
mcp.Description("Type of this issue"),
288+
),
286289
),
287290
func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
288291
owner, err := requiredParam[string](request, "owner")
@@ -327,13 +330,20 @@ func CreateIssue(getClient GetClientFn, t translations.TranslationHelperFunc) (t
327330
milestoneNum = &milestone
328331
}
329332

333+
// Get optional type
334+
issueType, err := OptionalParam[string](request, "type")
335+
if err != nil {
336+
return mcp.NewToolResultError(err.Error()), nil
337+
}
338+
330339
// Create the issue request
331340
issueRequest := &github.IssueRequest{
332341
Title: github.Ptr(title),
333342
Body: github.Ptr(body),
334343
Assignees: &assignees,
335344
Labels: &labels,
336345
Milestone: milestoneNum,
346+
Type: &issueType,
337347
}
338348

339349
client, err := getClient(ctx)
@@ -534,6 +544,9 @@ func UpdateIssue(getClient GetClientFn, t translations.TranslationHelperFunc) (t
534544
mcp.WithNumber("milestone",
535545
mcp.Description("New milestone number"),
536546
),
547+
mcp.WithString("type",
548+
mcp.Description("New issue type"),
549+
),
537550
),
538551
func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
539552
owner, err := requiredParam[string](request, "owner")
@@ -604,6 +617,15 @@ func UpdateIssue(getClient GetClientFn, t translations.TranslationHelperFunc) (t
604617
issueRequest.Milestone = &milestoneNum
605618
}
606619

620+
// Get issue type
621+
issueType, err := OptionalParam[string](request, "type")
622+
if err != nil {
623+
return mcp.NewToolResultError(err.Error()), nil
624+
}
625+
if issueType != "" {
626+
issueRequest.Type = github.Ptr(issueType)
627+
}
628+
607629
client, err := getClient(ctx)
608630
if err != nil {
609631
return nil, fmt.Errorf("failed to get GitHub client: %w", err)

0 commit comments

Comments
 (0)