Class: ActionMCP::Generators::ViewGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/action_mcp/view/view_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_resource_template_fileObject



15
16
17
# File 'lib/generators/action_mcp/view/view_generator.rb', line 15

def create_resource_template_file
  template "resource_template.rb.erb", "app/mcp/resource_templates/#{file_name}.rb"
end

#create_view_fileObject



19
20
21
# File 'lib/generators/action_mcp/view/view_generator.rb', line 19

def create_view_file
  template "view.html.erb", "app/views/mcp/ui/#{view_name}.html.erb"
end

#show_instructionsObject



23
24
25
26
27
28
29
30
31
# File 'lib/generators/action_mcp/view/view_generator.rb', line 23

def show_instructions
  say <<~INSTRUCTIONS

    MCP Apps view created. Next steps:
      1. Enable MCP Apps in config/mcp.yml: mcp_apps_enabled: true
      2. Link a tool to this view: renders_ui "ui://views/#{uri_name}"
      3. Edit app/views/mcp/ui/#{view_name}.html.erb
  INSTRUCTIONS
end