shared_tools 0.6.0 → 0.7.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/lib/shared_tools/mcp/brave_search_client.rb +2 -0
- data/lib/shared_tools/mcp/chart_client.rb +2 -0
- data/lib/shared_tools/mcp/client_support.rb +19 -0
- data/lib/shared_tools/mcp/github_client.rb +2 -0
- data/lib/shared_tools/mcp/hugging_face_client.rb +2 -0
- data/lib/shared_tools/mcp/memory_client.rb +2 -0
- data/lib/shared_tools/mcp/notion_client.rb +2 -0
- data/lib/shared_tools/mcp/playwright_client.rb +2 -0
- data/lib/shared_tools/mcp/sequential_thinking_client.rb +2 -0
- data/lib/shared_tools/mcp/slack_client.rb +2 -0
- data/lib/shared_tools/mcp/tavily_client.rb +2 -0
- data/lib/shared_tools/tools/apply_patch_tool.rb +1 -1
- data/lib/shared_tools/tools/bash_tool.rb +1 -1
- data/lib/shared_tools/tools/browser/click_tool.rb +1 -1
- data/lib/shared_tools/tools/browser/inspect_tool.rb +1 -1
- data/lib/shared_tools/tools/browser/page_inspect_tool.rb +1 -1
- data/lib/shared_tools/tools/browser/page_screenshot_tool.rb +1 -1
- data/lib/shared_tools/tools/browser/selector_inspect_tool.rb +1 -1
- data/lib/shared_tools/tools/browser/text_field_area_set_tool.rb +1 -1
- data/lib/shared_tools/tools/browser/visit_tool.rb +1 -1
- data/lib/shared_tools/tools/browser_tool.rb +1 -1
- data/lib/shared_tools/tools/bundle_tool.rb +1 -1
- data/lib/shared_tools/tools/calculator_tool.rb +1 -1
- data/lib/shared_tools/tools/clipboard_tool.rb +1 -1
- data/lib/shared_tools/tools/composite_analysis_tool.rb +1 -1
- data/lib/shared_tools/tools/computer_tool.rb +1 -1
- data/lib/shared_tools/tools/cron_tool.rb +1 -1
- data/lib/shared_tools/tools/csv_read_tool.rb +1 -1
- data/lib/shared_tools/tools/csv_write_tool.rb +1 -1
- data/lib/shared_tools/tools/current_date_time_tool.rb +2 -2
- data/lib/shared_tools/tools/data_science_kit.rb +1 -1
- data/lib/shared_tools/tools/database_query_tool.rb +1 -1
- data/lib/shared_tools/tools/database_tool.rb +1 -1
- data/lib/shared_tools/tools/diff_tool.rb +1 -1
- data/lib/shared_tools/tools/disk/directory_create_tool.rb +1 -1
- data/lib/shared_tools/tools/disk/directory_delete_tool.rb +1 -1
- data/lib/shared_tools/tools/disk/directory_list_tool.rb +1 -1
- data/lib/shared_tools/tools/disk/directory_move_tool.rb +1 -1
- data/lib/shared_tools/tools/disk/file_create_tool.rb +1 -1
- data/lib/shared_tools/tools/disk/file_delete_tool.rb +1 -1
- data/lib/shared_tools/tools/disk/file_move_tool.rb +1 -1
- data/lib/shared_tools/tools/disk/file_read_tool.rb +1 -1
- data/lib/shared_tools/tools/disk/file_replace_tool.rb +1 -1
- data/lib/shared_tools/tools/disk/file_write_tool.rb +1 -1
- data/lib/shared_tools/tools/disk_tool.rb +1 -1
- data/lib/shared_tools/tools/dns_tool.rb +1 -1
- data/lib/shared_tools/tools/doc/docx_reader_tool.rb +1 -1
- data/lib/shared_tools/tools/doc/pdf_reader_tool.rb +1 -1
- data/lib/shared_tools/tools/doc/spreadsheet_reader_tool.rb +1 -1
- data/lib/shared_tools/tools/doc/text_reader_tool.rb +1 -1
- data/lib/shared_tools/tools/doc_tool.rb +1 -1
- data/lib/shared_tools/tools/docker/compose_run_tool.rb +1 -1
- data/lib/shared_tools/tools/download_file_tool.rb +1 -1
- data/lib/shared_tools/tools/error_handling_tool.rb +1 -1
- data/lib/shared_tools/tools/eval/python_eval_tool.rb +1 -1
- data/lib/shared_tools/tools/eval/ruby_eval_tool.rb +1 -1
- data/lib/shared_tools/tools/eval/shell_eval_tool.rb +1 -1
- data/lib/shared_tools/tools/eval_tool.rb +1 -1
- data/lib/shared_tools/tools/gem_tool.rb +1 -1
- data/lib/shared_tools/tools/git/add_tool.rb +1 -1
- data/lib/shared_tools/tools/git/blame_tool.rb +1 -1
- data/lib/shared_tools/tools/git/branch_tool.rb +1 -1
- data/lib/shared_tools/tools/git/checkout_tool.rb +1 -1
- data/lib/shared_tools/tools/git/commit_tool.rb +1 -1
- data/lib/shared_tools/tools/git/diff_tool.rb +1 -1
- data/lib/shared_tools/tools/git/grep_tool.rb +1 -1
- data/lib/shared_tools/tools/git/log_tool.rb +1 -1
- data/lib/shared_tools/tools/git/show_tool.rb +1 -1
- data/lib/shared_tools/tools/git/status_tool.rb +1 -1
- data/lib/shared_tools/tools/git_tool.rb +1 -1
- data/lib/shared_tools/tools/glob_tool.rb +1 -1
- data/lib/shared_tools/tools/http_request_tool.rb +1 -1
- data/lib/shared_tools/tools/json_query_tool.rb +1 -1
- data/lib/shared_tools/tools/lint_tool.rb +1 -1
- data/lib/shared_tools/tools/multi_edit_tool.rb +1 -1
- data/lib/shared_tools/tools/notification_tool.rb +1 -1
- data/lib/shared_tools/tools/parse_ruby_tool.rb +1 -1
- data/lib/shared_tools/tools/process_kill_tool.rb +1 -1
- data/lib/shared_tools/tools/process_list_tool.rb +1 -1
- data/lib/shared_tools/tools/process_output_tool.rb +1 -1
- data/lib/shared_tools/tools/process_start_tool.rb +0 -0
- data/lib/shared_tools/tools/python_tests_tool.rb +1 -1
- data/lib/shared_tools/tools/replace_in_files_tool.rb +1 -1
- data/lib/shared_tools/tools/run_tests_tool.rb +1 -1
- data/lib/shared_tools/tools/search_codebase_tool.rb +1 -1
- data/lib/shared_tools/tools/secure_tool_template.rb +1 -1
- data/lib/shared_tools/tools/system_info_tool.rb +1 -1
- data/lib/shared_tools/tools/todo_write_tool.rb +1 -1
- data/lib/shared_tools/tools/toml_query_tool.rb +1 -1
- data/lib/shared_tools/tools/tree_tool.rb +1 -1
- data/lib/shared_tools/tools/weather_tool.rb +1 -1
- data/lib/shared_tools/tools/web_fetch_tool.rb +1 -1
- data/lib/shared_tools/tools/workflow_manager_tool.rb +1 -1
- data/lib/shared_tools/tools/yaml_query_tool.rb +1 -1
- data/lib/shared_tools/version.rb +1 -1
- metadata +33 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 34cacf7e0ae9289b41abac0941cd1123ff725d8dbac4d8ed8d793e7a01fdac88
|
|
4
|
+
data.tar.gz: cba8ee56b7c22b41847ce844c09edffb2e29a49844cd79a6eab1ccab758b25a3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 94dde27edb4d0b7e4d6df7537012df4bdb9d5f06a1e7e3839610d08b85ea3524056dd4eb6b3bc7cddf49791c9af9f7159fde9ed567c9a135d9fcb3653f633352
|
|
7
|
+
data.tar.gz: 3cb75f11a57a07a41695f46ad02e70d70af52506fe0778ae11bae53388fb12ffed06ceb524d9060e0b483d89b7c1f690d8949389b2d7d6732ada3917c1015b80
|
data/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
- **Breaking:** Requiring a client file no longer has side effects. It does not check environment variables, does not run `brew`/`apt`/`dnf`, and does not connect; environment variables are read when the server process starts. Use `Klass.available?` / `missing_envars` / `verify!` (raises `LoadError` like before) and `Klass.install_packages!`. `require 'shared_tools/mcp'` loads every definition, records availability for `SharedTools.mcp_status`, and `SharedTools::MCP.available` lists the usable classes.
|
|
9
9
|
- **Breaking:** MCP server names are now symbol-friendly: `brave-search` → `brave_search`, `hugging-face` → `hugging_face`, `sequential-thinking` → `sequential_thinking` (others unchanged). These are the names in `SharedTools.mcp_status` and `chat.mcp[...]`.
|
|
10
10
|
- Removed `lib/shared_tools/mcp/streamable_http_patch.rb`; it patched a `ruby_llm-mcp` internal. ruby_llm 2.1's spec-compliant SSE parser already handles mixed CRLF/LF line endings.
|
|
11
|
+
- Added `description` to `SharedTools::MCP::ClientSupport` (class macro plus instance reader; subclasses inherit it) and gave every MCP client one. robot_lab's `mcp_discovery: true` scores servers by name plus description, so it can now pick e.g. `SharedTools::MCP::GitHub` for "open a pull request" and `Playwright` for "take a screenshot of the page".
|
|
12
|
+
- Added `csv` as a runtime dependency. It is a bundled (not default) gem since Ruby 3.4, so `CsvReadTool`/`CsvWriteTool` -- and `SharedTools.tools` / `load_all_tools`, which eager-load them -- raised `LoadError: cannot load such file -- csv` in any bundle that did not list it.
|
|
11
13
|
- Added `test/shared_tools/tool_classes_test.rb`: every shipped `RubyLLM::Tool` subclass must define its own `#execute`, expose an object `parameters_schema` whose properties `#execute` accepts, and no 1.x `params do` / `param :` may remain in `lib/`. It also calls `current_date_time`, `system_info` and `dns` (used by aia's demo 18) through `Tool#call` and checks the data they return. Added `test/shared_tools/mcp/clients_test.rb` (class-level only; no servers are started).
|
|
12
14
|
- Updated the MCP examples, `lib/shared_tools/mcp/README.md`, `README.md` and `docs/` for the new MCP classes.
|
|
13
15
|
|
|
@@ -30,6 +30,8 @@ module SharedTools
|
|
|
30
30
|
class BraveSearch < ::RubyLLM::MCP
|
|
31
31
|
extend ClientSupport
|
|
32
32
|
|
|
33
|
+
description "Brave web search: current web pages, news, and local results"
|
|
34
|
+
|
|
33
35
|
requires_envars "BRAVE_API_KEY"
|
|
34
36
|
|
|
35
37
|
command "npx", "-y", "@modelcontextprotocol/server-brave-search"
|
|
@@ -50,10 +50,29 @@ module SharedTools
|
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
module ClientSupport
|
|
53
|
+
# Instance-side reader, so a server instance answers #description the
|
|
54
|
+
# way robot_lab's RobotLab::MCP::Server does.
|
|
55
|
+
module InstanceMethods
|
|
56
|
+
def description
|
|
57
|
+
self.class.description.to_s
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
53
61
|
def self.extended(klass)
|
|
62
|
+
klass.include(InstanceMethods)
|
|
54
63
|
SharedTools::MCP.register(klass)
|
|
55
64
|
end
|
|
56
65
|
|
|
66
|
+
# Declares (or, with no argument, returns) a short description of what
|
|
67
|
+
# the server offers. robot_lab's mcp_discovery scores servers by name
|
|
68
|
+
# plus description, so a description lets it pick this server for
|
|
69
|
+
# relevant messages. Subclasses inherit their parent's description.
|
|
70
|
+
def description(text = nil)
|
|
71
|
+
return @description || (superclass.description if superclass.respond_to?(:description)) if text.nil?
|
|
72
|
+
|
|
73
|
+
@description = text.to_s
|
|
74
|
+
end
|
|
75
|
+
|
|
57
76
|
# Declares (or, with no arguments, returns) the environment variables
|
|
58
77
|
# the server needs. All of them must be set for #available? to be true.
|
|
59
78
|
def requires_envars(*names)
|
|
@@ -30,6 +30,8 @@ module SharedTools
|
|
|
30
30
|
class GitHub < ::RubyLLM::MCP
|
|
31
31
|
extend ClientSupport
|
|
32
32
|
|
|
33
|
+
description "GitHub repositories, issues, pull requests, code search, commits, branches, and releases"
|
|
34
|
+
|
|
33
35
|
self.default_name = "github"
|
|
34
36
|
|
|
35
37
|
requires_envars "GITHUB_PERSONAL_ACCESS_TOKEN"
|
|
@@ -30,6 +30,8 @@ module SharedTools
|
|
|
30
30
|
class Memory < ::RubyLLM::MCP
|
|
31
31
|
extend ClientSupport
|
|
32
32
|
|
|
33
|
+
description "Persistent knowledge graph memory: remember and recall facts, entities, and relations across conversations"
|
|
34
|
+
|
|
33
35
|
command "npx", "-y", "@modelcontextprotocol/server-memory"
|
|
34
36
|
# An unset MEMORY_FILE_PATH resolves to "", which the server treats as unset.
|
|
35
37
|
env "MEMORY_FILE_PATH" => env_from("MEMORY_FILE_PATH")
|
|
@@ -30,6 +30,8 @@ module SharedTools
|
|
|
30
30
|
class SequentialThinking < ::RubyLLM::MCP
|
|
31
31
|
extend ClientSupport
|
|
32
32
|
|
|
33
|
+
description "Step-by-step chain-of-thought reasoning for complex, multi-stage problems"
|
|
34
|
+
|
|
33
35
|
command "npx", "-y", "@modelcontextprotocol/server-sequential-thinking"
|
|
34
36
|
end
|
|
35
37
|
end
|
|
@@ -39,6 +39,8 @@ module SharedTools
|
|
|
39
39
|
class Slack < ::RubyLLM::MCP
|
|
40
40
|
extend ClientSupport
|
|
41
41
|
|
|
42
|
+
description "Slack channels, messages, threads, users, and search"
|
|
43
|
+
|
|
42
44
|
TOKEN_ENVARS = %w[SLACK_MCP_XOXP_TOKEN SLACK_MCP_XOXB_TOKEN].freeze
|
|
43
45
|
|
|
44
46
|
requires_packages "slack-mcp-server"
|
|
@@ -22,7 +22,7 @@ module SharedTools
|
|
|
22
22
|
class ApplyPatchTool < ::RubyLLM::Tool
|
|
23
23
|
GIT_ENV = { "GIT_PAGER" => "cat", "GIT_TERMINAL_PROMPT" => "0" }.freeze
|
|
24
24
|
|
|
25
|
-
def self.
|
|
25
|
+
def self.tool_name = 'apply_patch'
|
|
26
26
|
|
|
27
27
|
description "Apply a unified diff to files under root (as produced by `git diff` / `diff -u`). " \
|
|
28
28
|
"Validates the patch first and reports the affected files; nothing is written if it " \
|
|
@@ -24,7 +24,7 @@ module SharedTools
|
|
|
24
24
|
class BashTool < ::RubyLLM::Tool
|
|
25
25
|
DEFAULT_TIMEOUT = 30
|
|
26
26
|
|
|
27
|
-
def self.
|
|
27
|
+
def self.tool_name = 'bash'
|
|
28
28
|
|
|
29
29
|
description "Run a single ALLOWLISTED executable with arguments. " \
|
|
30
30
|
"No shell is involved: no pipes, redirects, globs, or variable expansion. " \
|
|
@@ -11,7 +11,7 @@ module SharedTools
|
|
|
11
11
|
# tool.execute(selector: "some text")
|
|
12
12
|
# tool.execute(selector: "//div[@role='button']")
|
|
13
13
|
class ClickTool < ::RubyLLM::Tool
|
|
14
|
-
def self.
|
|
14
|
+
def self.tool_name = 'browser_click'
|
|
15
15
|
|
|
16
16
|
description "A browser automation tool for clicking any clickable element."
|
|
17
17
|
|
|
@@ -11,7 +11,7 @@ module SharedTools
|
|
|
11
11
|
module Browser
|
|
12
12
|
# A browser automation tool for finding UI elements by their text content.
|
|
13
13
|
class InspectTool < ::RubyLLM::Tool
|
|
14
|
-
def self.
|
|
14
|
+
def self.tool_name = 'browser_inspect'
|
|
15
15
|
|
|
16
16
|
include InspectUtils
|
|
17
17
|
|
|
@@ -11,7 +11,7 @@ module SharedTools
|
|
|
11
11
|
module Browser
|
|
12
12
|
# A browser automation tool for viewing the full HTML of the page.
|
|
13
13
|
class PageInspectTool < ::RubyLLM::Tool
|
|
14
|
-
def self.
|
|
14
|
+
def self.tool_name = 'browser_page_inspect'
|
|
15
15
|
|
|
16
16
|
include InspectUtils
|
|
17
17
|
|
|
@@ -7,7 +7,7 @@ module SharedTools
|
|
|
7
7
|
# Saves the screenshot to a file and returns the path — avoids injecting
|
|
8
8
|
# large base64 blobs into the conversation context.
|
|
9
9
|
class PageScreenshotTool < ::RubyLLM::Tool
|
|
10
|
-
def self.
|
|
10
|
+
def self.tool_name = 'browser_page_screenshot'
|
|
11
11
|
|
|
12
12
|
description "Take a screenshot of the current browser page and save it to a file."
|
|
13
13
|
|
|
@@ -11,7 +11,7 @@ module SharedTools
|
|
|
11
11
|
module Browser
|
|
12
12
|
# A browser automation tool for inspecting elements using CSS selectors.
|
|
13
13
|
class SelectorInspectTool < ::RubyLLM::Tool
|
|
14
|
-
def self.
|
|
14
|
+
def self.tool_name = 'browser_selector_inspect'
|
|
15
15
|
|
|
16
16
|
include InspectUtils
|
|
17
17
|
|
|
@@ -8,7 +8,7 @@ module SharedTools
|
|
|
8
8
|
# tool = SharedTools::Tools::Browser::TextFieldSetTool.new(browser:)
|
|
9
9
|
# tool.execute(selector: "...", text: "...")
|
|
10
10
|
class TextFieldAreaSetTool < ::RubyLLM::Tool
|
|
11
|
-
def self.
|
|
11
|
+
def self.tool_name = 'browser_text_field_set'
|
|
12
12
|
|
|
13
13
|
description "A browser automation tool for clicking a specific link."
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@ module SharedTools
|
|
|
8
8
|
# tool = SharedTools::Tools::Browser::VisitTool.new(driver:)
|
|
9
9
|
# tool.execute(to: "https://news.ycombinator.com")
|
|
10
10
|
class VisitTool < ::RubyLLM::Tool
|
|
11
|
-
def self.
|
|
11
|
+
def self.tool_name = 'browser_visit'
|
|
12
12
|
|
|
13
13
|
description "A browser automation tool for navigating to a specific URL."
|
|
14
14
|
|
|
@@ -21,7 +21,7 @@ module SharedTools
|
|
|
21
21
|
NAME_RE = /\A[A-Za-z0-9_.-]+\z/
|
|
22
22
|
DEFAULT_TIMEOUT = 180
|
|
23
23
|
|
|
24
|
-
def self.
|
|
24
|
+
def self.tool_name = 'bundle'
|
|
25
25
|
|
|
26
26
|
description "Run Bundler in a project. Actions: install, update, outdated, check, lock, add. " \
|
|
27
27
|
"For 'add' provide a gem name; for 'update' a gem name is optional (omit to update " \
|
|
@@ -13,7 +13,7 @@ module SharedTools
|
|
|
13
13
|
# tool.execute(action: 'read')
|
|
14
14
|
# tool.execute(action: 'clear')
|
|
15
15
|
class ClipboardTool < ::RubyLLM::Tool
|
|
16
|
-
def self.
|
|
16
|
+
def self.tool_name = 'clipboard'
|
|
17
17
|
|
|
18
18
|
description <<~DESC
|
|
19
19
|
Read from, write to, and clear the system clipboard.
|
|
@@ -5,7 +5,7 @@ require 'json'
|
|
|
5
5
|
module SharedTools
|
|
6
6
|
module Tools
|
|
7
7
|
class CompositeAnalysisTool < RubyLLM::Tool
|
|
8
|
-
def self.
|
|
8
|
+
def self.tool_name = "composite_analysis"
|
|
9
9
|
|
|
10
10
|
description <<~'DESCRIPTION'
|
|
11
11
|
Perform comprehensive multi-stage data analysis by orchestrating multiple specialized analysis steps
|
|
@@ -11,7 +11,7 @@ module SharedTools
|
|
|
11
11
|
# computer.execute(action: 'mouse_position')
|
|
12
12
|
# computer.execute(action: 'type', text: 'Hello')
|
|
13
13
|
class ComputerTool < ::RubyLLM::Tool
|
|
14
|
-
def self.
|
|
14
|
+
def self.tool_name = 'computer'
|
|
15
15
|
description "A tool for interacting with a computer."
|
|
16
16
|
|
|
17
17
|
module Action
|
|
@@ -14,7 +14,7 @@ module SharedTools
|
|
|
14
14
|
# tool.execute(action: 'next_times', expression: '0 * * * *', count: 5)
|
|
15
15
|
# tool.execute(action: 'generate', description: 'every day at 9am')
|
|
16
16
|
class CronTool < ::RubyLLM::Tool
|
|
17
|
-
def self.
|
|
17
|
+
def self.tool_name = 'cron'
|
|
18
18
|
|
|
19
19
|
description <<~DESC
|
|
20
20
|
Parse, validate, explain, and generate cron expressions (standard 5-field format).
|
|
@@ -16,7 +16,7 @@ module SharedTools
|
|
|
16
16
|
MAX_BYTES = 10 * 1024 * 1024
|
|
17
17
|
DEFAULT_LIMIT = 100
|
|
18
18
|
|
|
19
|
-
def self.
|
|
19
|
+
def self.tool_name = 'csv_read'
|
|
20
20
|
|
|
21
21
|
description "Read a CSV file and return its rows. By default the first row is treated as a " \
|
|
22
22
|
"header. Use limit to cap the number of data rows returned."
|
|
@@ -14,7 +14,7 @@ module SharedTools
|
|
|
14
14
|
# tool = SharedTools::Tools::CsvWriteTool.new
|
|
15
15
|
# tool.execute(path: "./out.csv", headers: ["name", "age"], rows: [["Alice", 30]])
|
|
16
16
|
class CsvWriteTool < ::RubyLLM::Tool
|
|
17
|
-
def self.
|
|
17
|
+
def self.tool_name = 'csv_write'
|
|
18
18
|
|
|
19
19
|
description "Write rows to a CSV file. Provide rows as an array of arrays (each inner array " \
|
|
20
20
|
"is a row of cell values, written as strings), with an optional headers array " \
|
|
@@ -12,7 +12,7 @@ module SharedTools
|
|
|
12
12
|
# tool.execute # full output
|
|
13
13
|
# tool.execute(format: 'date') # date fields only
|
|
14
14
|
class CurrentDateTimeTool < ::RubyLLM::Tool
|
|
15
|
-
def self.
|
|
15
|
+
def self.tool_name = 'current_date_time'
|
|
16
16
|
|
|
17
17
|
description <<~DESC
|
|
18
18
|
Returns the current date, time, timezone, and calendar metadata from the system clock.
|
|
@@ -41,7 +41,7 @@ module SharedTools
|
|
|
41
41
|
@logger.info("CurrentDateTimeTool#execute format=#{format}")
|
|
42
42
|
|
|
43
43
|
now = Time.now
|
|
44
|
-
utc = now.utc
|
|
44
|
+
utc = now.getutc # getutc returns a copy; Time#utc would convert now in place
|
|
45
45
|
|
|
46
46
|
date_info = {
|
|
47
47
|
year: now.year,
|
|
@@ -5,7 +5,7 @@ require 'json'
|
|
|
5
5
|
module SharedTools
|
|
6
6
|
module Tools
|
|
7
7
|
class DataScienceKit < RubyLLM::Tool
|
|
8
|
-
def self.
|
|
8
|
+
def self.tool_name = "data_science_kit"
|
|
9
9
|
|
|
10
10
|
description <<~'DESCRIPTION'
|
|
11
11
|
Comprehensive data science and analytics toolkit for performing statistical analysis,
|
|
@@ -10,7 +10,7 @@ module SharedTools
|
|
|
10
10
|
# tool = SharedTools::Tools::DatabaseTool.new(driver:)
|
|
11
11
|
# tool.execute(statements: ["SELECT * FROM people"])
|
|
12
12
|
class DatabaseTool < ::RubyLLM::Tool
|
|
13
|
-
def self.
|
|
13
|
+
def self.tool_name = 'database'
|
|
14
14
|
description <<~TEXT
|
|
15
15
|
Executes SQL commands (INSERT / UPDATE / SELECT / etc) on a database.
|
|
16
16
|
|
|
@@ -12,7 +12,7 @@ module SharedTools
|
|
|
12
12
|
# tool = SharedTools::Tools::DiffTool.new
|
|
13
13
|
# tool.execute(old: "a\nb\n", new: "a\nc\n")
|
|
14
14
|
class DiffTool < ::RubyLLM::Tool
|
|
15
|
-
def self.
|
|
15
|
+
def self.tool_name = 'diff'
|
|
16
16
|
|
|
17
17
|
description "Compare two blocks of text and return a readable line-by-line diff " \
|
|
18
18
|
"(removed lines prefixed -, added lines prefixed +). In-process."
|
|
@@ -9,7 +9,7 @@ module SharedTools
|
|
|
9
9
|
# tool = SharedTools::Tools::Disk::DirectoryCreateTool.new(root: "./project")
|
|
10
10
|
# tool.execute(path: "./foo/bar")
|
|
11
11
|
class DirectoryCreateTool < ::RubyLLM::Tool
|
|
12
|
-
def self.
|
|
12
|
+
def self.tool_name = 'disk_directory_create'
|
|
13
13
|
|
|
14
14
|
description "Creates a directory."
|
|
15
15
|
|
|
@@ -9,7 +9,7 @@ module SharedTools
|
|
|
9
9
|
# tool = SharedTools::Tools::Disk::DirectoryDeleteTool.new(root: "./project")
|
|
10
10
|
# tool.execute(path: "./foo/bar")
|
|
11
11
|
class DirectoryDeleteTool < ::RubyLLM::Tool
|
|
12
|
-
def self.
|
|
12
|
+
def self.tool_name = 'disk_directory_delete'
|
|
13
13
|
|
|
14
14
|
description "Deletes a directory."
|
|
15
15
|
|
|
@@ -9,7 +9,7 @@ module SharedTools
|
|
|
9
9
|
# tool = SharedTools::Tools::Disk::SummaryTool.new(root: "./project")
|
|
10
10
|
# tool.execute
|
|
11
11
|
class DirectoryListTool < ::RubyLLM::Tool
|
|
12
|
-
def self.
|
|
12
|
+
def self.tool_name = 'disk_directory_list'
|
|
13
13
|
|
|
14
14
|
description "Summarizes the contents (files and directories) of a directory."
|
|
15
15
|
|
|
@@ -9,7 +9,7 @@ module SharedTools
|
|
|
9
9
|
# tool = SharedTools::Tools::Disk::DirectoryMoveTool.new(root: "./project")
|
|
10
10
|
# tool.execute(path: "./foo", destination: "./bar")
|
|
11
11
|
class DirectoryMoveTool < ::RubyLLM::Tool
|
|
12
|
-
def self.
|
|
12
|
+
def self.tool_name = 'disk_directory_move'
|
|
13
13
|
|
|
14
14
|
description "Moves a directory from one location to another."
|
|
15
15
|
|
|
@@ -9,7 +9,7 @@ module SharedTools
|
|
|
9
9
|
# tool = SharedTools::Tools::Disk::FileCreateTool.new(root: "./project")
|
|
10
10
|
# tool.execute(path: "./README.md")
|
|
11
11
|
class FileCreateTool < ::RubyLLM::Tool
|
|
12
|
-
def self.
|
|
12
|
+
def self.tool_name = 'disk_file_create'
|
|
13
13
|
|
|
14
14
|
description "Creates a file."
|
|
15
15
|
|
|
@@ -9,7 +9,7 @@ module SharedTools
|
|
|
9
9
|
# tool = SharedTools::Tools::Disk::FileDeleteTool.new(root: "./project")
|
|
10
10
|
# tool.execute(path: "./README.md")
|
|
11
11
|
class FileDeleteTool < ::RubyLLM::Tool
|
|
12
|
-
def self.
|
|
12
|
+
def self.tool_name = 'disk_file_delete'
|
|
13
13
|
|
|
14
14
|
description "Deletes a file."
|
|
15
15
|
|
|
@@ -9,7 +9,7 @@ module SharedTools
|
|
|
9
9
|
# tool = SharedTools::Tools::Disk::FileReadTool.new
|
|
10
10
|
# tool.execute(path: "./README.md") # => "..."
|
|
11
11
|
class FileReadTool < ::RubyLLM::Tool
|
|
12
|
-
def self.
|
|
12
|
+
def self.tool_name = 'disk_file_read'
|
|
13
13
|
|
|
14
14
|
description "Reads the contents of a file."
|
|
15
15
|
|
|
@@ -9,7 +9,7 @@ module SharedTools
|
|
|
9
9
|
# tool = SharedTools::Tools::Disk::FileWriteTool.new(root: "./project")
|
|
10
10
|
# tool.execute(path: "./README.md", text: "Hello World")
|
|
11
11
|
class FileWriteTool < ::RubyLLM::Tool
|
|
12
|
-
def self.
|
|
12
|
+
def self.tool_name = 'disk_file_write'
|
|
13
13
|
|
|
14
14
|
description "Writes the contents of a file."
|
|
15
15
|
|
|
@@ -13,7 +13,7 @@ module SharedTools
|
|
|
13
13
|
# disk.execute(action: SharedTools::Tools::DiskTool::Action::FILE_READ, path: "./demo.rb")
|
|
14
14
|
# disk.execute(action: SharedTools::Tools::DiskTool::Action::FILE_DELETE, path: "./demo.rb")
|
|
15
15
|
class DiskTool < ::RubyLLM::Tool
|
|
16
|
-
def self.
|
|
16
|
+
def self.tool_name = 'disk'
|
|
17
17
|
description <<~TEXT
|
|
18
18
|
A tool for interacting with a system. It is able to list, create, delete, move and modify directories and files.
|
|
19
19
|
TEXT
|
|
@@ -20,7 +20,7 @@ module SharedTools
|
|
|
20
20
|
# tool.execute(action: 'whois', host: 'github.com')
|
|
21
21
|
# tool.execute(action: 'whois', host: '8.8.8.8')
|
|
22
22
|
class DnsTool < ::RubyLLM::Tool
|
|
23
|
-
def self.
|
|
23
|
+
def self.tool_name = 'dns'
|
|
24
24
|
|
|
25
25
|
description <<~DESC
|
|
26
26
|
Perform DNS lookups, reverse lookups, record queries, external IP detection,
|
|
@@ -16,7 +16,7 @@ module SharedTools
|
|
|
16
16
|
# tool.execute(doc_path: "./report.docx")
|
|
17
17
|
# tool.execute(doc_path: "./report.docx", paragraph_range: "1-10")
|
|
18
18
|
class DocxReaderTool < ::RubyLLM::Tool
|
|
19
|
-
def self.
|
|
19
|
+
def self.tool_name = 'doc_docx_read'
|
|
20
20
|
|
|
21
21
|
description "Read the text content of a Microsoft Word (.docx) document."
|
|
22
22
|
|
|
@@ -14,7 +14,7 @@ module SharedTools
|
|
|
14
14
|
# tool = SharedTools::Tools::Doc::PdfReaderTool.new
|
|
15
15
|
# tool.execute(doc_path: "./document.pdf", page_numbers: "1, 5, 10")
|
|
16
16
|
class PdfReaderTool < ::RubyLLM::Tool
|
|
17
|
-
def self.
|
|
17
|
+
def self.tool_name = 'doc_pdf_read'
|
|
18
18
|
|
|
19
19
|
description "Read the text of any set of pages from a PDF document."
|
|
20
20
|
|
|
@@ -21,7 +21,7 @@ module SharedTools
|
|
|
21
21
|
# @example Read a row range from a worksheet
|
|
22
22
|
# tool.execute(doc_path: "./report.xlsx", sheet: "Summary", row_range: "2-50")
|
|
23
23
|
class SpreadsheetReaderTool < ::RubyLLM::Tool
|
|
24
|
-
def self.
|
|
24
|
+
def self.tool_name = 'doc_spreadsheet_read'
|
|
25
25
|
|
|
26
26
|
description "Read tabular data from spreadsheet files (CSV, XLSX, ODS, and other formats)."
|
|
27
27
|
|
|
@@ -9,7 +9,7 @@ module SharedTools
|
|
|
9
9
|
# tool = SharedTools::Tools::Doc::TextReaderTool.new
|
|
10
10
|
# tool.execute(doc_path: "./guide.txt")
|
|
11
11
|
class TextReaderTool < ::RubyLLM::Tool
|
|
12
|
-
def self.
|
|
12
|
+
def self.tool_name = 'doc_text_read'
|
|
13
13
|
|
|
14
14
|
description "Read the full contents of a plain text file."
|
|
15
15
|
|
|
@@ -9,7 +9,7 @@ module SharedTools
|
|
|
9
9
|
# tool = SharedTools::Tools::Docker::ComposeRunTool.new
|
|
10
10
|
# tool.execute(service: "app", command: "rspec", args: ["spec/main_spec.rb"])
|
|
11
11
|
class ComposeRunTool < ::RubyLLM::Tool
|
|
12
|
-
def self.
|
|
12
|
+
def self.tool_name = 'docker_compose_run'
|
|
13
13
|
|
|
14
14
|
description "Runs a command via Docker with arguments on the project (e.g. `rspec spec/main_spec.rb`)."
|
|
15
15
|
|
|
@@ -20,7 +20,7 @@ module SharedTools
|
|
|
20
20
|
class DownloadFileTool < ::RubyLLM::Tool
|
|
21
21
|
include HttpHelpers
|
|
22
22
|
|
|
23
|
-
def self.
|
|
23
|
+
def self.tool_name = 'download_file'
|
|
24
24
|
|
|
25
25
|
description "Download an http/https URL to a file within root. SSRF-protected and " \
|
|
26
26
|
"size-capped. Use for fetching an asset or release to disk (web_fetch returns text " \
|
|
@@ -22,7 +22,7 @@ module SharedTools
|
|
|
22
22
|
class ResourceNotFoundError < StandardError; end
|
|
23
23
|
|
|
24
24
|
class ErrorHandlingTool < RubyLLM::Tool
|
|
25
|
-
def self.
|
|
25
|
+
def self.tool_name = 'error_handling'
|
|
26
26
|
|
|
27
27
|
description <<~'DESCRIPTION'
|
|
28
28
|
Reference tool demonstrating comprehensive error handling patterns and resilience strategies
|
|
@@ -8,7 +8,7 @@ module SharedTools
|
|
|
8
8
|
# tool = SharedTools::Tools::Eval::PythonEvalTool.new
|
|
9
9
|
# tool.execute(code: "print('Hello'); result = 2 + 2")
|
|
10
10
|
class PythonEvalTool < ::RubyLLM::Tool
|
|
11
|
-
def self.
|
|
11
|
+
def self.tool_name = 'eval_python'
|
|
12
12
|
|
|
13
13
|
description <<~DESCRIPTION
|
|
14
14
|
Execute Python source code safely and return the result.
|
|
@@ -9,7 +9,7 @@ module SharedTools
|
|
|
9
9
|
# tool = SharedTools::Tools::Eval::RubyEvalTool.new
|
|
10
10
|
# tool.execute(code: "puts 'Hello'; 2 + 2")
|
|
11
11
|
class RubyEvalTool < ::RubyLLM::Tool
|
|
12
|
-
def self.
|
|
12
|
+
def self.tool_name = 'eval_ruby'
|
|
13
13
|
|
|
14
14
|
description <<~DESCRIPTION
|
|
15
15
|
Execute Ruby source code safely and return the result.
|
|
@@ -26,7 +26,7 @@ module SharedTools
|
|
|
26
26
|
NAME_RE = /\A[A-Za-z0-9_.-]+\z/
|
|
27
27
|
HOST = "https://rubygems.org"
|
|
28
28
|
|
|
29
|
-
def self.
|
|
29
|
+
def self.tool_name = 'gem'
|
|
30
30
|
|
|
31
31
|
description "Look up RubyGems.org metadata for a gem (read-only). Actions: info (summary), " \
|
|
32
32
|
"version (latest version), dependencies (runtime deps), search (find gems by " \
|
|
@@ -15,7 +15,7 @@ module SharedTools
|
|
|
15
15
|
class AddTool < ::RubyLLM::Tool
|
|
16
16
|
include Helpers
|
|
17
17
|
|
|
18
|
-
def self.
|
|
18
|
+
def self.tool_name = 'git_add'
|
|
19
19
|
|
|
20
20
|
description "Stage changes in the repository. Pass specific paths, or set all to stage " \
|
|
21
21
|
"every change (git add -A)."
|
|
@@ -14,7 +14,7 @@ module SharedTools
|
|
|
14
14
|
class BlameTool < ::RubyLLM::Tool
|
|
15
15
|
include Helpers
|
|
16
16
|
|
|
17
|
-
def self.
|
|
17
|
+
def self.tool_name = 'git_blame'
|
|
18
18
|
|
|
19
19
|
description "Show git blame for a file in the repository: which commit, author, and date " \
|
|
20
20
|
"last touched each line. Optionally limit to a line range. Read-only."
|
|
@@ -15,7 +15,7 @@ module SharedTools
|
|
|
15
15
|
class BranchTool < ::RubyLLM::Tool
|
|
16
16
|
include Helpers
|
|
17
17
|
|
|
18
|
-
def self.
|
|
18
|
+
def self.tool_name = 'git_branch'
|
|
19
19
|
|
|
20
20
|
description "List the branches of the repository, with the current branch marked (*) and " \
|
|
21
21
|
"each branch's tip commit. Set all true to include remote-tracking branches. Read-only."
|
|
@@ -17,7 +17,7 @@ module SharedTools
|
|
|
17
17
|
class CheckoutTool < ::RubyLLM::Tool
|
|
18
18
|
include Helpers
|
|
19
19
|
|
|
20
|
-
def self.
|
|
20
|
+
def self.tool_name = 'git_checkout'
|
|
21
21
|
|
|
22
22
|
description "Switch to a branch/commit in the repository, or create a new branch with " \
|
|
23
23
|
"create: true. Note this can change the working tree."
|
|
@@ -16,7 +16,7 @@ module SharedTools
|
|
|
16
16
|
class CommitTool < ::RubyLLM::Tool
|
|
17
17
|
include Helpers
|
|
18
18
|
|
|
19
|
-
def self.
|
|
19
|
+
def self.tool_name = 'git_commit'
|
|
20
20
|
|
|
21
21
|
description "Commit staged changes in the repository with a message. Set all to also " \
|
|
22
22
|
"stage modified/deleted tracked files first (git commit -a). Does not push."
|
|
@@ -16,7 +16,7 @@ module SharedTools
|
|
|
16
16
|
class DiffTool < ::RubyLLM::Tool
|
|
17
17
|
include Helpers
|
|
18
18
|
|
|
19
|
-
def self.
|
|
19
|
+
def self.tool_name = 'git_diff'
|
|
20
20
|
|
|
21
21
|
description "Show a unified git diff for the repository. By default shows unstaged " \
|
|
22
22
|
"changes; set staged to show what's staged. Optionally scope to a path or diff " \
|
|
@@ -16,7 +16,7 @@ module SharedTools
|
|
|
16
16
|
class GrepTool < ::RubyLLM::Tool
|
|
17
17
|
include Helpers
|
|
18
18
|
|
|
19
|
-
def self.
|
|
19
|
+
def self.tool_name = 'git_grep'
|
|
20
20
|
|
|
21
21
|
description "Search the tracked files of the repository for a pattern using git grep, " \
|
|
22
22
|
"returning file:line: matches. Optionally restrict to a path, ignore case, or treat " \
|
|
@@ -17,7 +17,7 @@ module SharedTools
|
|
|
17
17
|
MAX_COUNT = 200
|
|
18
18
|
FORMAT = "%h %ad %an: %s"
|
|
19
19
|
|
|
20
|
-
def self.
|
|
20
|
+
def self.tool_name = 'git_log'
|
|
21
21
|
|
|
22
22
|
description "Show recent git commit history for the repository (hash, date, author, " \
|
|
23
23
|
"subject). Optionally limit the count or scope to a path. Read-only."
|
|
@@ -15,7 +15,7 @@ module SharedTools
|
|
|
15
15
|
class ShowTool < ::RubyLLM::Tool
|
|
16
16
|
include Helpers
|
|
17
17
|
|
|
18
|
-
def self.
|
|
18
|
+
def self.tool_name = 'git_show'
|
|
19
19
|
|
|
20
20
|
description "Show a git object in the repository. With no path, shows the commit at ref " \
|
|
21
21
|
"(message and diff). With a path, shows that file's contents as of ref. Defaults " \
|
|
@@ -14,7 +14,7 @@ module SharedTools
|
|
|
14
14
|
class StatusTool < ::RubyLLM::Tool
|
|
15
15
|
include Helpers
|
|
16
16
|
|
|
17
|
-
def self.
|
|
17
|
+
def self.tool_name = 'git_status'
|
|
18
18
|
|
|
19
19
|
description "Show the git working-tree status of the repository: current branch and " \
|
|
20
20
|
"staged, unstaged, and untracked changes. Read-only."
|
|
@@ -14,7 +14,7 @@ module SharedTools
|
|
|
14
14
|
# git.execute(action: SharedTools::Tools::GitTool::Action::LOG, count: 5)
|
|
15
15
|
# git.execute(action: SharedTools::Tools::GitTool::Action::COMMIT, message: "Fix the thing")
|
|
16
16
|
class GitTool < ::RubyLLM::Tool
|
|
17
|
-
def self.
|
|
17
|
+
def self.tool_name = 'git'
|
|
18
18
|
|
|
19
19
|
description <<~TEXT
|
|
20
20
|
A tool for interacting with a git repository. Read-only actions (status, diff, log, show,
|
|
@@ -17,7 +17,7 @@ module SharedTools
|
|
|
17
17
|
class GlobTool < ::RubyLLM::Tool
|
|
18
18
|
MAX_RESULTS = 1_000
|
|
19
19
|
|
|
20
|
-
def self.
|
|
20
|
+
def self.tool_name = 'glob'
|
|
21
21
|
|
|
22
22
|
description "Find files matching a glob pattern within a directory (e.g. '**/*.rb', " \
|
|
23
23
|
"'app/models/*.rb'). Returns matching paths, sorted, relative to base."
|
|
@@ -21,7 +21,7 @@ module SharedTools
|
|
|
21
21
|
MUTATING_METHODS = %w[POST PUT PATCH DELETE].freeze
|
|
22
22
|
SHOWN_HEADERS = %w[content-type content-length location etag last-modified].freeze
|
|
23
23
|
|
|
24
|
-
def self.
|
|
24
|
+
def self.tool_name = 'http_request'
|
|
25
25
|
|
|
26
26
|
description "Make an HTTP request to an http/https URL and return the status, headers, and " \
|
|
27
27
|
"body. GET and HEAD are available by default; POST/PUT/PATCH/DELETE require user " \
|
|
@@ -19,7 +19,7 @@ module SharedTools
|
|
|
19
19
|
class JsonQueryTool < ::RubyLLM::Tool
|
|
20
20
|
MAX_BYTES = 5 * 1024 * 1024
|
|
21
21
|
|
|
22
|
-
def self.
|
|
22
|
+
def self.tool_name = 'json_query'
|
|
23
23
|
|
|
24
24
|
description "Query JSON with a path expression, or pretty-print it. Provide either a file " \
|
|
25
25
|
"path or an inline json string. Path syntax: keys separated by dots, [n] for " \
|
|
@@ -20,7 +20,7 @@ module SharedTools
|
|
|
20
20
|
LINTERS = %w[rubocop standard].freeze
|
|
21
21
|
DEFAULT_TIMEOUT = 120
|
|
22
22
|
|
|
23
|
-
def self.
|
|
23
|
+
def self.tool_name = 'lint'
|
|
24
24
|
|
|
25
25
|
description "Lint a project with RuboCop or Standard. Auto-detects (Standard if .standard.yml " \
|
|
26
26
|
"is present, else RuboCop) or set linter explicitly. Optionally scope to a path and " \
|
|
@@ -23,7 +23,7 @@ module SharedTools
|
|
|
23
23
|
|
|
24
24
|
MAX_BYTES = 10 * 1024 * 1024
|
|
25
25
|
|
|
26
|
-
def self.
|
|
26
|
+
def self.tool_name = 'multi_edit'
|
|
27
27
|
|
|
28
28
|
description "Apply multiple find/replace edits to a single file atomically. Provide edits as " \
|
|
29
29
|
"an array of objects with old_string, new_string, and optional replace_all. Edits " \
|
|
@@ -18,7 +18,7 @@ module SharedTools
|
|
|
18
18
|
# @example Text-to-speech
|
|
19
19
|
# tool.execute(action: 'speak', message: 'Task finished')
|
|
20
20
|
class NotificationTool < ::RubyLLM::Tool
|
|
21
|
-
def self.
|
|
21
|
+
def self.tool_name = 'notification'
|
|
22
22
|
|
|
23
23
|
description <<~DESC.strip
|
|
24
24
|
Send desktop notifications, modal alerts, or text-to-speech messages.
|
|
@@ -20,7 +20,7 @@ module SharedTools
|
|
|
20
20
|
KINDS = %w[class module method constant].freeze
|
|
21
21
|
MAX_BYTES = 5 * 1024 * 1024
|
|
22
22
|
|
|
23
|
-
def self.
|
|
23
|
+
def self.tool_name = 'parse_ruby'
|
|
24
24
|
|
|
25
25
|
description "Outline a Ruby file's structure (classes, modules, methods, constants with line " \
|
|
26
26
|
"numbers), or locate definitions. Give a query to find definitions whose name " \
|
|
@@ -14,7 +14,7 @@ module SharedTools
|
|
|
14
14
|
# tool = SharedTools::Tools::ProcessKillTool.new
|
|
15
15
|
# tool.execute(id: "proc_1")
|
|
16
16
|
class ProcessKillTool < ::RubyLLM::Tool
|
|
17
|
-
def self.
|
|
17
|
+
def self.tool_name = 'process_kill'
|
|
18
18
|
|
|
19
19
|
description "Stop a background process (started with process_start) and return any final " \
|
|
20
20
|
"output. Terminates the whole process group, escalating to SIGKILL if needed."
|
|
@@ -13,7 +13,7 @@ module SharedTools
|
|
|
13
13
|
# tool = SharedTools::Tools::ProcessListTool.new
|
|
14
14
|
# tool.execute
|
|
15
15
|
class ProcessListTool < ::RubyLLM::Tool
|
|
16
|
-
def self.
|
|
16
|
+
def self.tool_name = 'process_list'
|
|
17
17
|
|
|
18
18
|
description "List background processes (started with process_start): id, status, pid, age, and " \
|
|
19
19
|
"command. Read-only."
|
|
@@ -14,7 +14,7 @@ module SharedTools
|
|
|
14
14
|
# tool = SharedTools::Tools::ProcessOutputTool.new
|
|
15
15
|
# tool.execute(id: "proc_1")
|
|
16
16
|
class ProcessOutputTool < ::RubyLLM::Tool
|
|
17
|
-
def self.
|
|
17
|
+
def self.tool_name = 'process_output'
|
|
18
18
|
|
|
19
19
|
description "Read new stdout/stderr from a background process (started with process_start) " \
|
|
20
20
|
"since the last read, along with its status and exit code if it has finished. Poll " \
|
|
Binary file
|
|
@@ -22,7 +22,7 @@ module SharedTools
|
|
|
22
22
|
FRAMEWORKS = %w[pytest unittest].freeze
|
|
23
23
|
DEFAULT_TIMEOUT = 180
|
|
24
24
|
|
|
25
|
-
def self.
|
|
25
|
+
def self.tool_name = 'python_tests'
|
|
26
26
|
|
|
27
27
|
description "Run a Python project's test suite from root and report results. Uses pytest by " \
|
|
28
28
|
"default, or unittest (python -m unittest discover) when framework is unittest. " \
|
|
@@ -21,7 +21,7 @@ module SharedTools
|
|
|
21
21
|
REGEX_TIMEOUT = 2
|
|
22
22
|
IGNORED_DIRS = %w[.git .hg .svn node_modules .bundle tmp].freeze
|
|
23
23
|
|
|
24
|
-
def self.
|
|
24
|
+
def self.tool_name = 'replace_in_files'
|
|
25
25
|
|
|
26
26
|
description "Replace occurrences of a pattern with a replacement across files in root " \
|
|
27
27
|
"matching a glob (default '**/*'). Literal by default; set regex true to use a " \
|
|
@@ -21,7 +21,7 @@ module SharedTools
|
|
|
21
21
|
FRAMEWORKS = %w[rspec minitest].freeze
|
|
22
22
|
DEFAULT_TIMEOUT = 180
|
|
23
23
|
|
|
24
|
-
def self.
|
|
24
|
+
def self.tool_name = 'run_tests'
|
|
25
25
|
|
|
26
26
|
description "Run a Ruby project's test suite from root and report results. Auto-detects RSpec " \
|
|
27
27
|
"(spec/ or .rspec) or Minitest (test/ via rake), or set framework explicitly. " \
|
|
@@ -29,7 +29,7 @@ module SharedTools
|
|
|
29
29
|
REGEX_TIMEOUT = 2
|
|
30
30
|
IGNORED_DIRS = %w[.git .hg .svn node_modules .bundle tmp].freeze
|
|
31
31
|
|
|
32
|
-
def self.
|
|
32
|
+
def self.tool_name = 'search_codebase'
|
|
33
33
|
|
|
34
34
|
description "Search file contents for a regular expression under a directory. Returns " \
|
|
35
35
|
"'path:line: text' for each match, or context blocks when context/before/after " \
|
|
@@ -6,7 +6,7 @@ require 'securerandom'
|
|
|
6
6
|
module SharedTools
|
|
7
7
|
module Tools
|
|
8
8
|
class SecureToolTemplate < RubyLLM::Tool
|
|
9
|
-
def self.
|
|
9
|
+
def self.tool_name = 'secure_tool_template'
|
|
10
10
|
|
|
11
11
|
description <<~'DESCRIPTION'
|
|
12
12
|
Reference template demonstrating comprehensive security best practices for safe tool development.
|
|
@@ -11,7 +11,7 @@ module SharedTools
|
|
|
11
11
|
# tool.execute # all categories
|
|
12
12
|
# tool.execute(category: 'cpu') # CPU only
|
|
13
13
|
class SystemInfoTool < ::RubyLLM::Tool
|
|
14
|
-
def self.
|
|
14
|
+
def self.tool_name = 'system_info'
|
|
15
15
|
|
|
16
16
|
description <<~DESC
|
|
17
17
|
Retrieve system information from the local machine.
|
|
@@ -21,7 +21,7 @@ module SharedTools
|
|
|
21
21
|
STATUSES = %w[pending in_progress completed].freeze
|
|
22
22
|
MARKS = { "pending" => "[ ]", "in_progress" => "[~]", "completed" => "[x]" }.freeze
|
|
23
23
|
|
|
24
|
-
def self.
|
|
24
|
+
def self.tool_name = 'todo_write'
|
|
25
25
|
|
|
26
26
|
description "Maintain a task list for multi-step work. Pass the full list of todos; each call " \
|
|
27
27
|
"replaces the previous list. Each todo has a content string and a status of " \
|
|
@@ -19,7 +19,7 @@ module SharedTools
|
|
|
19
19
|
class TomlQueryTool < ::RubyLLM::Tool
|
|
20
20
|
MAX_BYTES = 5 * 1024 * 1024
|
|
21
21
|
|
|
22
|
-
def self.
|
|
22
|
+
def self.tool_name = 'toml_query'
|
|
23
23
|
|
|
24
24
|
description "Query TOML with a path expression, or pretty-print it. Provide either a file " \
|
|
25
25
|
"path or an inline toml string. Path syntax: keys separated by dots, [n] for " \
|
|
@@ -18,7 +18,7 @@ module SharedTools
|
|
|
18
18
|
MAX_ENTRIES = 500
|
|
19
19
|
IGNORED_DIRS = %w[.git .hg .svn node_modules .bundle tmp].freeze
|
|
20
20
|
|
|
21
|
-
def self.
|
|
21
|
+
def self.tool_name = 'tree'
|
|
22
22
|
|
|
23
23
|
description "Show a directory tree, to a limited depth. Directories are marked with a " \
|
|
24
24
|
"trailing slash. Skips ignored directories (node_modules, .git, ...) and hidden " \
|
|
@@ -16,7 +16,7 @@ module SharedTools
|
|
|
16
16
|
class WebFetchTool < ::RubyLLM::Tool
|
|
17
17
|
include HttpHelpers
|
|
18
18
|
|
|
19
|
-
def self.
|
|
19
|
+
def self.tool_name = 'web_fetch'
|
|
20
20
|
|
|
21
21
|
description "Fetch a web page or text/JSON resource over http/https and return its readable " \
|
|
22
22
|
"content (HTML is converted to text). Follows redirects safely. Cannot reach " \
|
|
@@ -7,7 +7,7 @@ require 'fileutils'
|
|
|
7
7
|
module SharedTools
|
|
8
8
|
module Tools
|
|
9
9
|
class WorkflowManagerTool < RubyLLM::Tool
|
|
10
|
-
def self.
|
|
10
|
+
def self.tool_name = 'workflow_manager'
|
|
11
11
|
|
|
12
12
|
description <<~'DESCRIPTION'
|
|
13
13
|
Manage complex multi-step workflows with persistent state tracking across tool invocations.
|
|
@@ -21,7 +21,7 @@ module SharedTools
|
|
|
21
21
|
MAX_BYTES = 5 * 1024 * 1024
|
|
22
22
|
PERMITTED = [Date, Time, Symbol].freeze
|
|
23
23
|
|
|
24
|
-
def self.
|
|
24
|
+
def self.tool_name = 'yaml_query'
|
|
25
25
|
|
|
26
26
|
description "Query YAML with a path expression, or pretty-print it. Provide either a file " \
|
|
27
27
|
"path or an inline yaml string. Loaded safely (no object deserialization). Path " \
|
data/lib/shared_tools/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: shared_tools
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dewayne VanHoozer
|
|
@@ -65,6 +65,22 @@ dependencies:
|
|
|
65
65
|
- ">="
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
67
|
version: "0"
|
|
68
|
+
- !ruby/object:Gem::Dependency
|
|
69
|
+
name: csv
|
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
-
|
|
73
|
+
- ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: "0"
|
|
76
|
+
type: :runtime
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
-
|
|
81
|
+
- ">="
|
|
82
|
+
- !ruby/object:Gem::Version
|
|
83
|
+
version: "0"
|
|
68
84
|
- !ruby/object:Gem::Dependency
|
|
69
85
|
name: bigdecimal
|
|
70
86
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -97,6 +113,22 @@ dependencies:
|
|
|
97
113
|
- ">="
|
|
98
114
|
- !ruby/object:Gem::Version
|
|
99
115
|
version: "0"
|
|
116
|
+
- !ruby/object:Gem::Dependency
|
|
117
|
+
name: tsort
|
|
118
|
+
requirement: !ruby/object:Gem::Requirement
|
|
119
|
+
requirements:
|
|
120
|
+
-
|
|
121
|
+
- ">="
|
|
122
|
+
- !ruby/object:Gem::Version
|
|
123
|
+
version: "0"
|
|
124
|
+
type: :development
|
|
125
|
+
prerelease: false
|
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
127
|
+
requirements:
|
|
128
|
+
-
|
|
129
|
+
- ">="
|
|
130
|
+
- !ruby/object:Gem::Version
|
|
131
|
+
version: "0"
|
|
100
132
|
- !ruby/object:Gem::Dependency
|
|
101
133
|
name: sequel
|
|
102
134
|
requirement: !ruby/object:Gem::Requirement
|