Class: StimulusPlumbers::MCP::Plugins::ControllerDocs
- Inherits:
-
Base
- Object
- Base
- StimulusPlumbers::MCP::Plugins::ControllerDocs
show all
- Defined in:
- lib/stimulus_plumbers/mcp/plugins/controller_docs.rb
Overview
Shares the controller:// scheme with Plugins::ControllerSchema, distinguished by the
docs/ path segment (ControllerSchema is per-identifier schema data; docs/ is
narrative markdown, grouped by controller family, not individual identifier).
Class Method Summary
collapse
Methods inherited from Base
json_resource, not_found, text_resource, text_tool
Class Method Details
.dynamic_resource_templates ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/stimulus_plumbers/mcp/plugins/controller_docs.rb', line 27
def dynamic_resource_templates
[
::MCP::ResourceTemplate.new(
uri_template: "controller://docs/{name}",
name: "controller-doc",
description: "Narrative usage doc for a controller family, for plain-JS/Hotwire consumers " \
"without Rails helpers",
mime_type: "text/markdown"
)
].freeze
end
|
.loader ⇒ Object
13
|
# File 'lib/stimulus_plumbers/mcp/plugins/controller_docs.rb', line 13
def loader = ControllerDocsLoader
|
.loader_key ⇒ Object
11
|
# File 'lib/stimulus_plumbers/mcp/plugins/controller_docs.rb', line 11
def loader_key = :controller_docs
|
.read(uri, store) ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/stimulus_plumbers/mcp/plugins/controller_docs.rb', line 39
def read(uri, store)
docs = store[:controller_docs]
case uri
when "controller://docs"
json_resource(uri, docs.keys)
when %r{\Acontroller://docs/(.+)\z}
key = Regexp.last_match(1).to_sym
docs[key] ? text_resource(uri, "text/markdown", docs[key]) : missing(uri, key)
end
end
|
51
52
53
54
55
56
|
# File 'lib/stimulus_plumbers/mcp/plugins/controller_docs.rb', line 51
def register_tools(server, store)
docs = store[:controller_docs]
register_list_controller_docs(server, docs)
register_get_controller_docs(server, docs)
end
|
.static_resources ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/stimulus_plumbers/mcp/plugins/controller_docs.rb', line 15
def static_resources
[
::MCP::Resource.new(
uri: "controller://docs",
name: "controller-docs-index",
description: "Index of JS controller narrative docs, grouped by controller family " \
"(e.g. :calendar covers calendar-month/-year/-decade)",
mime_type: "application/json"
)
].freeze
end
|