actionmcp 0.50.10 → 0.50.11
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/lib/action_mcp/tool.rb +18 -2
- data/lib/action_mcp/version.rb +1 -1
- data/lib/generators/action_mcp/prompt/templates/prompt.rb.erb +12 -8
- data/lib/generators/action_mcp/tool/templates/tool.rb.erb +38 -9
- data/lib/generators/action_mcp/tool/tool_generator.rb +31 -5
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a500e24390bf32c0e74cba14755f67257c91b69ba6ffe786e3b692efd82c87cc
|
4
|
+
data.tar.gz: d122b12b45799b719f077d742a1a5edd85eac4cbe96e2a85259eb7673c858f36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7878f2188781097208e5a703cdd6b3c6fcffa6cea0fef3db5e13538499bae935eebfc3ec6ffbbb77267f016023abe2c9b1e476b51b1d87910c81d4f44c5f4b7
|
7
|
+
data.tar.gz: 72048e1f3c8d3062bbc17840c14d5abfbc04fe620710d5dde9d3f98ce44a866347b95884fa03fb402d2d2cab078d7f9d6e9eb49690d338f29484b64fcad3caa5
|
data/lib/action_mcp/tool.rb
CHANGED
@@ -52,12 +52,28 @@ module ActionMCP
|
|
52
52
|
end
|
53
53
|
|
54
54
|
# Convenience methods for common annotations
|
55
|
+
def title(value = nil)
|
56
|
+
if value
|
57
|
+
annotate(:title, value)
|
58
|
+
else
|
59
|
+
_annotations["title"]
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
55
63
|
def destructive(enabled = true)
|
56
|
-
annotate(:
|
64
|
+
annotate(:destructiveHint, enabled)
|
57
65
|
end
|
58
66
|
|
59
67
|
def read_only(enabled = true)
|
60
|
-
annotate(:
|
68
|
+
annotate(:readOnlyHint, enabled)
|
69
|
+
end
|
70
|
+
|
71
|
+
def idempotent(enabled = true)
|
72
|
+
annotate(:idempotentHint, enabled)
|
73
|
+
end
|
74
|
+
|
75
|
+
def open_world(enabled = true)
|
76
|
+
annotate(:openWorldHint, enabled)
|
61
77
|
end
|
62
78
|
|
63
79
|
# Return annotations for the tool
|
data/lib/action_mcp/version.rb
CHANGED
@@ -6,16 +6,20 @@ class <%= class_name %> < ApplicationMCPPrompt
|
|
6
6
|
prompt_name "<%= prompt_name %>"
|
7
7
|
|
8
8
|
# Provide a user-facing description for your prompt.
|
9
|
-
description "
|
9
|
+
description "<%= description || 'Describe what this prompt does' %>"
|
10
10
|
|
11
|
-
# Configure arguments
|
12
|
-
argument :
|
13
|
-
argument :code, description: "Code to explain", required: true
|
11
|
+
# Configure arguments (example structure — override as needed)
|
12
|
+
argument :input, description: "Main input", required: true
|
14
13
|
|
15
|
-
#
|
16
|
-
|
14
|
+
# Optional: add more arguments if needed
|
15
|
+
# argument :context, description: "Context for the input", default: ""
|
17
16
|
|
18
|
-
#
|
19
|
-
|
17
|
+
# Optional: validations can be added as needed
|
18
|
+
# validates :input, presence: true
|
19
|
+
# validates :context, length: { maximum: 500 }
|
20
|
+
|
21
|
+
# Main logic for prompt
|
22
|
+
def perform
|
23
|
+
# Implement behavior here
|
20
24
|
end
|
21
25
|
end
|
@@ -1,17 +1,46 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Template for generating new tools.
|
4
3
|
class <%= class_name %> < ApplicationMCPTool
|
5
|
-
# Set the tool name.
|
6
4
|
tool_name "<%= tool_name %>"
|
7
|
-
description "
|
5
|
+
description "<%= description %>"
|
6
|
+
<% if options[:title] %>
|
7
|
+
title "<%= options[:title] %>"
|
8
|
+
<% end %>
|
9
|
+
<% if options[:read_only] %>
|
10
|
+
read_only
|
11
|
+
<% end %>
|
12
|
+
<% if options[:destructive] %>
|
13
|
+
destructive
|
14
|
+
<% end %>
|
15
|
+
<% if options[:idempotent] %>
|
16
|
+
idempotent
|
17
|
+
<% end %>
|
18
|
+
<% if options[:open_world] %>
|
19
|
+
open_world
|
20
|
+
<% end %>
|
21
|
+
<% annotations.each do |k, v| %>
|
22
|
+
<% unless [:read_only, :destructive, :idempotent, :open_world, :title].include?(k) %>
|
23
|
+
annotate(:<%= k %>, <%= v.inspect %>)
|
24
|
+
<% end %>
|
25
|
+
<% end %>
|
8
26
|
|
9
|
-
|
10
|
-
property :
|
11
|
-
|
27
|
+
<% if properties.empty? %>
|
28
|
+
property :input, type: "string", description: "Input", required: true
|
29
|
+
<% else %>
|
30
|
+
<% properties.each do |prop| %>
|
31
|
+
property :<%= prop[:name] %>, type: "<%= prop[:type] %>", description: "<%= prop[:description] %>"<%= ", required: true" if prop[:required] %>
|
32
|
+
<% end %>
|
33
|
+
<% end %>
|
12
34
|
|
13
|
-
|
14
|
-
|
15
|
-
|
35
|
+
def perform
|
36
|
+
render(text: "Processing <%= properties.map { |p| p[:name] }.join(', ') %>")
|
37
|
+
|
38
|
+
# Optional outputs:
|
39
|
+
# render(audio: "<base64_data>", mime_type: "audio/mpeg")
|
40
|
+
# render(image: "<base64_data>", mime_type: "image/png")
|
41
|
+
# render(resource: "file://path", mime_type: "application/json", text: "{}")
|
42
|
+
# render(resource: "file://path", mime_type: "application/octet-stream", blob: "<base64_data>")
|
43
|
+
rescue => e
|
44
|
+
render(error: ["Error: #{e.message}"])
|
16
45
|
end
|
17
46
|
end
|
@@ -7,32 +7,58 @@ module ActionMCP
|
|
7
7
|
source_root File.expand_path("templates", __dir__)
|
8
8
|
desc "Creates a Tool (in app/mcp/tools) that inherits from ApplicationMCPTool"
|
9
9
|
|
10
|
-
# The generator takes one argument, e.g. "CalculateSum"
|
11
10
|
argument :name, type: :string, required: true, banner: "ToolName"
|
12
11
|
|
12
|
+
class_option :description, type: :string, default: "Describe what this tool does"
|
13
|
+
class_option :read_only, type: :boolean, default: false
|
14
|
+
class_option :destructive, type: :boolean, default: false
|
15
|
+
class_option :category, type: :string, default: nil
|
16
|
+
class_option :properties, type: :array, default: [], banner: "name:type:description:required"
|
17
|
+
|
13
18
|
def create_tool_file
|
14
19
|
template "tool.rb.erb", "app/mcp/tools/#{file_name}.rb"
|
15
20
|
end
|
16
21
|
|
17
22
|
private
|
18
23
|
|
19
|
-
# Compute the class name ensuring it ends with "Tool"
|
20
24
|
def class_name
|
21
25
|
"#{name.camelize}#{name.camelize.end_with?('Tool') ? '' : 'Tool'}"
|
22
26
|
end
|
23
27
|
|
24
|
-
# Compute the file name ensuring it ends with _tool.rb
|
25
28
|
def file_name
|
26
29
|
base = name.underscore
|
27
30
|
base.end_with?("_tool") ? base : "#{base}_tool"
|
28
31
|
end
|
29
32
|
|
30
|
-
# Compute the DSL tool name (a dashed version, without the "Tool" suffix)
|
31
33
|
def tool_name
|
32
34
|
base = name.to_s
|
33
|
-
base = base
|
35
|
+
base = base.end_with?("Tool") ? base[0..-5] : base
|
34
36
|
base.underscore.dasherize
|
35
37
|
end
|
38
|
+
|
39
|
+
def description
|
40
|
+
options[:description]
|
41
|
+
end
|
42
|
+
|
43
|
+
def annotations
|
44
|
+
ann = {}
|
45
|
+
ann[:read_only] = true if options[:read_only]
|
46
|
+
ann[:destructive] = true if options[:destructive]
|
47
|
+
ann[:category] = options[:category] if options[:category]
|
48
|
+
ann
|
49
|
+
end
|
50
|
+
|
51
|
+
def properties
|
52
|
+
options[:properties].map do |prop|
|
53
|
+
parts = prop.split(":")
|
54
|
+
{
|
55
|
+
name: parts[0],
|
56
|
+
type: parts[1] || "string",
|
57
|
+
description: parts[2] || "No description provided",
|
58
|
+
required: parts[3] == "true"
|
59
|
+
}
|
60
|
+
end
|
61
|
+
end
|
36
62
|
end
|
37
63
|
end
|
38
64
|
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: actionmcp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.50.
|
4
|
+
version: 0.50.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Abdelkader Boudih
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: activerecord
|
@@ -220,7 +219,6 @@ metadata:
|
|
220
219
|
source_code_uri: https://github.com/seuros/action_mcp
|
221
220
|
changelog_uri: https://github.com/seuros/action_mcp/blob/master/CHANGELOG.md
|
222
221
|
rubygems_mfa_required: 'true'
|
223
|
-
post_install_message:
|
224
222
|
rdoc_options: []
|
225
223
|
require_paths:
|
226
224
|
- lib
|
@@ -235,8 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
235
233
|
- !ruby/object:Gem::Version
|
236
234
|
version: '0'
|
237
235
|
requirements: []
|
238
|
-
rubygems_version: 3.
|
239
|
-
signing_key:
|
236
|
+
rubygems_version: 3.6.7
|
240
237
|
specification_version: 4
|
241
238
|
summary: Provides essential tooling for building Model Context Protocol (MCP) capable
|
242
239
|
servers
|