@@ -17,11 +17,10 @@ import (
1717
1818// ToolScopeInfo contains scope information for a single tool.
1919type ToolScopeInfo struct {
20- Name string `json:"name"`
21- Toolset string `json:"toolset"`
22- ReadOnly bool `json:"read_only"`
23- RequiredScopes []string `json:"required_scopes"`
24- AcceptedScopes []string `json:"accepted_scopes,omitempty"`
20+ Name string `json:"name"`
21+ Toolset string `json:"toolset"`
22+ ReadOnly bool `json:"read_only"`
23+ ChallengeScopes []string `json:"challenge_scopes,omitempty"`
2524}
2625
2726// ScopesOutput is the full output structure for the list-scopes command.
@@ -36,12 +35,11 @@ type ScopesOutput struct {
3635
3736var listScopesCmd = & cobra.Command {
3837 Use : "list-scopes" ,
39- Short : "List required OAuth scopes for enabled tools" ,
40- Long : `List the required OAuth scopes for all enabled tools.
38+ Short : "List OAuth scope policies for enabled tools" ,
39+ Long : `List the OAuth challenge scopes for all enabled tools.
4140
4241This command creates an inventory based on the same flags as the stdio command
43- and outputs the required OAuth scopes for each enabled tool. This is useful for
44- determining what scopes a token needs to use specific tools.
42+ and outputs the scopes each enabled tool may request in an OAuth challenge.
4543
4644The output format can be controlled with the --output flag:
4745 - text (default): Human-readable text output
@@ -153,30 +151,27 @@ func collectToolScopes(inv *inventory.Inventory, readOnly bool) ScopesOutput {
153151 for _ , serverTool := range availableTools {
154152 tool := serverTool .Tool
155153
156- // Get scope information directly from ServerTool
157- requiredScopes := serverTool .RequiredScopes
158- acceptedScopes := serverTool .AcceptedScopes
154+ challengeScopes := serverTool .ScopeAccess .Scopes
159155
160156 // Determine if tool is read-only
161157 isReadOnly := serverTool .IsReadOnly ()
162158
163159 toolInfo := ToolScopeInfo {
164- Name : tool .Name ,
165- Toolset : string (serverTool .Toolset .ID ),
166- ReadOnly : isReadOnly ,
167- RequiredScopes : requiredScopes ,
168- AcceptedScopes : acceptedScopes ,
160+ Name : tool .Name ,
161+ Toolset : string (serverTool .Toolset .ID ),
162+ ReadOnly : isReadOnly ,
163+ ChallengeScopes : challengeScopes ,
169164 }
170165 tools = append (tools , toolInfo )
171166
172167 // Track unique scopes
173- for _ , s := range requiredScopes {
168+ for _ , s := range challengeScopes {
174169 scopeSet [s ] = true
175170 toolsByScope [s ] = append (toolsByScope [s ], tool .Name )
176171 }
177172
178173 // Track scopes by tool
179- scopesByTool [tool .Name ] = requiredScopes
174+ scopesByTool [tool .Name ] = challengeScopes
180175 }
181176
182177 // Sort tools by name
@@ -225,7 +220,7 @@ func outputSummary(output ScopesOutput) error {
225220 return nil
226221 }
227222
228- fmt .Println ("Required OAuth scopes for enabled tools:" )
223+ fmt .Println ("OAuth scope policies for enabled tools:" )
229224 fmt .Println ()
230225 for _ , scope := range output .UniqueScopes {
231226 fmt .Printf (" %s\n " , formatScopeDisplay (scope ))
@@ -235,8 +230,8 @@ func outputSummary(output ScopesOutput) error {
235230}
236231
237232func outputText (output ScopesOutput ) error {
238- fmt .Printf ("OAuth Scopes for Enabled Tools\n " )
239- fmt .Printf ("==============================\n \n " )
233+ fmt .Printf ("OAuth Challenge Scopes for Enabled Tools\n " )
234+ fmt .Printf ("======================================== \n \n " )
240235
241236 fmt .Printf ("Enabled Toolsets: %s\n " , strings .Join (output .EnabledToolsets , ", " ))
242237 fmt .Printf ("Read-Only Mode: %v\n \n " , output .ReadOnly )
@@ -265,8 +260,8 @@ func outputText(output ScopesOutput) error {
265260 }
266261
267262 scopeStr := "(no scope required)"
268- if len (tool .RequiredScopes ) > 0 {
269- scopeStr = strings .Join (tool .RequiredScopes , ", " )
263+ if len (tool .ChallengeScopes ) > 0 {
264+ scopeStr = strings .Join (tool .ChallengeScopes , ", " )
270265 }
271266
272267 fmt .Printf (" %s %s: %s\n " , rwIndicator , tool .Name , scopeStr )
@@ -278,9 +273,9 @@ func outputText(output ScopesOutput) error {
278273 fmt .Println ("## Summary" )
279274 fmt .Println ()
280275 if len (output .UniqueScopes ) == 0 {
281- fmt .Println ("No OAuth scopes required for enabled tools." )
276+ fmt .Println ("No OAuth scopes are used by enabled tools." )
282277 } else {
283- fmt .Println ("Unique scopes required :" )
278+ fmt .Println ("Unique challenge scopes :" )
284279 for _ , scope := range output .UniqueScopes {
285280 fmt .Printf (" • %s\n " , formatScopeDisplay (scope ))
286281 }
0 commit comments