Class: LLMDB::Tools::ListTables

Inherits:
RubyLLM::Tool
  • Object
show all
Defined in:
lib/llmdb/tools/list_tables.rb

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ ListTables

Returns a new instance of ListTables.



6
7
8
9
# File 'lib/llmdb/tools/list_tables.rb', line 6

def initialize(connection)
  super()
  @connection = connection
end

Instance Method Details

#executeObject



11
12
13
14
15
16
17
18
# File 'lib/llmdb/tools/list_tables.rb', line 11

def execute
  tables = @connection.tables
  return "No tables found in the database." if tables.empty?

  tables.join(", ")
rescue LLMDB::QueryError => e
  { error: e.message }
end