Class: LLM::Tool::Bundle

Inherits:
LLM::Tool show all
Defined in:
lib/llm/tools/bundle.rb

Overview

The Bundle class implements a tool that runs a command through bundle. It inherits the BUNDLE_GEMFILE environment variable when set, or defaults to a Gemfile in the current working directory.

Instance Method Summary collapse

Methods inherited from LLM::Tool

NotFound, a2a, a2a?, #a2a?, abstract!, abstract?, clear_registry!, description, find_by_name!, #function, function, inherited, mcp, #mcp?, mcp?, name, #on_cancel, #on_interrupt, params, register, registry, set, subclasses, unregister

Methods included from Param

#defaults, #param, #required

Methods included from Function::Registry

#clear_registry!, #find_by_name, #lock, #register, #registry, #registry_key, #tool_name, #unregister

Constructor Details

#initialize ⇒ LLM::Tool::BundleExec



23
24
25
# File 'lib/llm/tools/bundle.rb', line 23

def initialize
  @env = {"BUNDLE_GEMFILE" => ENV["BUNDLE_GEMFILE"] || File.join(Dir.getwd, "Gemfile")}
end

Instance Method Details

#call(arguments: [], timeout: 60, max_bytes: Exec.max_bytes) ⇒ Hash

Parameters:

  • arguments (Array<String>) (defaults to: []) —

    One or more command-line arguments

  • timeout (Integer) (defaults to: 60) —

    The maximum allowed time for the command to run (in seconds)

  • max_bytes (Integer) (defaults to: Exec.max_bytes) —

    Max number of bytes to emit

Returns:

  • (Hash)


35
36
37
38
39
40
41
42
# File 'lib/llm/tools/bundle.rb', line 35

def call(arguments: [], timeout: 60, max_bytes: Exec.max_bytes)
  Exec.new(env:).call(
    command: "bundle",
    arguments:,
    timeout:,
    max_bytes:
  )
end