@@ -18,7 +18,7 @@ import (
1818)
1919
2020// GetIssue creates a tool to get details of a specific issue in a GitHub repository.
21- func GetIssue (getClient GetClientFn , t translations.TranslationHelperFunc ) (tool mcp.Tool , handler server.ToolHandlerFunc ) {
21+ func GetIssue (getClient GetClientFn , getGQLClient GetGQLClientFn , t translations.TranslationHelperFunc ) (tool mcp.Tool , handler server.ToolHandlerFunc ) {
2222 return mcp .NewTool ("get_issue" ,
2323 mcp .WithDescription (t ("TOOL_GET_ISSUE_DESCRIPTION" , "Get details of a specific issue in a GitHub repository." )),
2424 mcp .WithToolAnnotation (mcp.ToolAnnotation {
@@ -70,6 +70,13 @@ func GetIssue(getClient GetClientFn, t translations.TranslationHelperFunc) (tool
7070 return mcp .NewToolResultError (fmt .Sprintf ("failed to get issue: %s" , string (body ))), nil
7171 }
7272
73+ // Check if content filtering is enabled and user has push access
74+ if issue .User != nil && issue .User .Login != nil {
75+ if ! ShouldIncludeContent (ctx , * issue .User .Login , getGQLClient ) {
76+ return mcp .NewToolResultError ("Content from this user is filtered due to lack of push access to the trusted repository" ), nil
77+ }
78+ }
79+
7380 r , err := json .Marshal (issue )
7481 if err != nil {
7582 return nil , fmt .Errorf ("failed to marshal issue: %w" , err )
@@ -632,7 +639,7 @@ func UpdateIssue(getClient GetClientFn, t translations.TranslationHelperFunc) (t
632639}
633640
634641// GetIssueComments creates a tool to get comments for a GitHub issue.
635- func GetIssueComments (getClient GetClientFn , t translations.TranslationHelperFunc ) (tool mcp.Tool , handler server.ToolHandlerFunc ) {
642+ func GetIssueComments (getClient GetClientFn , getGQLClient GetGQLClientFn , t translations.TranslationHelperFunc ) (tool mcp.Tool , handler server.ToolHandlerFunc ) {
636643 return mcp .NewTool ("get_issue_comments" ,
637644 mcp .WithDescription (t ("TOOL_GET_ISSUE_COMMENTS_DESCRIPTION" , "Get comments for a specific issue in a GitHub repository." )),
638645 mcp .WithToolAnnotation (mcp.ToolAnnotation {
@@ -705,7 +712,17 @@ func GetIssueComments(getClient GetClientFn, t translations.TranslationHelperFun
705712 return mcp .NewToolResultError (fmt .Sprintf ("failed to get issue comments: %s" , string (body ))), nil
706713 }
707714
708- r , err := json .Marshal (comments )
715+ // Filter comments based on user permissions
716+ var filteredComments []* github.IssueComment
717+ for _ , comment := range comments {
718+ if comment .User != nil && comment .User .Login != nil {
719+ if ShouldIncludeContent (ctx , * comment .User .Login , getGQLClient ) {
720+ filteredComments = append (filteredComments , comment )
721+ }
722+ }
723+ }
724+
725+ r , err := json .Marshal (filteredComments )
709726 if err != nil {
710727 return nil , fmt .Errorf ("failed to marshal response: %w" , err )
711728 }
0 commit comments