active_mcp 0.10.4 → 0.10.6
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 +4 -4
- data/README.md +8 -6
- data/lib/active_mcp/completion.rb +2 -2
- data/lib/active_mcp/engine.rb +3 -6
- data/lib/active_mcp/server/fetcher.rb +1 -0
- data/lib/active_mcp/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93ccaa05722a21cba3848bdd01f1e06093336995c160a95627d0ce959bc43c41
|
4
|
+
data.tar.gz: 21c775034a7dfbdab65bdab4dd9875920a80a0f8398f600f7ce7edfe6775f174
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c82327781df5e274a63cdf39156e962906ad8dc572ea20a52a27a5b1f9a1bad21d499fa71fc0b3d1384508f3d894a480ac95e5bfc4e34de13d3f51fe80a48a5e
|
7
|
+
data.tar.gz: db3f5fb7f7ca0d6e97bda8b3cbce693b950df17a4f3378e8ce3903932ee52c8ef708c02dd94b9ed59bc5b2fa2c842e937c05a4e0d1a8934ce036863ac8eeb8c9
|
data/README.md
CHANGED
@@ -350,6 +350,12 @@ Resources are Ruby classes `**Resource`:
|
|
350
350
|
|
351
351
|
```ruby
|
352
352
|
class UserResource < ActiveMcp::Resource::Base
|
353
|
+
class << self
|
354
|
+
def mime_type
|
355
|
+
"application/json"
|
356
|
+
end
|
357
|
+
end
|
358
|
+
|
353
359
|
def initialize(id:)
|
354
360
|
@user = User.find(id)
|
355
361
|
end
|
@@ -362,10 +368,6 @@ class UserResource < ActiveMcp::Resource::Base
|
|
362
368
|
"data://localhost/users/#{@user.id}"
|
363
369
|
end
|
364
370
|
|
365
|
-
def mime_type
|
366
|
-
"application/json"
|
367
|
-
end
|
368
|
-
|
369
371
|
def description
|
370
372
|
@user.profile
|
371
373
|
end
|
@@ -482,7 +484,7 @@ class UserResource < ActiveMcp::Resource::Base
|
|
482
484
|
end
|
483
485
|
end
|
484
486
|
|
485
|
-
argument :id, complete: ->(value) do
|
487
|
+
argument :id, complete: ->(value, context) do
|
486
488
|
User.all.pluck(:id).filter { _1.match(value) }
|
487
489
|
end
|
488
490
|
|
@@ -528,7 +530,7 @@ Resources are Ruby classes `**Prompt`:
|
|
528
530
|
|
529
531
|
```ruby
|
530
532
|
class HelloPrompt < ActiveMcp::Prompt::Base
|
531
|
-
argument :name, required: true, description: "User name", complete: ->(value) do
|
533
|
+
argument :name, required: true, description: "User name", complete: ->(value, context) do
|
532
534
|
User.all.pluck(:name).filter { _1.match(value) }
|
533
535
|
end
|
534
536
|
|
@@ -8,11 +8,11 @@ module ActiveMcp
|
|
8
8
|
|
9
9
|
if uri_template
|
10
10
|
resource_class = refs.find { _1.uri_template == uri_template }
|
11
|
-
values = resource_class.arguments[arg_name.to_sym].call(value)
|
11
|
+
values = resource_class.arguments[arg_name.to_sym].call(value, context)
|
12
12
|
{values:, total: values.length}
|
13
13
|
elsif ref_name
|
14
14
|
prompt = refs.find { _1.prompt_name == ref_name }
|
15
|
-
values = prompt.class.arguments.find { _1[:name] == arg_name.to_sym }[:complete].call(value)
|
15
|
+
values = prompt.class.arguments.find { _1[:name] == arg_name.to_sym }[:complete].call(value, context)
|
16
16
|
{values:, total: values.length}
|
17
17
|
end
|
18
18
|
end
|
data/lib/active_mcp/engine.rb
CHANGED
@@ -6,14 +6,11 @@ module ActiveMcp
|
|
6
6
|
[
|
7
7
|
Rails.root.join("app", "mcp", "tools"),
|
8
8
|
Rails.root.join("app", "mcp", "resources"),
|
9
|
-
Rails.root.join("app", "mcp", "resource_templates"),
|
10
9
|
Rails.root.join("app", "mcp", "prompts"),
|
11
10
|
Rails.root.join("app", "mcp", "schemas")
|
12
|
-
].each do |
|
13
|
-
if Dir.exist?(
|
14
|
-
|
15
|
-
require_dependency file
|
16
|
-
end
|
11
|
+
].each do |path|
|
12
|
+
if Dir.exist?(path)
|
13
|
+
app.autoloaders.main.push_dir(path)
|
17
14
|
end
|
18
15
|
end
|
19
16
|
end
|
data/lib/active_mcp/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_mcp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Moeki Kawakami
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-04-
|
11
|
+
date: 2025-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|