shared_tools 0.3.0 → 0.4.1

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 (77) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +46 -4
  3. data/README.md +257 -262
  4. data/lib/shared_tools/browser_tool.rb +5 -0
  5. data/lib/shared_tools/calculator_tool.rb +4 -0
  6. data/lib/shared_tools/clipboard_tool.rb +4 -0
  7. data/lib/shared_tools/composite_analysis_tool.rb +4 -0
  8. data/lib/shared_tools/computer_tool.rb +5 -0
  9. data/lib/shared_tools/cron_tool.rb +4 -0
  10. data/lib/shared_tools/current_date_time_tool.rb +4 -0
  11. data/lib/shared_tools/data_science_kit.rb +4 -0
  12. data/lib/shared_tools/database.rb +4 -0
  13. data/lib/shared_tools/database_query_tool.rb +4 -0
  14. data/lib/shared_tools/database_tool.rb +5 -0
  15. data/lib/shared_tools/disk_tool.rb +5 -0
  16. data/lib/shared_tools/dns_tool.rb +4 -0
  17. data/lib/shared_tools/doc_tool.rb +5 -0
  18. data/lib/shared_tools/error_handling_tool.rb +4 -0
  19. data/lib/shared_tools/eval_tool.rb +5 -0
  20. data/lib/shared_tools/mcp/brave_search_client.rb +37 -0
  21. data/lib/shared_tools/mcp/chart_client.rb +32 -0
  22. data/lib/shared_tools/mcp/github_client.rb +38 -0
  23. data/lib/shared_tools/mcp/hugging_face_client.rb +43 -0
  24. data/lib/shared_tools/mcp/memory_client.rb +33 -0
  25. data/lib/shared_tools/mcp/notion_client.rb +40 -0
  26. data/lib/shared_tools/mcp/sequential_thinking_client.rb +33 -0
  27. data/lib/shared_tools/mcp/slack_client.rb +54 -0
  28. data/lib/shared_tools/mcp/streamable_http_patch.rb +42 -0
  29. data/lib/shared_tools/mcp/tavily_client.rb +41 -0
  30. data/lib/shared_tools/mcp.rb +45 -16
  31. data/lib/shared_tools/system_info_tool.rb +4 -0
  32. data/lib/shared_tools/tools/browser/base_tool.rb +8 -12
  33. data/lib/shared_tools/tools/browser/click_tool.rb +4 -2
  34. data/lib/shared_tools/tools/browser/ferrum_driver.rb +119 -0
  35. data/lib/shared_tools/tools/browser/inspect_tool.rb +4 -2
  36. data/lib/shared_tools/tools/browser/page_inspect_tool.rb +4 -2
  37. data/lib/shared_tools/tools/browser/page_screenshot_tool.rb +19 -7
  38. data/lib/shared_tools/tools/browser/selector_inspect_tool.rb +4 -2
  39. data/lib/shared_tools/tools/browser/text_field_area_set_tool.rb +4 -2
  40. data/lib/shared_tools/tools/browser/visit_tool.rb +4 -2
  41. data/lib/shared_tools/tools/browser.rb +31 -2
  42. data/lib/shared_tools/tools/browser_tool.rb +14 -2
  43. data/lib/shared_tools/tools/clipboard_tool.rb +119 -0
  44. data/lib/shared_tools/tools/composite_analysis_tool.rb +60 -4
  45. data/lib/shared_tools/tools/computer/mac_driver.rb +37 -4
  46. data/lib/shared_tools/tools/computer_tool.rb +8 -2
  47. data/lib/shared_tools/tools/cron_tool.rb +332 -0
  48. data/lib/shared_tools/tools/current_date_time_tool.rb +88 -0
  49. data/lib/shared_tools/tools/data_science_kit.rb +63 -13
  50. data/lib/shared_tools/tools/database_tool.rb +8 -3
  51. data/lib/shared_tools/tools/dns_tool.rb +422 -0
  52. data/lib/shared_tools/tools/doc/docx_reader_tool.rb +107 -0
  53. data/lib/shared_tools/tools/doc/spreadsheet_reader_tool.rb +171 -0
  54. data/lib/shared_tools/tools/doc/text_reader_tool.rb +57 -0
  55. data/lib/shared_tools/tools/doc.rb +3 -0
  56. data/lib/shared_tools/tools/doc_tool.rb +101 -6
  57. data/lib/shared_tools/tools/docker/compose_run_tool.rb +1 -1
  58. data/lib/shared_tools/tools/enabler.rb +42 -0
  59. data/lib/shared_tools/tools/error_handling_tool.rb +3 -1
  60. data/lib/shared_tools/tools/notification/base_driver.rb +51 -0
  61. data/lib/shared_tools/tools/notification/linux_driver.rb +115 -0
  62. data/lib/shared_tools/tools/notification/mac_driver.rb +66 -0
  63. data/lib/shared_tools/tools/notification/null_driver.rb +29 -0
  64. data/lib/shared_tools/tools/notification.rb +12 -0
  65. data/lib/shared_tools/tools/notification_tool.rb +99 -0
  66. data/lib/shared_tools/tools/system_info_tool.rb +204 -0
  67. data/lib/shared_tools/tools/workflow_manager_tool.rb +32 -0
  68. data/lib/shared_tools/utilities.rb +193 -0
  69. data/lib/shared_tools/version.rb +1 -1
  70. data/lib/shared_tools/weather_tool.rb +4 -0
  71. data/lib/shared_tools/workflow_manager_tool.rb +4 -0
  72. data/lib/shared_tools.rb +42 -11
  73. metadata +79 -9
  74. data/lib/shared_tools/mcp/github_mcp_server.rb +0 -58
  75. data/lib/shared_tools/mcp/imcp.rb +0 -28
  76. data/lib/shared_tools/mcp/tavily_mcp_server.rb +0 -44
  77. data/lib/shared_tools/tools/devops_toolkit.rb +0 -420
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  <div align="center">
2
2
  <h1>SharedTools</h1>
3
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>
4
+ <p><em>A Ruby gem providing LLM-callable tools for browser automation, file operations, code evaluation, document processing, network queries, data science, workflow management, and more</em></p>
5
5
 
6
6
  [![Gem Version](https://badge.fury.io/rb/shared_tools.svg)](https://badge.fury.io/rb/shared_tools)
7
7
  [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.txt)
@@ -16,12 +16,12 @@ SharedTools is a comprehensive collection of production-ready tools designed for
16
16
 
17
17
  ### Key Features
18
18
 
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
19
+ - 🔧 **21+ Production Tools** Browser automation, file operations, database queries, code evaluation, document processing, DNS and WHOIS lookups, IP geolocation, data science, weather data, workflow management, system utilities, notifications, 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
25
25
 
26
26
  ## Installation
27
27
 
@@ -45,19 +45,20 @@ Depending on which tools you use, you may need additional gems:
45
45
  ```ruby
46
46
  # For BrowserTool
47
47
  gem 'watir'
48
- gem 'webdrivers'
49
48
 
50
49
  # For DatabaseTool and DatabaseQueryTool
51
50
  gem 'sqlite3' # or pg, mysql2, etc.
52
51
 
53
52
  # For DocTool
54
- gem 'pdf-reader'
53
+ gem 'pdf-reader' # PDF support
54
+ gem 'docx' # Microsoft Word (.docx) support
55
+ gem 'roo' # Spreadsheet support: CSV, XLSX, ODS, XLSM
55
56
 
56
57
  # 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
58
+ gem 'dentaku' # For CalculatorTool
59
+ gem 'openweathermap' # For WeatherTool
60
+ gem 'sequel' # For DatabaseQueryTool
61
+ gem 'nokogiri' # For various tools
61
62
  ```
62
63
 
63
64
  ## Quick Start
@@ -67,24 +68,21 @@ require 'shared_tools'
67
68
  require 'ruby_llm'
68
69
 
69
70
  # 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
- ]
71
+ chat = RubyLLM.chat.with_tools(
72
+ SharedTools::Tools::BrowserTool.new,
73
+ SharedTools::Tools::DiskTool.new,
74
+ SharedTools::Tools::DnsTool.new,
75
+ SharedTools::Tools::WeatherTool.new,
76
+ SharedTools::Tools::WorkflowManagerTool.new
79
77
  )
80
78
 
81
79
  # Use with human-in-the-loop authorization (default)
82
- agent.process("Visit example.com and save the page title to title.txt")
80
+ chat.ask("Visit example.com and save the page title to title.txt")
83
81
  # User will be prompted: "Allow BrowserTool to visit https://example.com? (y/n)"
84
82
 
85
83
  # Or enable auto-execution for automated workflows
86
84
  SharedTools.auto_execute(true)
87
- agent.process("Calculate the square root of 144 and tell me the weather in London")
85
+ chat.ask("Calculate the square root of 144 and tell me the weather in London")
88
86
  ```
89
87
 
90
88
  ## Tool Collections
@@ -93,19 +91,10 @@ agent.process("Calculate the square root of 144 and tell me the weather in Londo
93
91
 
94
92
  Web automation and scraping capabilities.
95
93
 
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
94
+ **Actions:** `visit`, `page_inspect`, `ui_inspect`, `selector_inspect`, `click`, `text_field_set`, `screenshot`
104
95
 
105
- **Example:**
106
96
  ```ruby
107
97
  browser = SharedTools::Tools::BrowserTool.new
108
-
109
98
  browser.execute(action: "visit", url: "https://example.com")
110
99
  browser.execute(action: "page_inspect", full_html: false)
111
100
  ```
@@ -118,22 +107,10 @@ browser.execute(action: "page_inspect", full_html: false)
118
107
 
119
108
  Secure file system operations with path traversal protection.
120
109
 
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:**
110
+ **Actions:** `file_create`, `file_read`, `file_write`, `file_delete`, `file_move`, `file_replace`, `directory_create`, `directory_list`, `directory_move`, `directory_delete`
111
+
134
112
  ```ruby
135
113
  disk = SharedTools::Tools::DiskTool.new
136
-
137
114
  disk.execute(action: "file_create", path: "./report.txt")
138
115
  disk.execute(action: "file_write", path: "./report.txt", text: "Hello, World!")
139
116
  content = disk.execute(action: "file_read", path: "./report.txt")
@@ -147,13 +124,8 @@ content = disk.execute(action: "file_read", path: "./report.txt")
147
124
 
148
125
  Execute SQL operations on databases.
149
126
 
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
127
+ **Features:** SELECT, INSERT, UPDATE, DELETE; read-only query mode; automatic LIMIT enforcement; pluggable drivers (SQLite, PostgreSQL, MySQL)
155
128
 
156
- **Example:**
157
129
  ```ruby
158
130
  require 'sqlite3'
159
131
 
@@ -178,19 +150,11 @@ results = database.execute(
178
150
 
179
151
  Safe code evaluation for Ruby, Python, and shell commands.
180
152
 
181
- **Languages:**
182
- - `ruby` - Execute Ruby code
183
- - `python` - Execute Python code (with sandboxing)
184
- - `shell` - Execute shell commands
153
+ **Languages:** `ruby`, `python`, `shell`
185
154
 
186
- **Example:**
187
155
  ```ruby
188
156
  eval_tool = SharedTools::Tools::EvalTool.new
189
-
190
- # Ruby evaluation
191
157
  result = eval_tool.execute(language: "ruby", code: "puts 2 + 2")
192
-
193
- # Shell command execution (requires authorization by default)
194
158
  output = eval_tool.execute(language: "shell", code: "ls -la")
195
159
  ```
196
160
 
@@ -200,52 +164,74 @@ output = eval_tool.execute(language: "shell", code: "ls -la")
200
164
 
201
165
  ### 📄 Doc Tools
202
166
 
203
- PDF document processing and text extraction.
167
+ Read and reason over documents in any format.
204
168
 
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
169
+ **Actions:** `text_read`, `pdf_read`, `docx_read`, `spreadsheet_read`
209
170
 
210
- **Example:**
211
171
  ```ruby
212
172
  doc = SharedTools::Tools::DocTool.new
213
173
 
214
- # Read first page
215
- content = doc.execute(action: "read_pdf", path: "./document.pdf", page: 1)
174
+ # Plain text
175
+ doc.execute(action: "text_read", doc_path: "./notes.txt")
176
+
177
+ # PDF — specific pages or ranges
178
+ doc.execute(action: "pdf_read", doc_path: "./report.pdf", page_numbers: "1, 5-10")
179
+
180
+ # Microsoft Word
181
+ doc.execute(action: "docx_read", doc_path: "./meeting.docx")
216
182
 
217
- # Read entire document
218
- full_content = doc.execute(action: "read_pdf", path: "./document.pdf")
183
+ # Spreadsheets (CSV, XLSX, ODS, XLSM)
184
+ doc.execute(action: "spreadsheet_read", doc_path: "./data.xlsx", sheet: "Q1 Sales")
219
185
  ```
220
186
 
221
187
  [📖 Full Doc Documentation](https://madbomber.github.io/shared_tools/tools/doc/)
222
188
 
223
189
  ---
224
190
 
225
- ### 🖱️ Computer Tools
191
+ ### 🌐 DNS Tool
226
192
 
227
- System-level automation for mouse, keyboard, and screen control.
193
+ DNS resolution, WHOIS queries, IP geolocation, and external IP detection. No API key required.
194
+
195
+ **Actions:** `a`, `aaaa`, `mx`, `ns`, `txt`, `cname`, `reverse`, `all`, `external_ip`, `ip_location`, `whois`
228
196
 
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
197
  ```ruby
241
- computer = SharedTools::Tools::ComputerTool.new
198
+ dns = SharedTools::Tools::DnsTool.new
242
199
 
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")
200
+ dns.execute(action: "mx", host: "gmail.com")
201
+ dns.execute(action: "whois", host: "ruby-lang.org")
202
+ dns.execute(action: "external_ip")
203
+ dns.execute(action: "ip_location") # geolocate your own IP
204
+ dns.execute(action: "ip_location", host: "8.8.8.8") # geolocate any IP
246
205
  ```
247
206
 
248
- [📖 Full Computer Documentation](https://madbomber.github.io/shared_tools/tools/computer/)
207
+ [📖 Full DNS Documentation](https://madbomber.github.io/shared_tools/tools/dns_tool/)
208
+
209
+ ---
210
+
211
+ ### 🌤️ Weather Tool
212
+
213
+ Real-time weather data from OpenWeatherMap API. Combine with DnsTool for automatic local forecasts.
214
+
215
+ **Features:** Current conditions, 3-day forecast, metric/imperial/kelvin units, global coverage
216
+
217
+ ```ruby
218
+ weather = SharedTools::Tools::WeatherTool.new
219
+ weather.execute(city: "London,UK", units: "metric", include_forecast: true)
220
+ ```
221
+
222
+ **Local forecast with automatic location detection:**
223
+
224
+ ```ruby
225
+ chat = RubyLLM.chat.with_tools(
226
+ SharedTools::Tools::DnsTool.new,
227
+ SharedTools::Tools::WeatherTool.new,
228
+ SharedTools::Tools::CurrentDateTimeTool.new
229
+ )
230
+
231
+ chat.ask("Get my external IP, find my city, then give me the current weather and 3-day forecast.")
232
+ ```
233
+
234
+ [📖 Full Weather Documentation](https://madbomber.github.io/shared_tools/tools/weather/)
249
235
 
250
236
  ---
251
237
 
@@ -253,77 +239,130 @@ computer.execute(action: "key", text: "Return")
253
239
 
254
240
  Safe mathematical calculations without code execution risks.
255
241
 
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
242
+ **Features:** Arithmetic, math functions (sqrt, round, abs), trigonometry (sin, cos, tan), configurable precision
263
243
 
264
- **Example:**
265
244
  ```ruby
266
245
  calculator = SharedTools::Tools::CalculatorTool.new
246
+ calculator.execute(expression: "sqrt(16) * 2", precision: 4)
247
+ # => {success: true, result: 8.0}
248
+ ```
249
+
250
+ ---
267
251
 
268
- calculator.execute(expression: "2 + 2")
269
- # => {success: true, result: 4.0, precision: 2}
252
+ ### 📊 Data Science Kit
270
253
 
271
- calculator.execute(expression: "sqrt(16) * 2", precision: 4)
272
- # => {success: true, result: 8.0, precision: 4}
254
+ Real statistical analysis on actual data — file-based or inline.
255
+
256
+ **Analysis types:** `statistical_summary`, `correlation_analysis`, `time_series`, `clustering`, `prediction`
257
+
258
+ **Inline data formats:** pipe-delimited tables, CSV strings, JSON arrays, comma-separated numbers
259
+
260
+ ```ruby
261
+ kit = SharedTools::Tools::DataScienceKit.new
262
+
263
+ # From a file
264
+ kit.execute(analysis_type: "statistical_summary", data_source: "./sales.csv")
265
+
266
+ # Inline pipe-delimited table
267
+ kit.execute(
268
+ analysis_type: "correlation_analysis",
269
+ data: "| month | revenue | cost |\n| Jan | 12400 | 8200 |\n| Feb | 11800 | 7900 |"
270
+ )
273
271
  ```
274
272
 
273
+ [📖 Full Data Science Documentation](https://madbomber.github.io/shared_tools/tools/data_science_kit/)
274
+
275
275
  ---
276
276
 
277
- ### 🌤️ Weather Tool
277
+ ### 🖱️ Computer Tools
278
278
 
279
- Real-time weather data from OpenWeatherMap API.
279
+ System-level automation for mouse, keyboard, and screen control.
280
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
281
+ **Actions:** `mouse_click`, `mouse_move`, `mouse_position`, `type`, `key`, `hold_key`, `scroll`, `wait`
287
282
 
288
- **Example:**
289
283
  ```ruby
290
- weather = SharedTools::Tools::WeatherTool.new
284
+ computer = SharedTools::Tools::ComputerTool.new
285
+ computer.execute(action: "mouse_click", coordinate: {x: 100, y: 200})
286
+ computer.execute(action: "type", text: "Hello, World!")
287
+ ```
291
288
 
292
- weather.execute(city: "London,UK", units: "metric")
293
- # => {success: true, current: {temperature: 15.5, ...}}
289
+ [📖 Full Computer Documentation](https://madbomber.github.io/shared_tools/tools/computer/)
294
290
 
295
- weather.execute(city: "New York,US", units: "imperial", include_forecast: true)
296
- # => Includes current weather and 3-day forecast
291
+ ---
292
+
293
+ ### 🕐 Date/Time, System Info & Clipboard
294
+
295
+ Utility tools for context and system access:
296
+
297
+ ```ruby
298
+ # Current date and day of week (prevents LLM hallucination)
299
+ dt = SharedTools::Tools::CurrentDateTimeTool.new
300
+ dt.execute(format: "date")
301
+ # => { date: "2026-03-25", day_of_week: "Wednesday", ... }
302
+
303
+ # System hardware and OS info
304
+ info = SharedTools::Tools::SystemInfoTool.new
305
+ info.execute
306
+
307
+ # Clipboard
308
+ clipboard = SharedTools::Tools::ClipboardTool.new
309
+ clipboard.execute(action: "read")
310
+ clipboard.execute(action: "write", text: "Hello!")
297
311
  ```
298
312
 
299
313
  ---
300
314
 
315
+ ### 🔔 Notification Tool
316
+
317
+ Cross-platform desktop notifications, modal alert dialogs, and text-to-speech. Supports macOS and Linux with no gem dependencies.
318
+
319
+ **Actions:** `notify`, `alert`, `speak`
320
+
321
+ ```ruby
322
+ tool = SharedTools::Tools::NotificationTool.new
323
+
324
+ # Non-blocking desktop banner
325
+ tool.execute(action: "notify", message: "Build complete", title: "CI", sound: "Glass")
326
+
327
+ # Modal dialog — blocks until user clicks; returns clicked button label
328
+ result = tool.execute(action: "alert", message: "Deploy to production?", buttons: ["Yes", "No"])
329
+ result[:button] # => "Yes" or "No"
330
+
331
+ # Text-to-speech
332
+ tool.execute(action: "speak", message: "Task finished", voice: "Samantha", rate: 160)
333
+ ```
334
+
335
+ | Action | macOS | Linux |
336
+ |--------|-------|-------|
337
+ | `notify` | osascript | notify-send |
338
+ | `alert` | osascript dialog | zenity or terminal fallback |
339
+ | `speak` | say | espeak-ng / espeak |
340
+
341
+ ---
342
+
301
343
  ### 🔄 Workflow Manager Tool
302
344
 
303
- Manage complex multi-step workflows with persistent state.
345
+ Persistent multi-step workflow orchestration with JSON file storage.
304
346
 
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
347
+ **Actions:** `start`, `step`, `status`, `complete`, `list`
311
348
 
312
- **Example:**
313
349
  ```ruby
314
350
  workflow = SharedTools::Tools::WorkflowManagerTool.new
315
351
 
316
352
  # Start a workflow
317
- result = workflow.execute(action: "start", step_data: {project: "demo"})
353
+ result = workflow.execute(action: "start", step_data: {project: "release-v2.0"})
318
354
  workflow_id = result[:workflow_id]
319
355
 
320
356
  # 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"})
357
+ workflow.execute(action: "step", workflow_id: workflow_id, step_data: {task: "run_tests"})
358
+ workflow.execute(action: "step", workflow_id: workflow_id, step_data: {task: "deploy"})
323
359
 
324
360
  # Check status
325
361
  workflow.execute(action: "status", workflow_id: workflow_id)
326
362
 
363
+ # List all workflows
364
+ workflow.execute(action: "list")
365
+
327
366
  # Complete
328
367
  workflow.execute(action: "complete", workflow_id: workflow_id)
329
368
  ```
@@ -334,51 +373,13 @@ workflow.execute(action: "complete", workflow_id: workflow_id)
334
373
 
335
374
  Multi-stage data analysis orchestration.
336
375
 
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
376
  ```ruby
347
377
  analyzer = SharedTools::Tools::CompositeAnalysisTool.new
348
-
349
378
  analyzer.execute(
350
379
  data_source: "./sales_data.csv",
351
380
  analysis_type: "comprehensive",
352
381
  options: {include_correlations: true, visualization_limit: 5}
353
382
  )
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
  ```
383
384
 
384
385
  ---
@@ -387,21 +388,9 @@ db_query.execute(
387
388
 
388
389
  Execute Docker Compose commands safely.
389
390
 
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
391
  ```ruby
398
392
  docker = SharedTools::Tools::Docker::ComposeRunTool.new
399
-
400
- docker.execute(
401
- service: "app",
402
- command: "rspec",
403
- args: ["spec/main_spec.rb"]
404
- )
393
+ docker.execute(service: "app", command: "rspec", args: ["spec/main_spec.rb"])
405
394
  ```
406
395
 
407
396
  ---
@@ -410,28 +399,60 @@ docker.execute(
410
399
 
411
400
  Reference implementation for robust error handling patterns.
412
401
 
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
402
  ```ruby
423
403
  error_tool = SharedTools::Tools::ErrorHandlingTool.new
424
-
425
404
  error_tool.execute(
426
405
  operation: "process",
427
406
  data: {name: "test", value: 42},
428
407
  max_retries: 3
429
408
  )
430
- # => Demonstrates comprehensive error handling patterns
431
409
  ```
432
410
 
433
411
  ---
434
412
 
413
+ ## MCP Clients
414
+
415
+ SharedTools bundles [Model Context Protocol](https://modelcontextprotocol.io) clients that connect AI agents to external services. Each client is opt-in — require only the ones you need.
416
+
417
+ ### Remote HTTP (API key only)
418
+
419
+ | Client | Env var | Provides |
420
+ |--------|---------|----------|
421
+ | `require 'shared_tools/mcp/tavily_client'` | `TAVILY_API_KEY` | Web search, news, research, URL extraction |
422
+
423
+ ### Brew-installed (auto-installs via Homebrew)
424
+
425
+ | Client | Env var | Provides |
426
+ |--------|---------|----------|
427
+ | `require 'shared_tools/mcp/github_client'` | `GITHUB_PERSONAL_ACCESS_TOKEN` | Repos, issues, PRs, code search |
428
+ | `require 'shared_tools/mcp/notion_client'` | `NOTION_TOKEN` | Pages, databases, search, content CRUD |
429
+ | `require 'shared_tools/mcp/slack_client'` | `SLACK_MCP_XOXP_TOKEN` | Channels, messages, threads, user info |
430
+ | `require 'shared_tools/mcp/hugging_face_client'` | `HF_TOKEN` | Models, datasets, Spaces, model cards |
431
+
432
+ ### npx Auto-download (Node.js required)
433
+
434
+ | Client | Provides |
435
+ |--------|----------|
436
+ | `require 'shared_tools/mcp/memory_client'` | Persistent knowledge graph |
437
+ | `require 'shared_tools/mcp/sequential_thinking_client'` | Chain-of-thought reasoning |
438
+ | `require 'shared_tools/mcp/chart_client'` | Chart and visualisation generation |
439
+ | `require 'shared_tools/mcp/brave_search_client'` | Web and news search (`BRAVE_API_KEY`) |
440
+
441
+ ```ruby
442
+ # Load all available clients at once (skips any whose env vars are missing)
443
+ require 'shared_tools/mcp'
444
+
445
+ # Or load a specific client
446
+ require 'shared_tools/mcp/notion_client'
447
+ client = RubyLLM::MCP.clients["notion"]
448
+ chat = RubyLLM.chat.with_tools(*client.tools)
449
+ chat.ask("Find my project planning pages and summarise what's in them")
450
+ ```
451
+
452
+ See [MCP Clients README](lib/shared_tools/mcp/README.md) for full configuration details.
453
+
454
+ ---
455
+
435
456
  ## Authorization System
436
457
 
437
458
  SharedTools includes a human-in-the-loop authorization system for safety:
@@ -458,30 +479,56 @@ Comprehensive documentation is available at **[madbomber.github.io/shared_tools]
458
479
 
459
480
  ### Documentation Sections
460
481
 
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
482
+ - **[Getting Started](https://madbomber.github.io/shared_tools/getting-started/installation/)** Installation, quick start, basic usage
483
+ - **[Tool Collections](https://madbomber.github.io/shared_tools/tools/)** Detailed documentation for each tool
484
+ - **[Guides](https://madbomber.github.io/shared_tools/guides/)** Authorization, drivers, error handling, testing
485
+ - **[Examples](https://madbomber.github.io/shared_tools/examples/)** Working code examples and workflows
486
+ - **[API Reference](https://madbomber.github.io/shared_tools/api/)** Tool base class, facade pattern, driver interface
487
+ - **[Development](https://madbomber.github.io/shared_tools/development/)** Architecture, contributing, changelog
467
488
 
468
489
  ## Examples
469
490
 
470
- The `/examples` directory contains working demonstrations:
491
+ The `/examples` directory contains runnable demonstrations using a shared `common.rb` helper:
471
492
 
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
493
  ```bash
481
- bundle install
482
- ruby examples/browser_tool_example.rb
494
+ bundle exec ruby -I examples examples/weather_tool_demo.rb
495
+ bundle exec ruby -I examples examples/dns_tool_demo.rb
496
+ bundle exec ruby -I examples examples/doc_tool_demo.rb
483
497
  ```
484
498
 
499
+ | Demo | What it shows |
500
+ |------|--------------|
501
+ | `browser_tool_demo.rb` | Web automation |
502
+ | `calculator_tool_demo.rb` | Math expressions |
503
+ | `clipboard_tool_demo.rb` | Clipboard read/write |
504
+ | `composite_analysis_tool_demo.rb` | Multi-stage analysis |
505
+ | `computer_tool_demo.rb` | Mouse and keyboard |
506
+ | `cron_tool_demo.rb` | Cron scheduling |
507
+ | `current_date_time_tool_demo.rb` | Real date and time |
508
+ | `data_science_kit_demo.rb` | Statistical analysis with inline data |
509
+ | `database_tool_demo.rb` | SQL operations |
510
+ | `database_query_tool_demo.rb` | Read-only SQL queries |
511
+ | `disk_tool_demo.rb` | File operations |
512
+ | `dns_tool_demo.rb` | DNS, WHOIS, geolocation |
513
+ | `doc_tool_demo.rb` | Text, PDF, Word, spreadsheets |
514
+ | `error_handling_tool_demo.rb` | Error handling patterns |
515
+ | `eval_tool_demo.rb` | Code evaluation |
516
+ | `mcp_client_demo.rb` | MCP client overview |
517
+ | `mcp/tavily_demo.rb` | Tavily web search (HTTP) |
518
+ | `mcp/github_demo.rb` | GitHub repos, issues, PRs |
519
+ | `mcp/notion_demo.rb` | Notion pages and databases |
520
+ | `mcp/slack_demo.rb` | Slack channels and messages |
521
+ | `mcp/hugging_face_demo.rb` | Hugging Face models and datasets |
522
+ | `mcp/memory_demo.rb` | Persistent knowledge graph |
523
+ | `mcp/sequential_thinking_demo.rb` | Chain-of-thought reasoning |
524
+ | `mcp/chart_demo.rb` | Chart generation |
525
+ | `mcp/brave_search_demo.rb` | Brave web search |
526
+ | `notification_tool_demo.rb` | Desktop notifications, alerts, TTS |
527
+ | `system_info_tool_demo.rb` | System info |
528
+ | `weather_tool_demo.rb` | Weather + local forecast |
529
+ | `workflow_manager_tool_demo.rb` | Workflow orchestration |
530
+ | `comprehensive_workflow_demo.rb` | Multi-tool pipeline |
531
+
485
532
  [📖 View All Examples](https://madbomber.github.io/shared_tools/examples/)
486
533
 
487
534
  ## Development
@@ -510,20 +557,13 @@ COVERAGE=true bundle exec rake test
510
557
  ### Building Documentation
511
558
 
512
559
  ```bash
513
- # Install MkDocs and dependencies
514
560
  pip install mkdocs-material
515
-
516
- # Serve documentation locally
517
- mkdocs serve
518
-
519
- # Build static site
520
- mkdocs build
561
+ mkdocs serve # Serve locally
562
+ mkdocs build # Build static site
521
563
  ```
522
564
 
523
565
  ### Code Quality
524
566
 
525
- The project uses standard Ruby tooling:
526
-
527
567
  - **Testing**: Minitest (85%+ coverage)
528
568
  - **Code Loading**: Zeitwerk for autoloading
529
569
  - **Documentation**: MkDocs with Material theme
@@ -533,59 +573,14 @@ The project uses standard Ruby tooling:
533
573
 
534
574
  Contributions are welcome! Here's how you can help:
535
575
 
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
576
  1. Fork the repository
549
577
  2. Create a feature branch (`git checkout -b feature/amazing-feature`)
550
578
  3. Make your changes with tests
551
579
  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
580
+ 5. Open a Pull Request
563
581
 
564
582
  [📖 Contributing Guide](https://madbomber.github.io/shared_tools/development/contributing/)
565
583
 
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
584
  ## Requirements
590
585
 
591
586
  - Ruby 3.0 or higher