@@ -228,7 +228,7 @@ func fragmentToIssue(fragment IssueFragment) *github.Issue {
228228}
229229
230230// GetIssue creates a tool to get details of a specific issue in a GitHub repository.
231- func IssueRead (getClient GetClientFn ,getGQLClient GetGQLClientFn ,t translations.TranslationHelperFunc ,flags FeatureFlags ) (tool mcp.Tool ,handler server.ToolHandlerFunc ) {
231+ func IssueRead (getClient GetClientFn ,getGQLClient GetGQLClientFn ,cache * lockdown. RepoAccessCache , t translations.TranslationHelperFunc ,flags FeatureFlags ) (tool mcp.Tool ,handler server.ToolHandlerFunc ) {
232232return mcp .NewTool ("issue_read" ,
233233mcp .WithDescription (t ("TOOL_ISSUE_READ_DESCRIPTION" ,"Get information about a specific issue in a GitHub repository." )),
234234mcp .WithToolAnnotation (mcp.ToolAnnotation {
@@ -297,11 +297,11 @@ Options are:
297297
298298switch method {
299299case "get" :
300- return GetIssue (ctx ,client ,gqlClient ,owner ,repo ,issueNumber ,flags )
300+ return GetIssue (ctx ,client ,cache ,owner ,repo ,issueNumber ,flags )
301301case "get_comments" :
302- return GetIssueComments (ctx ,client ,gqlClient ,owner ,repo ,issueNumber ,pagination ,flags )
302+ return GetIssueComments (ctx ,client ,cache ,owner ,repo ,issueNumber ,pagination ,flags )
303303case "get_sub_issues" :
304- return GetSubIssues (ctx ,client ,gqlClient ,owner ,repo ,issueNumber ,pagination ,flags )
304+ return GetSubIssues (ctx ,client ,cache ,owner ,repo ,issueNumber ,pagination ,flags )
305305case "get_labels" :
306306return GetIssueLabels (ctx ,gqlClient ,owner ,repo ,issueNumber )
307307default :
@@ -310,7 +310,7 @@ Options are:
310310}
311311}
312312
313- func GetIssue (ctx context.Context ,client * github.Client ,gqlClient * githubv4. Client ,owner string ,repo string ,issueNumber int ,flags FeatureFlags ) (* mcp.CallToolResult ,error ) {
313+ func GetIssue (ctx context.Context ,client * github.Client ,cache * lockdown. RepoAccessCache ,owner string ,repo string ,issueNumber int ,flags FeatureFlags ) (* mcp.CallToolResult ,error ) {
314314issue ,resp ,err := client .Issues .Get (ctx ,owner ,repo ,issueNumber )
315315if err != nil {
316316return nil ,fmt .Errorf ("failed to get issue: %w" ,err )
@@ -326,8 +326,12 @@ func GetIssue(ctx context.Context, client *github.Client, gqlClient *githubv4.Cl
326326}
327327
328328if flags .LockdownMode {
329- if issue .User != nil {
330- isPrivate ,hasPushAccess ,err := lockdown .GetRepoAccessInfo (ctx ,gqlClient ,* issue .User .Login ,owner ,repo )
329+ if cache == nil {
330+ return nil ,fmt .Errorf ("lockdown cache is not configured" )
331+ }
332+ login := issue .GetUser ().GetLogin ()
333+ if login != "" {
334+ isPrivate ,hasPushAccess ,err := cache .GetRepoAccessInfo (ctx ,login ,owner ,repo )
331335if err != nil {
332336return mcp .NewToolResultError (fmt .Sprintf ("failed to check lockdown mode: %v" ,err )),nil
333337}
@@ -355,7 +359,7 @@ func GetIssue(ctx context.Context, client *github.Client, gqlClient *githubv4.Cl
355359return mcp .NewToolResultText (string (r )),nil
356360}
357361
358- func GetIssueComments (ctx context.Context ,client * github.Client ,gqlClient * githubv4. Client ,owner string ,repo string ,issueNumber int ,pagination PaginationParams ,flags FeatureFlags ) (* mcp.CallToolResult ,error ) {
362+ func GetIssueComments (ctx context.Context ,client * github.Client ,cache * lockdown. RepoAccessCache ,owner string ,repo string ,issueNumber int ,pagination PaginationParams ,flags FeatureFlags ) (* mcp.CallToolResult ,error ) {
359363opts := & github.IssueListCommentsOptions {
360364ListOptions : github.ListOptions {
361365Page :pagination .Page ,
@@ -377,9 +381,20 @@ func GetIssueComments(ctx context.Context, client *github.Client, gqlClient *git
377381return mcp .NewToolResultError (fmt .Sprintf ("failed to get issue comments: %s" ,string (body ))),nil
378382}
379383if flags .LockdownMode {
380- filteredComments := []* github.IssueComment {}
384+ if cache == nil {
385+ return nil ,fmt .Errorf ("lockdown cache is not configured" )
386+ }
387+ filteredComments := make ([]* github.IssueComment ,0 ,len (comments ))
381388for _ ,comment := range comments {
382- isPrivate ,hasPushAccess ,err := lockdown .GetRepoAccessInfo (ctx ,gqlClient ,* comment .User .Login ,owner ,repo )
389+ user := comment .User
390+ if user == nil {
391+ continue
392+ }
393+ login := user .GetLogin ()
394+ if login == "" {
395+ continue
396+ }
397+ isPrivate ,hasPushAccess ,err := cache .GetRepoAccessInfo (ctx ,login ,owner ,repo )
383398if err != nil {
384399return mcp .NewToolResultError (fmt .Sprintf ("failed to check lockdown mode: %v" ,err )),nil
385400}
@@ -402,7 +417,7 @@ func GetIssueComments(ctx context.Context, client *github.Client, gqlClient *git
402417return mcp .NewToolResultText (string (r )),nil
403418}
404419
405- func GetSubIssues (ctx context.Context ,client * github.Client ,gqlClient * githubv4. Client ,owner string ,repo string ,issueNumber int ,pagination PaginationParams ,featureFlags FeatureFlags ) (* mcp.CallToolResult ,error ) {
420+ func GetSubIssues (ctx context.Context ,client * github.Client ,cache * lockdown. RepoAccessCache ,owner string ,repo string ,issueNumber int ,pagination PaginationParams ,featureFlags FeatureFlags ) (* mcp.CallToolResult ,error ) {
406421opts := & github.IssueListOptions {
407422ListOptions : github.ListOptions {
408423Page :pagination .Page ,
@@ -430,9 +445,20 @@ func GetSubIssues(ctx context.Context, client *github.Client, gqlClient *githubv
430445}
431446
432447if featureFlags .LockdownMode {
433- filteredSubIssues := []* github.SubIssue {}
448+ if cache == nil {
449+ return nil ,fmt .Errorf ("lockdown cache is not configured" )
450+ }
451+ filteredSubIssues := make ([]* github.SubIssue ,0 ,len (subIssues ))
434452for _ ,subIssue := range subIssues {
435- isPrivate ,hasPushAccess ,err := lockdown .GetRepoAccessInfo (ctx ,gqlClient ,* subIssue .User .Login ,owner ,repo )
453+ user := subIssue .User
454+ if user == nil {
455+ continue
456+ }
457+ login := user .GetLogin ()
458+ if login == "" {
459+ continue
460+ }
461+ isPrivate ,hasPushAccess ,err := cache .GetRepoAccessInfo (ctx ,login ,owner ,repo )
436462if err != nil {
437463return mcp .NewToolResultError (fmt .Sprintf ("failed to check lockdown mode: %v" ,err )),nil
438464}