attachRepoVisibilityIFCLabelLazy is like attachRepoVisibilityIFCLabel but resolves the REST client itself, only when IFC labels are enabled. It is used by tools whose handler holds a GraphQL client (or no client yet) and would otherwise have to acquire a REST client solely to compute the label. The
( ctx context.Context, deps ToolDependencies, owner, repo string, r *mcp.CallToolResult, labelFn func(isPrivate bool) ifc.SecurityLabel, )
| 84 | // unconditionally; if the client cannot be obtained or the visibility lookup |
| 85 | // fails, the label is omitted rather than risking a misclassification. |
| 86 | func attachRepoVisibilityIFCLabelLazy( |
| 87 | ctx context.Context, |
| 88 | deps ToolDependencies, |
| 89 | owner, repo string, |
| 90 | r *mcp.CallToolResult, |
| 91 | labelFn func(isPrivate bool) ifc.SecurityLabel, |
| 92 | ) *mcp.CallToolResult { |
| 93 | if !shouldAttachIFCLabel(ctx, deps, r) { |
| 94 | return r |
| 95 | } |
| 96 | client, err := deps.GetClient(ctx) |
| 97 | if err != nil { |
| 98 | return r |
| 99 | } |
| 100 | return attachRepoVisibilityIFCLabel(ctx, deps, client, owner, repo, r, labelFn) |
| 101 | } |
| 102 | |
| 103 | // attachJoinedIFCLabel attaches an IFC label computed by joining a set of |
| 104 | // per-item visibilities (true == private) when IFC labels are enabled. joinFn |
no test coverage detected