Class: RailsAiBridge::Tools::GetRoutes
- Defined in:
- lib/rails_ai_bridge/tools/get_routes.rb
Overview
MCP tool listing routes with optional controller filter, detail level, and pagination.
Class Method Summary collapse
-
.call(controller: nil, detail: 'standard', limit: nil, offset: 0, _server_context: nil) ⇒ MCP::Tool::Response
Markdown routes output or an error message.
Methods inherited from BaseTool
cached_context, cached_section, config, rails_app, reset_cache!, text_response
Class Method Details
.call(controller: nil, detail: 'standard', limit: nil, offset: 0, _server_context: nil) ⇒ MCP::Tool::Response
Returns markdown routes output or an error message.
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/rails_ai_bridge/tools/get_routes.rb', line 41 def self.call(controller: nil, detail: 'standard', limit: nil, offset: 0, _server_context: nil) routes = cached_section(:routes) return text_response('Route introspection not available. Add :routes to introspectors.') unless routes return text_response("Route introspection failed: #{routes[:error]}") if routes[:error] formatter = ResponseFormatter.new(routes, controller: controller, detail: detail, limit: limit, offset: offset) return text_response(formatter.) if formatter.filter_error? text_response(formatter.format) end |