@@ -201,33 +201,6 @@ func getIssueQueryType(hasLabels bool, hasSince bool) any {
201201 }
202202}
203203
204- func fragmentToIssue (fragment IssueFragment ) * github.Issue {
205- // Convert GraphQL labels to GitHub API labels format
206- var foundLabels []* github.Label
207- for _ , labelNode := range fragment .Labels .Nodes {
208- foundLabels = append (foundLabels , & github.Label {
209- Name : github .Ptr (string (labelNode .Name )),
210- NodeID : github .Ptr (string (labelNode .ID )),
211- Description : github .Ptr (string (labelNode .Description )),
212- })
213- }
214-
215- return & github.Issue {
216- Number : github .Ptr (int (fragment .Number )),
217- Title : github .Ptr (sanitize .Sanitize (string (fragment .Title ))),
218- CreatedAt : & github.Timestamp {Time : fragment .CreatedAt .Time },
219- UpdatedAt : & github.Timestamp {Time : fragment .UpdatedAt .Time },
220- User : & github.User {
221- Login : github .Ptr (string (fragment .Author .Login )),
222- },
223- State : github .Ptr (string (fragment .State )),
224- ID : github .Ptr (fragment .DatabaseID ),
225- Body : github .Ptr (sanitize .Sanitize (string (fragment .Body ))),
226- Labels : foundLabels ,
227- Comments : github .Ptr (int (fragment .Comments .TotalCount )),
228- }
229- }
230-
231204// IssueRead creates a tool to get details of a specific issue in a GitHub repository.
232205func IssueRead (t translations.TranslationHelperFunc ) inventory.ServerTool {
233206 schema := & jsonschema.Schema {
@@ -1584,41 +1557,12 @@ func ListIssues(t translations.TranslationHelperFunc) inventory.ServerTool {
15841557 ), nil , nil
15851558 }
15861559
1587- // Extract and convert all issue nodes using the common interface
1588- var issues []* github.Issue
1589- var pageInfo struct {
1590- HasNextPage githubv4.Boolean
1591- HasPreviousPage githubv4.Boolean
1592- StartCursor githubv4.String
1593- EndCursor githubv4.String
1594- }
1595- var totalCount int
1596-
1560+ var resp MinimalIssuesResponse
15971561 if queryResult , ok := issueQuery .(IssueQueryResult ); ok {
1598- fragment := queryResult .GetIssueFragment ()
1599- for _ , issue := range fragment .Nodes {
1600- issues = append (issues , fragmentToIssue (issue ))
1601- }
1602- pageInfo = fragment .PageInfo
1603- totalCount = fragment .TotalCount
1604- }
1605-
1606- // Create response with issues
1607- response := map [string ]any {
1608- "issues" : issues ,
1609- "pageInfo" : map [string ]any {
1610- "hasNextPage" : pageInfo .HasNextPage ,
1611- "hasPreviousPage" : pageInfo .HasPreviousPage ,
1612- "startCursor" : string (pageInfo .StartCursor ),
1613- "endCursor" : string (pageInfo .EndCursor ),
1614- },
1615- "totalCount" : totalCount ,
1562+ resp = convertToMinimalIssuesResponse (queryResult .GetIssueFragment ())
16161563 }
1617- out , err := json .Marshal (response )
1618- if err != nil {
1619- return nil , nil , fmt .Errorf ("failed to marshal issues: %w" , err )
1620- }
1621- return utils .NewToolResultText (string (out )), nil , nil
1564+
1565+ return MarshalledTextResult (resp ), nil , nil
16221566 })
16231567}
16241568
0 commit comments