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

Function attachRepoVisibilityIFCLabel

pkg/github/ifc_labels.go:48–65  ·  view source on GitHub ↗

attachRepoVisibilityIFCLabel attaches an IFC label derived from a single repository's visibility to a successful tool result when IFC labels are enabled. The concrete label is produced by labelFn, which receives whether the repository is private. The repository visibility is resolved via FetchRepoI

(
	ctx context.Context,
	deps ToolDependencies,
	client *github.Client,
	owner, repo string,
	r *mcp.CallToolResult,
	labelFn func(isPrivate bool) ifc.SecurityLabel,
)

Source from the content-addressed store, hash-verified

46// is omitted rather than risking a misclassification. Error results and the
47// disabled-feature case are left untouched.
48func attachRepoVisibilityIFCLabel(
49 ctx context.Context,
50 deps ToolDependencies,
51 client *github.Client,
52 owner, repo string,
53 r *mcp.CallToolResult,
54 labelFn func(isPrivate bool) ifc.SecurityLabel,
55) *mcp.CallToolResult {
56 if !shouldAttachIFCLabel(ctx, deps, r) {
57 return r
58 }
59 isPrivate, err := FetchRepoIsPrivate(ctx, client, owner, repo)
60 if err != nil {
61 return r
62 }
63 setIFCLabel(r, labelFn(isPrivate))
64 return r
65}
66
67// ifcSearchPostProcessOption returns a searchOption that attaches IFC labels to
68// a multi-repository search result. The feature-flag check is centralized here

Callers 15

GetCommitFunction · 0.85
ListCommitsFunction · 0.85
ListBranchesFunction · 0.85
ListTagsFunction · 0.85
GetTagFunction · 0.85
ListReleasesFunction · 0.85
GetLatestReleaseFunction · 0.85
GetReleaseByTagFunction · 0.85
GetRepositoryTreeFunction · 0.85
ActionsListFunction · 0.85
ActionsGetFunction · 0.85

Calls 3

shouldAttachIFCLabelFunction · 0.85
FetchRepoIsPrivateFunction · 0.85
setIFCLabelFunction · 0.85

Tested by

no test coverage detected