Exception: MCPClient::Errors::InsufficientScopeError

Inherits:
ConnectionError show all
Defined in:
lib/mcp_client/errors.rb

Overview

Raised for an HTTP 403 with a WWW-Authenticate insufficient_scope challenge (MCP 2025-11-25 / SEP-835). Exposes the challenge parameters so hosts can run a step-up authorization flow with the required scopes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, scope: nil, error_description: nil) ⇒ InsufficientScopeError

Returns a new instance of InsufficientScopeError.

Parameters:

  • message (String)

    error message

  • scope (String, nil) (defaults to: nil)

    scopes from the challenge's scope parameter

  • error_description (String, nil) (defaults to: nil)

    challenge error_description



50
51
52
53
54
# File 'lib/mcp_client/errors.rb', line 50

def initialize(message, scope: nil, error_description: nil)
  super(message)
  @scope = scope
  @error_description = error_description
end

Instance Attribute Details

#error_descriptionString? (readonly)

Returns the challenge's human-readable error description.

Returns:

  • (String, nil)

    the challenge's human-readable error description



45
46
47
# File 'lib/mcp_client/errors.rb', line 45

def error_description
  @error_description
end

#scopeString? (readonly)

Returns the scopes required by the server's challenge.

Returns:

  • (String, nil)

    the scopes required by the server's challenge



43
44
45
# File 'lib/mcp_client/errors.rb', line 43

def scope
  @scope
end