@@ -18,7 +18,7 @@ import (
18
18
)
19
19
20
20
// 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 ) {
22
22
return mcp .NewTool ("get_issue" ,
23
23
mcp .WithDescription (t ("TOOL_GET_ISSUE_DESCRIPTION" ,"Get details of a specific issue in a GitHub repository." )),
24
24
mcp .WithToolAnnotation (mcp.ToolAnnotation {
@@ -70,6 +70,13 @@ func GetIssue(getClient GetClientFn, t translations.TranslationHelperFunc) (tool
70
70
return mcp .NewToolResultError (fmt .Sprintf ("failed to get issue: %s" ,string (body ))),nil
71
71
}
72
72
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
+
73
80
r ,err := json .Marshal (issue )
74
81
if err != nil {
75
82
return nil ,fmt .Errorf ("failed to marshal issue: %w" ,err )
@@ -632,7 +639,7 @@ func UpdateIssue(getClient GetClientFn, t translations.TranslationHelperFunc) (t
632
639
}
633
640
634
641
// 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 ) {
636
643
return mcp .NewTool ("get_issue_comments" ,
637
644
mcp .WithDescription (t ("TOOL_GET_ISSUE_COMMENTS_DESCRIPTION" ,"Get comments for a specific issue in a GitHub repository." )),
638
645
mcp .WithToolAnnotation (mcp.ToolAnnotation {
@@ -705,7 +712,17 @@ func GetIssueComments(getClient GetClientFn, t translations.TranslationHelperFun
705
712
return mcp .NewToolResultError (fmt .Sprintf ("failed to get issue comments: %s" ,string (body ))),nil
706
713
}
707
714
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 )
709
726
if err != nil {
710
727
return nil ,fmt .Errorf ("failed to marshal response: %w" ,err )
711
728
}