Class: LLM::Tool::DirTree
- Defined in:
- lib/llm/tools/dir_tree.rb
Overview
The DirTree class implements a tool that returns the contents of a directory and its children.
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
Methods included from Function::Registry
#clear_registry!, #find_by_name, #lock, #register, #registry, #registry_key, #tool_name, #unregister
Instance Method Details
#call(path:, depth: 5) ⇒ Hash
24 25 26 27 |
# File 'lib/llm/tools/dir_tree.rb', line 24 def call(path:, depth: 5) raise "path does not exist: #{path}" unless Dir.exist?(path) {ok: true, tree: walk(path:, depth:)} end |