rails_mcp_engine 0.1.0 → 0.2.0
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 +17 -0
- data/app/services/tools/meta_tool_service.rb +11 -0
- data/lib/rails_mcp_engine/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 46864199e9aea2b6d1e7b9b9c065109f3f70a012c35cc68a632a8fe39fd1ff06
|
|
4
|
+
data.tar.gz: a3cbbe5460b4c2d36e84a1d25fa3481e82ab678d1cd12dfef083819db352feb4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a7f7134090f0de5dfb89878baf43ae74e6d5c0d9b9020744cdf4673f49e3daed9e0128e6d80c33d3e6fda0cd12af6b4e43e99307d6e44b817a88cf28e1952487
|
|
7
|
+
data.tar.gz: c7eb6c1be9166b14e06341b5ab10a097345fceb88790fceb432c20e09d0c3d707066f9d756e0e30aaa411e1f7d48d0d75f0e7b572ddc1d2cad897ec7987056c5
|
data/README.md
CHANGED
|
@@ -99,6 +99,23 @@ Tools::MetaToolService.new.register_tool(
|
|
|
99
99
|
|
|
100
100
|
These hooks are executed around the tool's entrypoint method for both RubyLLM and FastMCP wrappers.
|
|
101
101
|
|
|
102
|
+
## Using Tools in Host Application
|
|
103
|
+
|
|
104
|
+
You can easily fetch the generated RubyLLM tool classes for use in your host application (e.g., when calling an LLM API):
|
|
105
|
+
|
|
106
|
+
```ruby
|
|
107
|
+
# Fetch specific tool classes by name
|
|
108
|
+
tool_classes = Tools::MetaToolService.ruby_llm_tools(['book_meeting', 'calculator'])
|
|
109
|
+
|
|
110
|
+
# Use them with RubyLLM
|
|
111
|
+
response = RubyLLM.chat(
|
|
112
|
+
messages: messages,
|
|
113
|
+
tools: tool_classes,
|
|
114
|
+
model: 'gpt-4o'
|
|
115
|
+
)
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
|
|
102
119
|
## Development
|
|
103
120
|
|
|
104
121
|
After checking out the repo, run `bundle install` to install dependencies. Then, run `bundle exec rails test` to run the tests.
|
|
@@ -65,6 +65,17 @@ module Tools
|
|
|
65
65
|
{ error: "Could not find #{class_name}: #{e.message}" }
|
|
66
66
|
end
|
|
67
67
|
|
|
68
|
+
sig { params(tool_names: T::Array[String]).returns(T::Array[T.class_of(Object)]) }
|
|
69
|
+
def self.ruby_llm_tools(tool_names)
|
|
70
|
+
ToolMeta.registry.filter_map do |service_class|
|
|
71
|
+
schema = ToolSchema::Builder.build(service_class)
|
|
72
|
+
next unless tool_names.include?(schema[:name])
|
|
73
|
+
|
|
74
|
+
tool_class_name = ToolSchema::RubyLlmFactory.tool_class_name(service_class)
|
|
75
|
+
Tools.const_get(tool_class_name) if Tools.const_defined?(tool_class_name)
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
68
79
|
private
|
|
69
80
|
|
|
70
81
|
sig { params(query: T.nilable(String)).returns(T::Hash[Symbol, T.untyped]) }
|