Class: LLM::Tool::Ls
Overview
The LLM::Tool::Ls class implements a tool that can list files and directories, with an optional glob pattern to filter results.
Instance Method Summary collapse
Methods inherited from LLM::Tool
a2a, a2a?, #a2a?, clear_registry!, description, find_by_name!, function, #function, inherited, mcp, mcp?, #mcp?, name, #on_cancel, #on_interrupt, params, register, registry, skill?, #skill?, unregister
Methods included from Param
Methods included from Function::Registry
#clear_registry!, extended, #find_by_name, #lock, #register, #registry, #registry_key, #tool_name, #unregister
Instance Method Details
#call(path: Dir.getwd, glob: "*") ⇒ Hash
18 19 20 21 22 |
# File 'lib/llm/tools/ls.rb', line 18 def call(path: Dir.getwd, glob: "*") validate!(path:) entries = Dir.glob(File.join(path, glob)) {ok: true, entries:, count: entries.size} end |