Class: RailsAiBridge::Tools::GetSchema
- Defined in:
- lib/rails_ai_bridge/tools/get_schema.rb
Overview
MCP tool returning database schema tables, columns, indexes, and foreign keys.
Class Method Summary collapse
-
.call(table: nil, detail: 'standard', limit: nil, offset: 0, format: 'markdown', _server_context: nil) ⇒ MCP::Tool::Response
Schema markdown/JSON or an error message.
Methods inherited from BaseTool
cached_context, cached_section, config, rails_app, reset_cache!, text_response
Class Method Details
.call(table: nil, detail: 'standard', limit: nil, offset: 0, format: 'markdown', _server_context: nil) ⇒ MCP::Tool::Response
Returns schema markdown/JSON or an error message.
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/rails_ai_bridge/tools/get_schema.rb', line 53 def self.call(table: nil, detail: 'standard', limit: nil, offset: 0, format: 'markdown', _server_context: nil) schema = cached_section(:schema) return text_response('Schema introspection not available. Add :schema to introspectors.') unless schema return text_response("Schema introspection not available: #{schema[:error]}") if schema[:error] formatter = ResponseFormatter.new(schema, table: table, detail: detail, limit: limit, offset: offset, format: format) return text_response(formatter.) if formatter.table_not_found? text_response(formatter.format) end |