@@ -131,14 +131,17 @@ type IssueQueryResult interface {
131131GetIssueFragment ()IssueQueryFragment
132132}
133133
134+ // PageInfo contains pagination information
135+ type PageInfo struct {
136+ HasNextPage githubv4.Boolean `json:"hasNextPage"`
137+ HasPreviousPage githubv4.Boolean `json:"hasPreviousPage"`
138+ StartCursor githubv4.String `json:"startCursor"`
139+ EndCursor githubv4.String `json:"endCursor"`
140+ }
141+
134142type IssueQueryFragment struct {
135- Nodes []IssueFragment `graphql:"nodes"`
136- PageInfo struct {
137- HasNextPage githubv4.Boolean
138- HasPreviousPage githubv4.Boolean
139- StartCursor githubv4.String
140- EndCursor githubv4.String
141- }
143+ Nodes []IssueFragment `graphql:"nodes"`
144+ PageInfo PageInfo
142145TotalCount int
143146}
144147
@@ -474,7 +477,7 @@ func GetIssueLabels(ctx context.Context, client *githubv4.Client, owner string,
474477}
475478
476479// ListIssueTypes creates a tool to list defined issue types for an organization. This can be used to understand supported issue type values for creating or updating issues.
477- func ListIssueTypes (getClient GetClientFn ,t translations.TranslationHelperFunc ) (tool mcp.Tool ,handler server.ToolHandlerFunc ) {
480+ func ListIssueTypes (getClient GetClientFn ,t translations.TranslationHelperFunc , flags FeatureFlags ) (tool mcp.Tool ,handler server.ToolHandlerFunc ) {
478481
479482return mcp .NewTool ("list_issue_types" ,
480483mcp .WithDescription (t ("TOOL_LIST_ISSUE_TYPES_FOR_ORG" ,"List supported issue types for repository owner (organization)." )),
@@ -511,12 +514,7 @@ func ListIssueTypes(getClient GetClientFn, t translations.TranslationHelperFunc)
511514return mcp .NewToolResultError (fmt .Sprintf ("failed to list issue types: %s" ,string (body ))),nil
512515}
513516
514- r ,err := json .Marshal (issueTypes )
515- if err != nil {
516- return nil ,fmt .Errorf ("failed to marshal issue types: %w" ,err )
517- }
518-
519- return mcp .NewToolResultText (string (r )),nil
517+ return FormatResponse (issueTypes ,flags )
520518}
521519}
522520
@@ -807,7 +805,7 @@ func ReprioritizeSubIssue(ctx context.Context, client *github.Client, owner stri
807805}
808806
809807// SearchIssues creates a tool to search for issues.
810- func SearchIssues (getClient GetClientFn ,t translations.TranslationHelperFunc ) (tool mcp.Tool ,handler server.ToolHandlerFunc ) {
808+ func SearchIssues (getClient GetClientFn ,t translations.TranslationHelperFunc , flags FeatureFlags ) (tool mcp.Tool ,handler server.ToolHandlerFunc ) {
811809return mcp .NewTool ("search_issues" ,
812810mcp .WithDescription (t ("TOOL_SEARCH_ISSUES_DESCRIPTION" ,"Search for issues in GitHub repositories using issues search syntax already scoped to is:issue" )),
813811mcp .WithToolAnnotation (mcp.ToolAnnotation {
@@ -847,7 +845,7 @@ func SearchIssues(getClient GetClientFn, t translations.TranslationHelperFunc) (
847845WithPagination (),
848846),
849847func (ctx context.Context ,request mcp.CallToolRequest ) (* mcp.CallToolResult ,error ) {
850- return searchHandler (ctx ,getClient ,request ,"issue" ,"failed to search issues" )
848+ return searchHandler (ctx ,getClient ,request ,"issue" ,"failed to search issues" , flags )
851849}
852850}
853851
@@ -1367,38 +1365,33 @@ func ListIssues(getGQLClient GetGQLClientFn, t translations.TranslationHelperFun
13671365
13681366// Extract and convert all issue nodes using the common interface
13691367var issues []* github.Issue
1370- var pageInfo struct {
1371- HasNextPage githubv4.Boolean
1372- HasPreviousPage githubv4.Boolean
1373- StartCursor githubv4.String
1374- EndCursor githubv4.String
1375- }
1376- var totalCount int
1368+ var fragment IssueQueryFragment
13771369
13781370if queryResult ,ok := issueQuery .(IssueQueryResult );ok {
1379- fragment : =queryResult .GetIssueFragment ()
1371+ fragment = queryResult .GetIssueFragment ()
13801372for _ ,issue := range fragment .Nodes {
13811373issues = append (issues ,fragmentToIssue (issue ))
13821374}
1383- pageInfo = fragment .PageInfo
1384- totalCount = fragment .TotalCount
13851375}
13861376
1387- // Create metadata for pagination
1388- metadata := map [string ]interface {}{
1389- "pageInfo" :map [string ]interface {}{
1390- "hasNextPage" :pageInfo .HasNextPage ,
1391- "hasPreviousPage" :pageInfo .HasPreviousPage ,
1392- "startCursor" :string (pageInfo .StartCursor ),
1393- "endCursor" :string (pageInfo .EndCursor ),
1394- },
1395- "totalCount" :totalCount ,
1377+ // Create response with issues
1378+ response := & IssuesListResponse {
1379+ Issues :issues ,
1380+ PageInfo :fragment .PageInfo ,
1381+ TotalCount :fragment .TotalCount ,
13961382}
13971383
1398- return FormatResponse (issues ,flags , "issues" , metadata )
1384+ return FormatResponse (response ,flags )
13991385}
14001386}
14011387
1388+ // IssuesListResponse represents the response from list_issues with pagination
1389+ type IssuesListResponse struct {
1390+ Issues []* github.Issue `json:"issues"`
1391+ PageInfo PageInfo `json:"pageInfo"`
1392+ TotalCount int `json:"totalCount"`
1393+ }
1394+
14021395// mvpDescription is an MVP idea for generating tool descriptions from structured data in a shared format.
14031396// It is not intended for widespread usage and is not a complete implementation.
14041397type mvpDescription struct {