actionmcp 0.200.0 → 0.200.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5959fcdcfdeed27a18bc9723f51bbfb3699d0983172875e4c8dc9cc6873eadf4
4
- data.tar.gz: 04ce30167f6377c54dc92e574dc50d027bb9a6f76355d3c96bde33de99ada463
3
+ metadata.gz: 118756ad7f1d96015639b84e552f84b48c960cafc984eac27ca983239369334e
4
+ data.tar.gz: 109bec7847cac78e0b5436c5cf990b37873241d94e8ee067d5f2448e8f851180
5
5
  SHA512:
6
- metadata.gz: 7cd9b2994aca071515bd4141186ba95e352f0af355b817b38e45df672ce85d4b404e67df88d98523bb7b8bd5da60ed05aecf163fe5371a24f199c04eb5a3915a
7
- data.tar.gz: 89de790b55becb12ab8c991a0fffe569c70ebef2ec01a0d29135313708be7cae2a5aa27a6fd9de295c9a5d078e6d4ffe57b91c5395a4133e1c29408a46c35402
6
+ metadata.gz: 2ca91637228275486f5a8d58fb21f7c2459445545a5cde0695c5b4a855b8328132f1b56e35b1846307357c8394e9f5a1c25e782ec52b2456d4faf61aa2d3ce5a
7
+ data.tar.gz: 60a172fc7b6d20fe82b7a55ebc95c5cc8f63b45012d397b5f0dae6d6f5499d345ac336542029919ecfff49bda2669c1d728b23d661ad39a65aa201a2163a6e19
@@ -27,7 +27,6 @@
27
27
  #
28
28
  # [callbacks]
29
29
  # before_create = [{ method = "initialize_registries" }, { method = "set_server_info", if = ["proc"] }, { method = "set_server_capabilities", if = ["proc"] }]
30
- # after_initialize = [{ method = "proc" }]
31
30
  #
32
31
  # notes = ["messages:N_PLUS_ONE", "subscriptions:N_PLUS_ONE", "tasks:N_PLUS_ONE", "client_capabilities:NOT_NULL", "client_info:NOT_NULL", "prompt_registry:NOT_NULL", "protocol_version:NOT_NULL", "resource_registry:NOT_NULL", "server_capabilities:NOT_NULL", "server_info:NOT_NULL", "tool_registry:NOT_NULL", "id:LIMIT", "protocol_version:LIMIT", "role:LIMIT", "status:LIMIT", "status:INDEX"]
33
32
  # <rails-lens:schema:end>
@@ -38,10 +37,6 @@ module ActionMCP
38
37
  # such as client and server capabilities, protocol version, and session status.
39
38
  # It also manages the association with messages and subscriptions related to the session.
40
39
  class Session < ApplicationRecord
41
- after_initialize do
42
- self.consents = {} if consents == "{}" || consents.nil?
43
- end
44
-
45
40
  include MCPConsoleHelpers
46
41
  attribute :id, :string, default: -> { SecureRandom.hex(16) }
47
42
  has_many :messages,
@@ -363,33 +358,34 @@ module ActionMCP
363
358
  # Consent management methods as per MCP specification
364
359
  # These methods manage user consents for tools and resources
365
360
 
361
+ def consents
362
+ value = super
363
+ return {} if value.nil? || value == ""
364
+
365
+ value.is_a?(String) ? JSON.parse(value) : value
366
+ end
367
+
366
368
  # Checks if consent has been granted for a specific key
367
369
  # @param key [String] The consent key (e.g., tool name or resource URI)
368
370
  # @return [Boolean] true if consent is granted, false otherwise
369
371
  def consent_granted_for?(key)
370
- consents_hash = consents.is_a?(String) ? JSON.parse(consents) : consents
371
- consents_hash&.key?(key) && consents_hash[key] == true
372
+ consents[key] == true
372
373
  end
373
374
 
374
375
  # Grants consent for a specific key
375
376
  # @param key [String] The consent key to grant
376
377
  # @return [Boolean] true if saved successfully
377
378
  def grant_consent(key)
378
- self.consents = JSON.parse(consents) if consents.is_a?(String)
379
- self.consents ||= {}
380
- self.consents[key] = true
381
- save!
379
+ update!(consents: consents.merge(key => true))
382
380
  end
383
381
 
384
382
  # Revokes consent for a specific key
385
383
  # @param key [String] The consent key to revoke
386
384
  # @return [void]
387
385
  def revoke_consent(key)
388
- self.consents = JSON.parse(self.consents) if self.consents.is_a?(String)
389
- return unless consents&.key?(key)
386
+ return unless consents.key?(key)
390
387
 
391
- consents.delete(key)
392
- save!
388
+ update!(consents: consents.except(key))
393
389
  end
394
390
 
395
391
  private
@@ -2,7 +2,7 @@
2
2
 
3
3
  require_relative "gem_version"
4
4
  module ActionMCP
5
- VERSION = "0.200.0"
5
+ VERSION = "0.200.1"
6
6
 
7
7
  class << self
8
8
  alias version gem_version
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionmcp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.200.0
4
+ version: 0.200.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abdelkader Boudih