Class: Hitch::MCP::Context
- Inherits:
-
Object
- Object
- Hitch::MCP::Context
- Defined in:
- app/models/hitch/mcp/context.rb
Overview
Frozen, request-local authority envelope passed to host MCP policy and behavior. Host and Active Record references are intentionally preserved as opaque references; freezing this envelope does not claim to freeze those objects.
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#client_id ⇒ Object
readonly
Returns the value of attribute client_id.
-
#granted_scopes ⇒ Object
readonly
Returns the value of attribute granted_scopes.
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
-
#principal ⇒ Object
readonly
Returns the value of attribute principal.
-
#protocol_version ⇒ Object
readonly
Returns the value of attribute protocol_version.
-
#remote_ip ⇒ Object
readonly
Returns the value of attribute remote_ip.
-
#request_id ⇒ Object
readonly
Returns the value of attribute request_id.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
-
#user_agent ⇒ Object
readonly
Returns the value of attribute user_agent.
Instance Method Summary collapse
-
#initialize(principal:, access_token:, scope:, granted_scopes:, client_id:, resource:, request_id:, remote_ip:, user_agent:, protocol_version:, meta:) ⇒ Context
constructor
A new instance of Context.
Constructor Details
#initialize(principal:, access_token:, scope:, granted_scopes:, client_id:, resource:, request_id:, remote_ip:, user_agent:, protocol_version:, meta:) ⇒ Context
Returns a new instance of Context.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/models/hitch/mcp/context.rb', line 13 def initialize( principal:, access_token:, scope:, granted_scopes:, client_id:, resource:, request_id:, remote_ip:, user_agent:, protocol_version:, meta: ) raise ArgumentError, "principal is required" if principal.nil? raise ArgumentError, "access_token is required" if access_token.nil? @principal = principal @access_token = access_token @scope = scope @granted_scopes = copy_scopes(granted_scopes) @client_id = copy_required_string(client_id, "client_id") @resource = copy_required_string(resource, "resource") @request_id = copy_request_id(request_id) @remote_ip = copy_required_string(remote_ip, "remote_ip") @user_agent = copy_optional_string(user_agent, "user_agent") @protocol_version = copy_required_string(protocol_version, "protocol_version") @meta = () freeze end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
10 11 12 |
# File 'app/models/hitch/mcp/context.rb', line 10 def access_token @access_token end |
#client_id ⇒ Object (readonly)
Returns the value of attribute client_id.
10 11 12 |
# File 'app/models/hitch/mcp/context.rb', line 10 def client_id @client_id end |
#granted_scopes ⇒ Object (readonly)
Returns the value of attribute granted_scopes.
10 11 12 |
# File 'app/models/hitch/mcp/context.rb', line 10 def granted_scopes @granted_scopes end |
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
10 11 12 |
# File 'app/models/hitch/mcp/context.rb', line 10 def @meta end |
#principal ⇒ Object (readonly)
Returns the value of attribute principal.
10 11 12 |
# File 'app/models/hitch/mcp/context.rb', line 10 def principal @principal end |
#protocol_version ⇒ Object (readonly)
Returns the value of attribute protocol_version.
10 11 12 |
# File 'app/models/hitch/mcp/context.rb', line 10 def protocol_version @protocol_version end |
#remote_ip ⇒ Object (readonly)
Returns the value of attribute remote_ip.
10 11 12 |
# File 'app/models/hitch/mcp/context.rb', line 10 def remote_ip @remote_ip end |
#request_id ⇒ Object (readonly)
Returns the value of attribute request_id.
10 11 12 |
# File 'app/models/hitch/mcp/context.rb', line 10 def request_id @request_id end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
10 11 12 |
# File 'app/models/hitch/mcp/context.rb', line 10 def resource @resource end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
10 11 12 |
# File 'app/models/hitch/mcp/context.rb', line 10 def scope @scope end |
#user_agent ⇒ Object (readonly)
Returns the value of attribute user_agent.
10 11 12 |
# File 'app/models/hitch/mcp/context.rb', line 10 def user_agent @user_agent end |