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

Function searchIssuesIFCPostProcess

pkg/github/issues.go:1596–1622  ·  view source on GitHub ↗

searchIssuesIFCPostProcess returns a searchPostProcessFn that attaches the IFC label for a search_issues result. It looks up the visibility (and, for private repos, collaborators) of every repository represented in the search payload and joins the labels via ifc.LabelSearchIssues. If any per-repo lo

(deps ToolDependencies)

Source from the content-addressed store, hash-verified

1594// payload and joins the labels via ifc.LabelSearchIssues. If any per-repo
1595// lookup fails the label is omitted to avoid misclassifying the result.
1596func searchIssuesIFCPostProcess(deps ToolDependencies) searchPostProcessFn {
1597 return func(ctx context.Context, result *github.IssuesSearchResult, callResult *mcp.CallToolResult) {
1598 if callResult == nil || callResult.IsError || result == nil {
1599 return
1600 }
1601
1602 client, err := deps.GetClient(ctx)
1603 if err != nil {
1604 return
1605 }
1606
1607 uniqueRepos := uniqueSearchIssuesRepos(result)
1608 visibilities := make([]bool, 0, len(uniqueRepos))
1609 for _, r := range uniqueRepos {
1610 isPrivate, err := FetchRepoIsPrivate(ctx, client, r.owner, r.repo)
1611 if err != nil {
1612 return
1613 }
1614 visibilities = append(visibilities, isPrivate)
1615 }
1616
1617 if callResult.Meta == nil {
1618 callResult.Meta = mcp.Meta{}
1619 }
1620 callResult.Meta["ifc"] = ifc.LabelSearchIssues(visibilities)
1621 }
1622}
1623
1624type searchIssuesRepoRef struct {
1625 owner string

Callers 1

Calls 4

LabelSearchIssuesFunction · 0.92
uniqueSearchIssuesReposFunction · 0.85
FetchRepoIsPrivateFunction · 0.85
GetClientMethod · 0.65

Tested by

no test coverage detected