Class: TalkToYourApp::Plugins::Db::Tools::Tables
- Defined in:
- lib/talk_to_your_app/plugins/db/tools/tables.rb
Overview
Lists the table names in the wired database, so a client can discover
the schema before querying. Runs on the connection wired into the DB
plugin (config.plugin :db, connection: :read).
Instance Method Summary collapse
Methods inherited from Tool
argument, arguments, clear_custom_registry!, connection, custom_registry, default_arguments, description, dispatch, inherited, input_schema_hash, invoke, name, normalize_response, to_mcp_definition, to_mcp_tool, tool_name
Instance Method Details
#call(_args, ctx) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/talk_to_your_app/plugins/db/tools/tables.rb', line 16 def call(_args, ctx) tables = ctx.connection { |conn| conn.tables.sort } json(tables: tables) rescue ActiveRecord::ActiveRecordError => e error("Could not list tables: #{e.}") end |