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

Method HasAcceptedScope

pkg/scopes/map.go:72–88  ·  view source on GitHub ↗

HasAcceptedScope checks if any of the provided user scopes satisfy the tool's requirements.

(userScopes ...string)

Source from the content-addressed store, hash-verified

70
71// HasAcceptedScope checks if any of the provided user scopes satisfy the tool's requirements.
72func (t *ToolScopeInfo) HasAcceptedScope(userScopes ...string) bool {
73 if t == nil || len(t.AcceptedScopes) == 0 {
74 return true // No scopes required
75 }
76
77 userScopeSet := make(map[string]bool)
78 for _, scope := range userScopes {
79 userScopeSet[scope] = true
80 }
81
82 for _, scope := range t.AcceptedScopes {
83 if userScopeSet[scope] {
84 return true
85 }
86 }
87 return false
88}
89
90// MissingScopes returns the required scopes that are not present in the user's scopes.
91func (t *ToolScopeInfo) MissingScopes(userScopes ...string) []string {

Callers 2

WithScopeChallengeFunction · 0.80

Calls

no outgoing calls

Tested by 1