Class: StimulusPlumbers::MCP::Plugins::Guide

Inherits:
Base
  • Object
show all
Defined in:
lib/stimulus_plumbers/mcp/plugins/guide.rb

Constant Summary collapse

GUIDE_NAMES =
%w[component controller tailwind theme].freeze

Class Method Summary collapse

Methods inherited from Base

json_resource, not_found, text_resource, text_tool

Class Method Details

.dynamic_resource_templatesObject



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/stimulus_plumbers/mcp/plugins/guide.rb', line 26

def dynamic_resource_templates
  [
    ::MCP::ResourceTemplate.new(
      uri_template: "guide://{name}",
      name:         "guide",
      description:  "Per-package usage guide: component (Rails forms/views), controller " \
                    "(plain-JS/non-Rails setup), tailwind (Tailwind install/theming), theme " \
                    "(custom theme integration contract)",
      mime_type:    "text/markdown"
    )
  ].freeze
end

.loaderObject



12
# File 'lib/stimulus_plumbers/mcp/plugins/guide.rb', line 12

def loader = GuideLoader

.loader_keyObject



10
# File 'lib/stimulus_plumbers/mcp/plugins/guide.rb', line 10

def loader_key = :guide

.read(uri, store) ⇒ Object



39
40
41
42
43
44
45
46
47
48
# File 'lib/stimulus_plumbers/mcp/plugins/guide.rb', line 39

def read(uri, store)
  guide = store[:guide]

  case uri
  when "guide://overview"
    text_resource(uri, "text/markdown", guide[:overview])
  when %r{\Aguide://(#{GUIDE_NAMES.join("|")})\z}
    text_resource(uri, "text/markdown", guide[Regexp.last_match(1).to_sym])
  end
end

.register_tools(server, store) ⇒ Object



50
51
52
53
54
55
# File 'lib/stimulus_plumbers/mcp/plugins/guide.rb', line 50

def register_tools(server, store)
  guide = store[:guide]

  register_list_guides(server)
  register_get_guide(server, guide)
end

.static_resourcesObject



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/stimulus_plumbers/mcp/plugins/guide.rb', line 14

def static_resources
  [
    ::MCP::Resource.new(
      uri:         "guide://overview",
      name:        "overview",
      description: "Start here — how to build views and forms with stimulus-plumbers, with pointers " \
                   "to every tool/resource",
      mime_type:   "text/markdown"
    )
  ].freeze
end