Skip to content

Commit df0b350

Browse files
authored
Merge branch 'main' into handle-accepted-error
2 parents 14a959c + f818830 commit df0b350

File tree

4 files changed

+22
-8
lines changed

4 files changed

+22
-8
lines changed

github-mcp-server

17.5 MB
Binary file not shown.

pkg/github/__toolsnaps__/list_issues.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
"description": "Order issues by field. If provided, the 'direction' also needs to be provided.",
3030
"enum": [
3131
"CREATED_AT",
32-
"UPDATED_AT"
32+
"UPDATED_AT",
33+
"COMMENTS"
3334
],
3435
"type": "string"
3536
},

pkg/github/issues.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ type IssueFragment struct {
3838
Description githubv4.String
3939
}
4040
} `graphql:"labels(first: 100)"`
41+
Comments struct {
42+
TotalCount githubv4.Int
43+
} `graphql:"comments"`
4144
}
4245

4346
// Common interface for all issue query types
@@ -133,10 +136,11 @@ func fragmentToIssue(fragment IssueFragment) *github.Issue {
133136
User: &github.User{
134137
Login: github.Ptr(string(fragment.Author.Login)),
135138
},
136-
State: github.Ptr(string(fragment.State)),
137-
ID: github.Ptr(fragment.DatabaseID),
138-
Body: github.Ptr(string(fragment.Body)),
139-
Labels: foundLabels,
139+
State: github.Ptr(string(fragment.State)),
140+
ID: github.Ptr(fragment.DatabaseID),
141+
Body: github.Ptr(string(fragment.Body)),
142+
Labels: foundLabels,
143+
Comments: github.Ptr(int(fragment.Comments.TotalCount)),
140144
}
141145
}
142146

@@ -875,7 +879,7 @@ func ListIssues(getGQLClient GetGQLClientFn, t translations.TranslationHelperFun
875879
),
876880
mcp.WithString("orderBy",
877881
mcp.Description("Order issues by field. If provided, the 'direction' also needs to be provided."),
878-
mcp.Enum("CREATED_AT", "UPDATED_AT"),
882+
mcp.Enum("CREATED_AT", "UPDATED_AT", "COMMENTS"),
879883
),
880884
mcp.WithString("direction",
881885
mcp.Description("Order direction. If provided, the 'orderBy' also needs to be provided."),

pkg/github/issues_test.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,9 @@ func Test_ListIssues(t *testing.T) {
681681
{"name": "bug", "id": "label1", "description": "Bug label"},
682682
},
683683
},
684+
"comments": map[string]any{
685+
"totalCount": 5,
686+
},
684687
},
685688
{
686689
"number": 456,
@@ -696,6 +699,9 @@ func Test_ListIssues(t *testing.T) {
696699
{"name": "enhancement", "id": "label2", "description": "Enhancement label"},
697700
},
698701
},
702+
"comments": map[string]any{
703+
"totalCount": 3,
704+
},
699705
},
700706
}
701707

@@ -713,6 +719,9 @@ func Test_ListIssues(t *testing.T) {
713719
"labels": map[string]any{
714720
"nodes": []map[string]any{},
715721
},
722+
"comments": map[string]any{
723+
"totalCount": 1,
724+
},
716725
},
717726
}
718727

@@ -875,8 +884,8 @@ func Test_ListIssues(t *testing.T) {
875884
}
876885

877886
// Define the actual query strings that match the implementation
878-
qBasicNoLabels := "query($after:String$direction:OrderDirection!$first:Int!$orderBy:IssueOrderField!$owner:String!$repo:String!$states:[IssueState!]!){repository(owner: $owner, name: $repo){issues(first: $first, after: $after, states: $states, orderBy: {field: $orderBy, direction: $direction}){nodes{number,title,body,state,databaseId,author{login},createdAt,updatedAt,labels(first: 100){nodes{name,id,description}}},pageInfo{hasNextPage,hasPreviousPage,startCursor,endCursor},totalCount}}}"
879-
qWithLabels := "query($after:String$direction:OrderDirection!$first:Int!$labels:[String!]!$orderBy:IssueOrderField!$owner:String!$repo:String!$states:[IssueState!]!){repository(owner: $owner, name: $repo){issues(first: $first, after: $after, labels: $labels, states: $states, orderBy: {field: $orderBy, direction: $direction}){nodes{number,title,body,state,databaseId,author{login},createdAt,updatedAt,labels(first: 100){nodes{name,id,description}}},pageInfo{hasNextPage,hasPreviousPage,startCursor,endCursor},totalCount}}}"
887+
qBasicNoLabels := "query($after:String$direction:OrderDirection!$first:Int!$orderBy:IssueOrderField!$owner:String!$repo:String!$states:[IssueState!]!){repository(owner: $owner, name: $repo){issues(first: $first, after: $after, states: $states, orderBy: {field: $orderBy, direction: $direction}){nodes{number,title,body,state,databaseId,author{login},createdAt,updatedAt,labels(first: 100){nodes{name,id,description}},comments{totalCount}},pageInfo{hasNextPage,hasPreviousPage,startCursor,endCursor},totalCount}}}"
888+
qWithLabels := "query($after:String$direction:OrderDirection!$first:Int!$labels:[String!]!$orderBy:IssueOrderField!$owner:String!$repo:String!$states:[IssueState!]!){repository(owner: $owner, name: $repo){issues(first: $first, after: $after, labels: $labels, states: $states, orderBy: {field: $orderBy, direction: $direction}){nodes{number,title,body,state,databaseId,author{login},createdAt,updatedAt,labels(first: 100){nodes{name,id,description}},comments{totalCount}},pageInfo{hasNextPage,hasPreviousPage,startCursor,endCursor},totalCount}}}"
880889

881890
for _, tc := range tests {
882891
t.Run(tc.name, func(t *testing.T) {

0 commit comments

Comments
 (0)