Commit 2a01ebe
Changed files (1)
lib
elelem
plugins
lib/elelem/plugins/eval.rb
@@ -1,8 +1,17 @@
# frozen_string_literal: true
Elelem::Plugins.register(:eval) do |toolbox|
+ description = <<~'DESC'
+ Evaluate Ruby code. Available API:
+
+ name = "search"
+ toolbox.add(name, description: "Search using rg", params: { query: { type: "string" } }, required: ["query"], aliases: []) do |args|
+ toolbox.run("execute", { "command" => "rg --json -nI -F #{args["query"]}" })
+ end
+ DESC
+
toolbox.add("eval",
- description: "Evaluate Ruby code. Use `toolbox.add(name, description:, params:, required:) { |args| ... }` to register new tools.",
+ description: description,
params: { ruby: { type: "string" } },
required: ["ruby"]
) do |args|