MCPcopy
hub / github.com/github/github-mcp-server / attachRepoVisibilityIFCLabelLazy

Function attachRepoVisibilityIFCLabelLazy

pkg/github/ifc_labels.go:86–101  ·  view source on GitHub ↗

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,
)

Source from the content-addressed store, hash-verified

84// unconditionally; if the client cannot be obtained or the visibility lookup
85// fails, the label is omitted rather than risking a misclassification.
86func 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

Callers 8

ListIssueTypesFunction · 0.85
ListIssueFieldsFunction · 0.85
ListDiscussionsFunction · 0.85
GetDiscussionFunction · 0.85
GetDiscussionCommentsFunction · 0.85
ListDiscussionCategoriesFunction · 0.85
GetLabelFunction · 0.85
ListLabelsFunction · 0.85

Calls 3

shouldAttachIFCLabelFunction · 0.85
GetClientMethod · 0.65

Tested by

no test coverage detected