active_mcp 0.10.3 → 0.10.4
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e5f0c16d5def1392e446cb729d43ec33699f3162662657b13c60ee28b796d87
|
4
|
+
data.tar.gz: 1fa830ca3cac342d8474aab4bf5ffdcd6b5d3c93d13e8818e0576135ae9d7dc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 985e527de84d6d16a879a3c4f54a202d95145e7a35edd78d3f692141370993278d298a62341be892f8f9a83b04bea7411607db0c98410112287544bb8e9d5abf
|
7
|
+
data.tar.gz: c2bf6587bf7725f23f345ac21f43d113e7fb4eb8b9f2a20631f42492f06ceddac18351adc732a35ac7b655f051917bbad90ec15656c3d5d41be75bb5f711dd1d
|
data/README.md
CHANGED
@@ -456,7 +456,7 @@ MCP Resource Teamplates allow you to define template of resources.
|
|
456
456
|
|
457
457
|
### Creating Resource Templates
|
458
458
|
|
459
|
-
|
459
|
+
Resource teamplates are Ruby classes `**Resource`:
|
460
460
|
|
461
461
|
```ruby
|
462
462
|
class UserResource < ActiveMcp::Resource::Base
|
@@ -482,7 +482,7 @@ class UserResource < ActiveMcp::Resource::Base
|
|
482
482
|
end
|
483
483
|
end
|
484
484
|
|
485
|
-
argument :id, ->(value) do
|
485
|
+
argument :id, complete: ->(value) do
|
486
486
|
User.all.pluck(:id).filter { _1.match(value) }
|
487
487
|
end
|
488
488
|
|
@@ -6,16 +6,13 @@ module ActiveMcp
|
|
6
6
|
class << self
|
7
7
|
attr_reader :schema, :arguments
|
8
8
|
|
9
|
-
def resource_template_name
|
10
|
-
end
|
11
|
-
|
12
9
|
def description
|
13
10
|
end
|
14
11
|
|
15
12
|
def mime_type
|
16
13
|
end
|
17
14
|
|
18
|
-
def argument(name, complete)
|
15
|
+
def argument(name, complete:)
|
19
16
|
@arguments = {}
|
20
17
|
@arguments[name] = complete
|
21
18
|
end
|
@@ -9,7 +9,7 @@ module ActiveMcp
|
|
9
9
|
|
10
10
|
def visible_resources
|
11
11
|
resources&.filter do |resource|
|
12
|
-
!resource.
|
12
|
+
!resource.respond_to?(:visible?) || resource.visible?(context: @context)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -18,7 +18,7 @@ module ActiveMcp
|
|
18
18
|
resource.class.respond_to?(:uri_template) && (!resource.respond_to?(:visible?) || resource.visible?(context: @context))
|
19
19
|
end
|
20
20
|
|
21
|
-
resource_instances.map(&:class)
|
21
|
+
resource_instances.map(&:class).uniq
|
22
22
|
end
|
23
23
|
|
24
24
|
def visible_tools
|
data/lib/active_mcp/version.rb
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
-
class <%= class_name %>
|
1
|
+
class <%= class_name %> < ActiveMcp::Resource::Base
|
2
|
+
class << self
|
3
|
+
def mime_type
|
4
|
+
"application/json"
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
2
8
|
def resource_name
|
3
9
|
"<%= file_name %>"
|
4
10
|
end
|
@@ -6,10 +12,6 @@ class <%= class_name %>
|
|
6
12
|
def uri
|
7
13
|
"data://localhost/<%= file_name %>"
|
8
14
|
end
|
9
|
-
|
10
|
-
def mime_type
|
11
|
-
"application/json"
|
12
|
-
end
|
13
15
|
|
14
16
|
def description
|
15
17
|
"<%= file_name.humanize %>"
|