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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 53d474e90f159408325d95bf24d519e93a5f82b2b00258dc756300dd6ae04365
4
- data.tar.gz: f38095e894a2ae6b3aba6744aadfaf529d8aa9029f7f1b0f0c4992516e2beb93
3
+ metadata.gz: 46864199e9aea2b6d1e7b9b9c065109f3f70a012c35cc68a632a8fe39fd1ff06
4
+ data.tar.gz: a3cbbe5460b4c2d36e84a1d25fa3481e82ab678d1cd12dfef083819db352feb4
5
5
  SHA512:
6
- metadata.gz: 67040a2d30ec66489b8dd99f7d995f7f93e36f353e935384d8205b51d8d4103438f3ea83f8ead1397ef8afd0f54b823f76f513f3d5fe4613a0316de380d8b5a4
7
- data.tar.gz: 75e1d06bb502e402beb4f8aa85c5ede2ab741017526cd7ed413130ab6c12edeb20a77ce3fdb7cccaf859103de82d24389d029a041271b90bf79fa8938835217b
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]) }
@@ -1,3 +1,3 @@
1
1
  module RailsMcpEngine
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_mcp_engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soonoh Jung