shared_tools 0.2.3 → 0.3.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.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +3 -0
  3. data/README.md +594 -42
  4. data/lib/shared_tools/{ruby_llm/mcp → mcp}/github_mcp_server.rb +20 -3
  5. data/lib/shared_tools/mcp/imcp.rb +28 -0
  6. data/lib/shared_tools/mcp/tavily_mcp_server.rb +44 -0
  7. data/lib/shared_tools/mcp.rb +24 -0
  8. data/lib/shared_tools/tools/browser/base_driver.rb +64 -0
  9. data/lib/shared_tools/tools/browser/base_tool.rb +50 -0
  10. data/lib/shared_tools/tools/browser/click_tool.rb +54 -0
  11. data/lib/shared_tools/tools/browser/elements/element_grouper.rb +73 -0
  12. data/lib/shared_tools/tools/browser/elements/nearby_element_detector.rb +109 -0
  13. data/lib/shared_tools/tools/browser/formatters/action_formatter.rb +37 -0
  14. data/lib/shared_tools/tools/browser/formatters/data_entry_formatter.rb +135 -0
  15. data/lib/shared_tools/tools/browser/formatters/element_formatter.rb +52 -0
  16. data/lib/shared_tools/tools/browser/formatters/input_formatter.rb +59 -0
  17. data/lib/shared_tools/tools/browser/inspect_tool.rb +87 -0
  18. data/lib/shared_tools/tools/browser/inspect_utils.rb +51 -0
  19. data/lib/shared_tools/tools/browser/page_inspect/button_summarizer.rb +140 -0
  20. data/lib/shared_tools/tools/browser/page_inspect/form_summarizer.rb +98 -0
  21. data/lib/shared_tools/tools/browser/page_inspect/html_summarizer.rb +37 -0
  22. data/lib/shared_tools/tools/browser/page_inspect/link_summarizer.rb +103 -0
  23. data/lib/shared_tools/tools/browser/page_inspect_tool.rb +55 -0
  24. data/lib/shared_tools/tools/browser/page_screenshot_tool.rb +39 -0
  25. data/lib/shared_tools/tools/browser/selector_generator/base_selectors.rb +28 -0
  26. data/lib/shared_tools/tools/browser/selector_generator/contextual_selectors.rb +140 -0
  27. data/lib/shared_tools/tools/browser/selector_generator.rb +73 -0
  28. data/lib/shared_tools/tools/browser/selector_inspect_tool.rb +67 -0
  29. data/lib/shared_tools/tools/browser/text_field_area_set_tool.rb +45 -0
  30. data/lib/shared_tools/tools/browser/visit_tool.rb +43 -0
  31. data/lib/shared_tools/tools/browser/watir_driver.rb +132 -0
  32. data/lib/shared_tools/tools/browser.rb +27 -0
  33. data/lib/shared_tools/tools/browser_tool.rb +255 -0
  34. data/lib/shared_tools/tools/calculator_tool.rb +169 -0
  35. data/lib/shared_tools/tools/composite_analysis_tool.rb +520 -0
  36. data/lib/shared_tools/tools/computer/base_driver.rb +177 -0
  37. data/lib/shared_tools/tools/computer/mac_driver.rb +103 -0
  38. data/lib/shared_tools/tools/computer.rb +21 -0
  39. data/lib/shared_tools/tools/computer_tool.rb +207 -0
  40. data/lib/shared_tools/tools/data_science_kit.rb +707 -0
  41. data/lib/shared_tools/tools/database/base_driver.rb +17 -0
  42. data/lib/shared_tools/tools/database/postgres_driver.rb +30 -0
  43. data/lib/shared_tools/tools/database/sqlite_driver.rb +29 -0
  44. data/lib/shared_tools/tools/database.rb +9 -0
  45. data/lib/shared_tools/tools/database_query_tool.rb +313 -0
  46. data/lib/shared_tools/tools/database_tool.rb +99 -0
  47. data/lib/shared_tools/tools/devops_toolkit.rb +420 -0
  48. data/lib/shared_tools/tools/disk/base_driver.rb +91 -0
  49. data/lib/shared_tools/tools/disk/base_tool.rb +20 -0
  50. data/lib/shared_tools/tools/disk/directory_create_tool.rb +39 -0
  51. data/lib/shared_tools/tools/disk/directory_delete_tool.rb +39 -0
  52. data/lib/shared_tools/tools/disk/directory_list_tool.rb +37 -0
  53. data/lib/shared_tools/tools/disk/directory_move_tool.rb +40 -0
  54. data/lib/shared_tools/tools/disk/file_create_tool.rb +38 -0
  55. data/lib/shared_tools/tools/disk/file_delete_tool.rb +40 -0
  56. data/lib/shared_tools/tools/disk/file_move_tool.rb +43 -0
  57. data/lib/shared_tools/tools/disk/file_read_tool.rb +40 -0
  58. data/lib/shared_tools/tools/disk/file_replace_tool.rb +44 -0
  59. data/lib/shared_tools/tools/disk/file_write_tool.rb +40 -0
  60. data/lib/shared_tools/tools/disk/local_driver.rb +91 -0
  61. data/lib/shared_tools/tools/disk.rb +17 -0
  62. data/lib/shared_tools/tools/disk_tool.rb +132 -0
  63. data/lib/shared_tools/tools/doc/pdf_reader_tool.rb +79 -0
  64. data/lib/shared_tools/tools/doc.rb +8 -0
  65. data/lib/shared_tools/tools/doc_tool.rb +109 -0
  66. data/lib/shared_tools/tools/docker/base_tool.rb +56 -0
  67. data/lib/shared_tools/tools/docker/compose_run_tool.rb +77 -0
  68. data/lib/shared_tools/tools/docker.rb +8 -0
  69. data/lib/shared_tools/tools/error_handling_tool.rb +403 -0
  70. data/lib/shared_tools/tools/eval/python_eval_tool.rb +209 -0
  71. data/lib/shared_tools/tools/eval/ruby_eval_tool.rb +93 -0
  72. data/lib/shared_tools/tools/eval/shell_eval_tool.rb +64 -0
  73. data/lib/shared_tools/tools/eval.rb +10 -0
  74. data/lib/shared_tools/tools/eval_tool.rb +139 -0
  75. data/lib/shared_tools/tools/secure_tool_template.rb +353 -0
  76. data/lib/shared_tools/tools/version.rb +7 -0
  77. data/lib/shared_tools/tools/weather_tool.rb +197 -0
  78. data/lib/shared_tools/tools/workflow_manager_tool.rb +312 -0
  79. data/lib/shared_tools/tools.rb +16 -0
  80. data/lib/shared_tools/version.rb +1 -1
  81. data/lib/shared_tools.rb +9 -24
  82. metadata +189 -68
  83. data/lib/shared_tools/llm_rb/run_shell_command.rb +0 -23
  84. data/lib/shared_tools/llm_rb.rb +0 -9
  85. data/lib/shared_tools/omniai.rb +0 -9
  86. data/lib/shared_tools/raix/what_is_the_weather.rb +0 -18
  87. data/lib/shared_tools/raix.rb +0 -9
  88. data/lib/shared_tools/ruby_llm/edit_file.rb +0 -71
  89. data/lib/shared_tools/ruby_llm/incomplete/calculator_tool.rb +0 -70
  90. data/lib/shared_tools/ruby_llm/incomplete/composite_analysis_tool.rb +0 -89
  91. data/lib/shared_tools/ruby_llm/incomplete/data_science_kit.rb +0 -128
  92. data/lib/shared_tools/ruby_llm/incomplete/database_query_tool.rb +0 -100
  93. data/lib/shared_tools/ruby_llm/incomplete/devops_toolkit.rb +0 -112
  94. data/lib/shared_tools/ruby_llm/incomplete/error_handling_tool.rb +0 -109
  95. data/lib/shared_tools/ruby_llm/incomplete/secure_tool_template.rb +0 -117
  96. data/lib/shared_tools/ruby_llm/incomplete/weather_tool.rb +0 -110
  97. data/lib/shared_tools/ruby_llm/incomplete/workflow_manager_tool.rb +0 -145
  98. data/lib/shared_tools/ruby_llm/list_files.rb +0 -49
  99. data/lib/shared_tools/ruby_llm/mcp/imcp.rb +0 -15
  100. data/lib/shared_tools/ruby_llm/mcp.rb +0 -12
  101. data/lib/shared_tools/ruby_llm/pdf_page_reader.rb +0 -59
  102. data/lib/shared_tools/ruby_llm/python_eval.rb +0 -194
  103. data/lib/shared_tools/ruby_llm/read_file.rb +0 -40
  104. data/lib/shared_tools/ruby_llm/ruby_eval.rb +0 -77
  105. data/lib/shared_tools/ruby_llm/run_shell_command.rb +0 -49
  106. data/lib/shared_tools/ruby_llm.rb +0 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ed20a7f612a782d85ee23a5aa20d67170b5aa72f99588af0af2a8606dba6c8be
4
- data.tar.gz: f33a0de470155c604b8b76a0fc9c7f12680c76c0d37aa36f515ebcf3ad003dcd
3
+ metadata.gz: ccef2b45ebf2ea78e16ba617d73d1b9617203343bd9b5aad139f3eb72140c3ee
4
+ data.tar.gz: 67095ae417a67860aadd7b169233f3f40e93278b7d46d10feb4ffc0f8de27b71
5
5
  SHA512:
6
- metadata.gz: a11202bd167180f04ed7db1b057dc916b3bab1c873113021b05a55283ed8a7a44aa93dd351b77a7ebcc47ab93c1248d9e78271bc38918d4dfe82fdd841fe25c5
7
- data.tar.gz: 64f75f69015de591e4351126849665c227d718140634ba96f3fe8ac686abf7bbd5a1f7b917d4c6ee06ca131ba2c44d5ee93eae47abb493a8c21628052ef95105
6
+ metadata.gz: d01003df48f64af2e9743264f213ba46b27002a2bf4aa29384d803d9a096c7fefe05a63a2479182f851b72acba842fb9cebac5398aa9c0b5e0ebbbd9895a72eb
7
+ data.tar.gz: 7f6e1c51e2f174bb400cba67a999fbe422b483c0ea098b4031278c13d2766e65cb7799258e895ceebda6e9da02e8e7445f444d887667845964b59f1bd199c837
data/CHANGELOG.md CHANGED
@@ -3,6 +3,9 @@
3
3
  ## Unreleased
4
4
 
5
5
  ## Released
6
+ ### [0.3.0] 2025-11-08
7
+ - changed focus of shared_tools to only support the ruby_llm and ruby_llm-mcp ecosystem
8
+
6
9
  ### [0.2.1] 2025-07-03
7
10
  - iMCP server app for MacOS is noisy logger so redirect stderr to /dev/null
8
11
 
data/README.md CHANGED
@@ -1,68 +1,620 @@
1
1
  <div align="center">
2
- <h1>Shared Tools</h1>
3
- <img src="images/shared_tools.png" alt="Two Robots sharing the same set of tools.">
2
+ <h1>SharedTools</h1>
3
+ <img src="docs/assets/images/shared_tools.png" alt="Two Robots sharing the same set of tools" width="400">
4
+ <p><em>A Ruby gem providing LLM-callable tools for browser automation, file operations, code evaluation, and more</em></p>
5
+
6
+ [![Gem Version](https://badge.fury.io/rb/shared_tools.svg)](https://badge.fury.io/rb/shared_tools)
7
+ [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.txt)
8
+ [![Documentation](https://img.shields.io/badge/docs-mkdocs-blue.svg)](https://madbomber.github.io/shared_tools)
4
9
  </div>
5
10
 
6
- A Ruby gem providing a collection of common tools (call-back functions) for use with the following gems:
11
+ ---
7
12
 
8
- - ruby_llm: multi-provider `gem install ruby_llm`
9
- - llm: multi-provider `gem install llm.rb`
10
- - omniai: multi-provider `gem install omniai-tools` (Not part of the SharedTools namespace)
11
- - more to come ...
13
+ ## Overview
12
14
 
13
- ## Recent Changes
15
+ SharedTools is a comprehensive collection of production-ready tools designed for LLM (Large Language Model) applications. Built on the [RubyLLM](https://github.com/mariochavez/ruby_llm) framework, it provides a unified interface for common automation tasks while maintaining safety through a human-in-the-loop authorization system.
14
16
 
15
- ### Version 0.2.0
17
+ ### Key Features
16
18
 
17
- - ability to use the `ruby_llm-mcp` gem was added with two example MCP client instances for some useful MCP servers: github-mcp-server and iMCP.app
18
- - added `SharedTools.mcp_servers` Array to hold defined client instances.
19
- - added a class method `name` to `RubyLLM::Tool` subclasses to define the snake_case String format of the class basename.
19
+ - 🔧 **13+ Production Tools** - Browser automation, file operations, database queries, code evaluation, PDF processing, system control, mathematical calculations, weather data, workflow management, data analysis, Docker integration, and more
20
+ - 🔒 **Human-in-the-Loop Authorization** - Built-in safety system for sensitive operations
21
+ - 🎯 **Facade Pattern** - Simplified interfaces with complex capabilities under the hood
22
+ - 🔌 **Pluggable Drivers** - Swap implementations for testing or different backends
23
+ - 📚 **Comprehensive Documentation** - Detailed guides, examples, and API reference
24
+ - ✅ **Well Tested** - 85%+ test coverage with Minitest
20
25
 
21
26
  ## Installation
22
27
 
28
+ Add to your Gemfile:
29
+
23
30
  ```ruby
31
+ gem 'shared_tools'
32
+ gem 'ruby_llm' # Required LLM framework
33
+ ```
34
+
35
+ Or install directly:
36
+
37
+ ```bash
24
38
  gem install shared_tools
39
+ ```
40
+
41
+ ### Optional Dependencies
42
+
43
+ Depending on which tools you use, you may need additional gems:
44
+
45
+ ```ruby
46
+ # For BrowserTool
47
+ gem 'watir'
48
+ gem 'webdrivers'
49
+
50
+ # For DatabaseTool and DatabaseQueryTool
51
+ gem 'sqlite3' # or pg, mysql2, etc.
52
+
53
+ # For DocTool
54
+ gem 'pdf-reader'
55
+
56
+ # Core dependencies (automatically installed)
57
+ gem 'dentaku' # For CalculatorTool
58
+ gem 'openweathermap' # For WeatherTool
59
+ gem 'sequel' # For DatabaseQueryTool
60
+ gem 'nokogiri' # For various tools
61
+ ```
62
+
63
+ ## Quick Start
64
+
65
+ ```ruby
66
+ require 'shared_tools'
67
+ require 'ruby_llm'
68
+
69
+ # Initialize an LLM agent with SharedTools
70
+ agent = RubyLLM::Agent.new(
71
+ tools: [
72
+ SharedTools::Tools::BrowserTool.new,
73
+ SharedTools::Tools::DiskTool.new,
74
+ SharedTools::Tools::DatabaseTool.new,
75
+ SharedTools::Tools::CalculatorTool.new,
76
+ SharedTools::Tools::WeatherTool.new,
77
+ SharedTools::Tools::WorkflowManagerTool.new
78
+ ]
79
+ )
80
+
81
+ # Use with human-in-the-loop authorization (default)
82
+ agent.process("Visit example.com and save the page title to title.txt")
83
+ # User will be prompted: "Allow BrowserTool to visit https://example.com? (y/n)"
84
+
85
+ # Or enable auto-execution for automated workflows
86
+ SharedTools.auto_execute(true)
87
+ agent.process("Calculate the square root of 144 and tell me the weather in London")
88
+ ```
89
+
90
+ ## Tool Collections
91
+
92
+ ### 🌐 Browser Tools
93
+
94
+ Web automation and scraping capabilities.
95
+
96
+ **Actions:**
97
+ - `visit` - Navigate to URLs
98
+ - `page_inspect` - Get page HTML content
99
+ - `ui_inspect` - Find elements by text
100
+ - `selector_inspect` - Find elements by CSS selector
101
+ - `click` - Click elements
102
+ - `text_field_set` - Fill in forms
103
+ - `screenshot` - Capture page screenshots
104
+
105
+ **Example:**
106
+ ```ruby
107
+ browser = SharedTools::Tools::BrowserTool.new
108
+
109
+ browser.execute(action: "visit", url: "https://example.com")
110
+ browser.execute(action: "page_inspect", full_html: false)
111
+ ```
112
+
113
+ [📖 Full Browser Documentation](https://madbomber.github.io/shared_tools/tools/browser/)
114
+
115
+ ---
116
+
117
+ ### 💾 Disk Tools
118
+
119
+ Secure file system operations with path traversal protection.
120
+
121
+ **Actions:**
122
+ - `file_create` - Create new files
123
+ - `file_read` - Read file contents
124
+ - `file_write` - Write to files
125
+ - `file_delete` - Delete files
126
+ - `file_move` - Move/rename files
127
+ - `file_replace` - Find and replace text in files
128
+ - `directory_create` - Create directories
129
+ - `directory_list` - List directory contents
130
+ - `directory_move` - Move directories
131
+ - `directory_delete` - Delete directories
132
+
133
+ **Example:**
134
+ ```ruby
135
+ disk = SharedTools::Tools::DiskTool.new
136
+
137
+ disk.execute(action: "file_create", path: "./report.txt")
138
+ disk.execute(action: "file_write", path: "./report.txt", text: "Hello, World!")
139
+ content = disk.execute(action: "file_read", path: "./report.txt")
140
+ ```
141
+
142
+ [📖 Full Disk Documentation](https://madbomber.github.io/shared_tools/tools/disk/)
143
+
144
+ ---
145
+
146
+ ### 🗄️ Database Tools
147
+
148
+ Execute SQL operations on databases.
149
+
150
+ **Actions:**
151
+ - Execute SQL statements (CREATE, INSERT, SELECT, UPDATE, DELETE)
152
+ - Batch statement execution
153
+ - Transaction-like error handling (stops on first error)
154
+ - Support for SQLite, PostgreSQL, MySQL via drivers
155
+
156
+ **Example:**
157
+ ```ruby
158
+ require 'sqlite3'
159
+
160
+ db = SQLite3::Database.new(':memory:')
161
+ driver = SharedTools::Tools::Database::SqliteDriver.new(db: db)
162
+ database = SharedTools::Tools::DatabaseTool.new(driver: driver)
163
+
164
+ results = database.execute(
165
+ statements: [
166
+ "CREATE TABLE users (id INTEGER, name TEXT)",
167
+ "INSERT INTO users VALUES (1, 'Alice')",
168
+ "SELECT * FROM users"
169
+ ]
170
+ )
171
+ ```
25
172
 
26
- # Load all RubyLLM tools (requires ruby_llm gem to be available and loaded first)
27
- require 'shared_tools/ruby_llm' # multiple API libraries are supported besides ruby_llm
173
+ [📖 Full Database Documentation](https://madbomber.github.io/shared_tools/tools/database/)
28
174
 
29
- # Or load a specific tool directly
30
- require 'shared_tools/ruby_llm/edit_file'
31
- require 'shared_tools/ruby_llm/read_file'
32
- require 'shared_tools/ruby_llm/python_eval'
175
+ ---
33
176
 
34
- # Or load clients for defined MCP servers
35
- # Load all the MCP clients for the ruby_llm library
36
- require 'shared_tools/ruby_llm/mcp'
177
+ ### 💻 Eval Tools
37
178
 
38
- # Or just the ones you want
39
- require 'shared_tools/ruby_llm/mcp/github_mcp_server'
40
- require 'shared_tools/ruby_llm/mcp/icmp' # MacOS data server
179
+ Safe code evaluation for Ruby, Python, and shell commands.
41
180
 
42
- # The client instances for ruby_llm/mcp servers are available
43
- SharedTools.mcp_servers # An Array of MCP clients
181
+ **Languages:**
182
+ - `ruby` - Execute Ruby code
183
+ - `python` - Execute Python code (with sandboxing)
184
+ - `shell` - Execute shell commands
44
185
 
45
- # In ruby_llm library access the tools from MCP servers
46
- @tools = []
47
- SharedTools.mcp_servers.size.time do |server_inx|
48
- @tools += SharedTools.mcp_servers[server_inx].tools
49
- end
50
- chat = RubyLLM.chat
51
- chat.with_tools(@tools)
186
+ **Example:**
187
+ ```ruby
188
+ eval_tool = SharedTools::Tools::EvalTool.new
189
+
190
+ # Ruby evaluation
191
+ result = eval_tool.execute(language: "ruby", code: "puts 2 + 2")
192
+
193
+ # Shell command execution (requires authorization by default)
194
+ output = eval_tool.execute(language: "shell", code: "ls -la")
195
+ ```
196
+
197
+ [📖 Full Eval Documentation](https://madbomber.github.io/shared_tools/tools/eval/)
198
+
199
+ ---
200
+
201
+ ### 📄 Doc Tools
202
+
203
+ PDF document processing and text extraction.
204
+
205
+ **Actions:**
206
+ - `read_pdf` - Read PDF content from specific pages or entire documents
207
+ - Extract text, statistics, and metadata
208
+ - Process multi-page documents
209
+
210
+ **Example:**
211
+ ```ruby
212
+ doc = SharedTools::Tools::DocTool.new
213
+
214
+ # Read first page
215
+ content = doc.execute(action: "read_pdf", path: "./document.pdf", page: 1)
216
+
217
+ # Read entire document
218
+ full_content = doc.execute(action: "read_pdf", path: "./document.pdf")
219
+ ```
220
+
221
+ [📖 Full Doc Documentation](https://madbomber.github.io/shared_tools/tools/doc/)
222
+
223
+ ---
224
+
225
+ ### 🖱️ Computer Tools
226
+
227
+ System-level automation for mouse, keyboard, and screen control.
228
+
229
+ **Actions:**
230
+ - `mouse_click` - Click at coordinates
231
+ - `mouse_move` - Move mouse cursor
232
+ - `mouse_position` - Get current mouse position
233
+ - `type` - Type text
234
+ - `key` - Press keyboard keys and shortcuts
235
+ - `hold_key` - Hold keys for duration
236
+ - `scroll` - Scroll windows
237
+ - `wait` - Wait for specified duration
238
+
239
+ **Example:**
240
+ ```ruby
241
+ computer = SharedTools::Tools::ComputerTool.new
242
+
243
+ computer.execute(action: "mouse_click", coordinate: {x: 100, y: 200})
244
+ computer.execute(action: "type", text: "Hello, World!")
245
+ computer.execute(action: "key", text: "Return")
246
+ ```
247
+
248
+ [📖 Full Computer Documentation](https://madbomber.github.io/shared_tools/tools/computer/)
249
+
250
+ ---
251
+
252
+ ### 🧮 Calculator Tool
253
+
254
+ Safe mathematical calculations without code execution risks.
255
+
256
+ **Features:**
257
+ - Safe expression evaluation using Dentaku parser
258
+ - Basic arithmetic: +, -, *, /, %, ^
259
+ - Mathematical functions: sqrt, round, abs
260
+ - Trigonometric functions: sin, cos, tan
261
+ - Configurable precision (0-10 decimal places)
262
+ - Comprehensive error handling
263
+
264
+ **Example:**
265
+ ```ruby
266
+ calculator = SharedTools::Tools::CalculatorTool.new
267
+
268
+ calculator.execute(expression: "2 + 2")
269
+ # => {success: true, result: 4.0, precision: 2}
270
+
271
+ calculator.execute(expression: "sqrt(16) * 2", precision: 4)
272
+ # => {success: true, result: 8.0, precision: 4}
273
+ ```
274
+
275
+ ---
276
+
277
+ ### 🌤️ Weather Tool
278
+
279
+ Real-time weather data from OpenWeatherMap API.
280
+
281
+ **Features:**
282
+ - Current weather conditions for any city worldwide
283
+ - Multiple temperature units (metric, imperial, kelvin)
284
+ - Optional 3-day forecast data
285
+ - Comprehensive atmospheric data (humidity, pressure, wind)
286
+ - Requires OPENWEATHER_API_KEY environment variable
287
+
288
+ **Example:**
289
+ ```ruby
290
+ weather = SharedTools::Tools::WeatherTool.new
291
+
292
+ weather.execute(city: "London,UK", units: "metric")
293
+ # => {success: true, current: {temperature: 15.5, ...}}
294
+
295
+ weather.execute(city: "New York,US", units: "imperial", include_forecast: true)
296
+ # => Includes current weather and 3-day forecast
52
297
  ```
53
298
 
54
- ## Tips for Tool Authors
299
+ ---
300
+
301
+ ### 🔄 Workflow Manager Tool
55
302
 
56
- - Provide a clear comprehensive description for your tool and its parameters
57
- - Include usage examples in your documentation
58
- - Ensure your tool is compatible with different Ruby versions and environments
59
- - Make sure your tool is in the correct directory for the library to which it belongs
303
+ Manage complex multi-step workflows with persistent state.
60
304
 
61
- ## Rails and Autoloader Compatibility
305
+ **Features:**
306
+ - Create and track stateful workflows
307
+ - Step-by-step execution with state persistence
308
+ - Status monitoring and progress tracking
309
+ - Workflow completion and cleanup
310
+ - Survives process restarts
62
311
 
63
- This gem uses Zeitwerk for autoloading, making it fully compatible with Rails and other Ruby applications that use modern autoloaders. RubyLLM tools are excluded from autoloading and loaded manually to avoid namespace conflicts.
312
+ **Example:**
313
+ ```ruby
314
+ workflow = SharedTools::Tools::WorkflowManagerTool.new
315
+
316
+ # Start a workflow
317
+ result = workflow.execute(action: "start", step_data: {project: "demo"})
318
+ workflow_id = result[:workflow_id]
319
+
320
+ # Execute steps
321
+ workflow.execute(action: "step", workflow_id: workflow_id, step_data: {task: "compile"})
322
+ workflow.execute(action: "step", workflow_id: workflow_id, step_data: {task: "test"})
323
+
324
+ # Check status
325
+ workflow.execute(action: "status", workflow_id: workflow_id)
326
+
327
+ # Complete
328
+ workflow.execute(action: "complete", workflow_id: workflow_id)
329
+ ```
64
330
 
331
+ ---
65
332
 
66
- Special Thanks
333
+ ### 📊 Composite Analysis Tool
67
334
 
68
- A special shout-out to Kevin's [omniai-tools](https://github.com/your-github-url/omniai-tools) gem, which is a curated collection of tools for use with his OmniAI gem.
335
+ Multi-stage data analysis orchestration.
336
+
337
+ **Features:**
338
+ - Automatic data source detection (files or URLs)
339
+ - Data structure analysis
340
+ - Statistical insights generation
341
+ - Visualization suggestions
342
+ - Correlation analysis
343
+ - Supports CSV, JSON, and text formats
344
+
345
+ **Example:**
346
+ ```ruby
347
+ analyzer = SharedTools::Tools::CompositeAnalysisTool.new
348
+
349
+ analyzer.execute(
350
+ data_source: "./sales_data.csv",
351
+ analysis_type: "comprehensive",
352
+ options: {include_correlations: true, visualization_limit: 5}
353
+ )
354
+ # => Complete analysis with structure, insights, and visualizations
355
+ ```
356
+
357
+ ---
358
+
359
+ ### 🗄️ Database Query Tool
360
+
361
+ Safe, read-only database query execution.
362
+
363
+ **Features:**
364
+ - SELECT-only queries for security
365
+ - Automatic LIMIT clause enforcement
366
+ - Query timeout protection
367
+ - Prepared statement support
368
+ - Connection pooling
369
+ - Supports PostgreSQL, MySQL, SQLite, and more
370
+
371
+ **Example:**
372
+ ```ruby
373
+ db_query = SharedTools::Tools::DatabaseQueryTool.new
374
+
375
+ db_query.execute(
376
+ query: "SELECT * FROM users WHERE active = ?",
377
+ params: [true],
378
+ limit: 50,
379
+ timeout: 10
380
+ )
381
+ # => {success: true, row_count: 50, data: [...]}
382
+ ```
383
+
384
+ ---
385
+
386
+ ### 🐳 Docker Compose Tool
387
+
388
+ Execute Docker Compose commands safely.
389
+
390
+ **Features:**
391
+ - Run commands in Docker containers
392
+ - Service specification
393
+ - Automatic container cleanup
394
+ - Build and run in one step
395
+
396
+ **Example:**
397
+ ```ruby
398
+ docker = SharedTools::Tools::Docker::ComposeRunTool.new
399
+
400
+ docker.execute(
401
+ service: "app",
402
+ command: "rspec",
403
+ args: ["spec/main_spec.rb"]
404
+ )
405
+ ```
406
+
407
+ ---
408
+
409
+ ### 🛠️ Error Handling Tool
410
+
411
+ Reference implementation for robust error handling patterns.
412
+
413
+ **Features:**
414
+ - Multiple error type handling
415
+ - Retry mechanisms with exponential backoff
416
+ - Input/output validation
417
+ - Resource cleanup patterns
418
+ - Detailed error categorization
419
+ - Support reference IDs for debugging
420
+
421
+ **Example:**
422
+ ```ruby
423
+ error_tool = SharedTools::Tools::ErrorHandlingTool.new
424
+
425
+ error_tool.execute(
426
+ operation: "process",
427
+ data: {name: "test", value: 42},
428
+ max_retries: 3
429
+ )
430
+ # => Demonstrates comprehensive error handling patterns
431
+ ```
432
+
433
+ ---
434
+
435
+ ## Authorization System
436
+
437
+ SharedTools includes a human-in-the-loop authorization system for safety:
438
+
439
+ ```ruby
440
+ # Require user confirmation (default)
441
+ SharedTools.auto_execute(false)
442
+
443
+ # The LLM proposes an action
444
+ disk.execute(action: "file_delete", path: "./important.txt")
445
+ # Prompt: "Allow DiskTool to delete ./important.txt? (y/n)"
446
+
447
+ # Enable auto-execution for trusted workflows
448
+ SharedTools.auto_execute(true)
449
+ disk.execute(action: "file_delete", path: "./temp.txt")
450
+ # Executes immediately without prompting
451
+ ```
452
+
453
+ [📖 Authorization Guide](https://madbomber.github.io/shared_tools/guides/authorization/)
454
+
455
+ ## Documentation
456
+
457
+ Comprehensive documentation is available at **[madbomber.github.io/shared_tools](https://madbomber.github.io/shared_tools)**
458
+
459
+ ### Documentation Sections
460
+
461
+ - **[Getting Started](https://madbomber.github.io/shared_tools/getting-started/installation/)** - Installation, quick start, basic usage
462
+ - **[Tool Collections](https://madbomber.github.io/shared_tools/tools/)** - Detailed documentation for each tool
463
+ - **[Guides](https://madbomber.github.io/shared_tools/guides/)** - Authorization, drivers, error handling, testing
464
+ - **[Examples](https://madbomber.github.io/shared_tools/examples/)** - Working code examples and workflows
465
+ - **[API Reference](https://madbomber.github.io/shared_tools/api/)** - Tool base class, facade pattern, driver interface
466
+ - **[Development](https://madbomber.github.io/shared_tools/development/)** - Architecture, contributing, changelog
467
+
468
+ ## Examples
469
+
470
+ The `/examples` directory contains working demonstrations:
471
+
472
+ - `browser_tool_example.rb` - Web automation
473
+ - `disk_tool_example.rb` - File operations
474
+ - `database_tool_example.rb` - SQL operations
475
+ - `eval_tool_example.rb` - Code evaluation
476
+ - `doc_tool_example.rb` - PDF processing
477
+ - `comprehensive_workflow_example.rb` - Multi-tool workflow
478
+
479
+ Run examples:
480
+ ```bash
481
+ bundle install
482
+ ruby examples/browser_tool_example.rb
483
+ ```
484
+
485
+ [📖 View All Examples](https://madbomber.github.io/shared_tools/examples/)
486
+
487
+ ## Development
488
+
489
+ ### Setup
490
+
491
+ ```bash
492
+ git clone https://github.com/madbomber/shared_tools.git
493
+ cd shared_tools
494
+ bundle install
495
+ ```
496
+
497
+ ### Running Tests
498
+
499
+ ```bash
500
+ # Run all tests
501
+ bundle exec rake test
502
+
503
+ # Run specific test file
504
+ bundle exec ruby test/shared_tools/tools/browser_tool_test.rb
505
+
506
+ # Run with SimpleCov coverage report
507
+ COVERAGE=true bundle exec rake test
508
+ ```
509
+
510
+ ### Building Documentation
511
+
512
+ ```bash
513
+ # Install MkDocs and dependencies
514
+ pip install mkdocs-material
515
+
516
+ # Serve documentation locally
517
+ mkdocs serve
518
+
519
+ # Build static site
520
+ mkdocs build
521
+ ```
522
+
523
+ ### Code Quality
524
+
525
+ The project uses standard Ruby tooling:
526
+
527
+ - **Testing**: Minitest (85%+ coverage)
528
+ - **Code Loading**: Zeitwerk for autoloading
529
+ - **Documentation**: MkDocs with Material theme
530
+ - **Examples**: Executable Ruby scripts in `/examples`
531
+
532
+ ## Contributing
533
+
534
+ Contributions are welcome! Here's how you can help:
535
+
536
+ ### Reporting Issues
537
+
538
+ Found a bug or have a feature request? Please [open an issue](https://github.com/madbomber/shared_tools/issues/new) with:
539
+
540
+ - Clear description of the problem
541
+ - Steps to reproduce (for bugs)
542
+ - Expected vs actual behavior
543
+ - Ruby version and gem version
544
+ - Code examples if applicable
545
+
546
+ ### Submitting Pull Requests
547
+
548
+ 1. Fork the repository
549
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
550
+ 3. Make your changes with tests
551
+ 4. Ensure tests pass (`bundle exec rake test`)
552
+ 5. Commit your changes (`git commit -m 'Add amazing feature'`)
553
+ 6. Push to your branch (`git push origin feature/amazing-feature`)
554
+ 7. Open a Pull Request
555
+
556
+ ### Contribution Guidelines
557
+
558
+ - Add tests for new features
559
+ - Update documentation as needed
560
+ - Follow existing code style
561
+ - Keep commits focused and atomic
562
+ - Write clear commit messages
563
+
564
+ [📖 Contributing Guide](https://madbomber.github.io/shared_tools/development/contributing/)
565
+
566
+ ## Roadmap
567
+
568
+ See the [Changelog](https://madbomber.github.io/shared_tools/development/changelog/) for version history and upcoming features.
569
+
570
+ ### Recent Additions (v0.12+)
571
+
572
+ - ✅ Calculator Tool - Safe mathematical calculations with Dentaku
573
+ - ✅ Weather Tool - Real-time weather data via OpenWeatherMap API
574
+ - ✅ Workflow Manager Tool - Stateful multi-step workflow orchestration
575
+ - ✅ Composite Analysis Tool - Multi-stage data analysis
576
+ - ✅ Database Query Tool - Safe read-only database queries
577
+ - ✅ Docker Compose Tool - Container command execution
578
+ - ✅ Error Handling Tool - Reference implementation for robust patterns
579
+
580
+ ### Future Enhancements
581
+
582
+ - Additional browser drivers (Selenium, Playwright)
583
+ - More database adapters and query builders
584
+ - Enhanced PDF processing capabilities
585
+ - Additional document formats (Word, Excel)
586
+ - Video and image processing tools
587
+ - Extended data science and analytics capabilities
588
+
589
+ ## Requirements
590
+
591
+ - Ruby 3.0 or higher
592
+ - RubyLLM gem for LLM integration
593
+
594
+ ## License
595
+
596
+ This gem is available as open source under the terms of the [MIT License](LICENSE.txt).
597
+
598
+ ## Special Thanks
599
+
600
+ This gem was originally inspired by Kevin Sylvestre's [omniai-tools](https://github.com/ksylvest/omniai-tools) gem. SharedTools has since evolved to focus exclusively on RubyLLM support with enhanced features and comprehensive documentation.
601
+
602
+ ## Links
603
+
604
+ - **Documentation**: [madbomber.github.io/shared_tools](https://madbomber.github.io/shared_tools)
605
+ - **RubyGems**: [rubygems.org/gems/shared_tools](https://rubygems.org/gems/shared_tools)
606
+ - **Source Code**: [github.com/madbomber/shared_tools](https://github.com/madbomber/shared_tools)
607
+ - **Issue Tracker**: [github.com/madbomber/shared_tools/issues](https://github.com/madbomber/shared_tools/issues)
608
+ - **RubyLLM**: [github.com/mariochavez/ruby_llm](https://github.com/mariochavez/ruby_llm)
609
+
610
+ ## Support
611
+
612
+ - 📖 [Documentation](https://madbomber.github.io/shared_tools)
613
+ - 💬 [GitHub Discussions](https://github.com/madbomber/shared_tools/discussions)
614
+ - 🐛 [Issue Tracker](https://github.com/madbomber/shared_tools/issues)
615
+
616
+ ---
617
+
618
+ <div align="center">
619
+ Made with ❤️ by <a href="https://github.com/madbomber">Dewayne VanHoozer</a>
620
+ </div>