Class: StimulusPlumbers::MCP::Plugins::ControllerSchema
- Inherits:
-
Base
- Object
- Base
- StimulusPlumbers::MCP::Plugins::ControllerSchema
show all
- Defined in:
- lib/stimulus_plumbers/mcp/plugins/controller_schema.rb
Class Method Summary
collapse
Methods inherited from Base
json_resource, not_found, text_resource, text_tool
Class Method Details
.dynamic_resource_templates ⇒ Object
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/stimulus_plumbers/mcp/plugins/controller_schema.rb', line 23
def dynamic_resource_templates
[
::MCP::ResourceTemplate.new(
uri_template: "controller://{name}/schema",
name: "controller-schema",
description: "Targets, values, outlets, and classes for a Stimulus controller",
mime_type: "application/json"
)
].freeze
end
|
.loader ⇒ Object
10
|
# File 'lib/stimulus_plumbers/mcp/plugins/controller_schema.rb', line 10
def loader = ControllerSchemaLoader
|
.loader_key ⇒ Object
8
|
# File 'lib/stimulus_plumbers/mcp/plugins/controller_schema.rb', line 8
def loader_key = :controller_schema
|
.read(uri, store) ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/stimulus_plumbers/mcp/plugins/controller_schema.rb', line 34
def read(uri, store)
controllers = store[:controller_schema]
case uri
when "controller://index"
json_resource(uri, controllers.keys)
when %r{\Acontroller://([^/]+)/schema\z}
identifier = Regexp.last_match(1)
json_resource(uri, controllers[identifier] || { error: "unknown controller: #{identifier}" })
end
end
|
46
47
48
49
50
51
|
# File 'lib/stimulus_plumbers/mcp/plugins/controller_schema.rb', line 46
def register_tools(server, store)
controllers = store[:controller_schema]
register_list_controllers(server, controllers)
register_get_controller_schema(server, controllers)
end
|
.static_resources ⇒ Object
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/stimulus_plumbers/mcp/plugins/controller_schema.rb', line 12
def static_resources
[
::MCP::Resource.new(
uri: "controller://index",
name: "controllers-index",
description: "Index of all Stimulus controller identifiers in @stimulus-plumbers/controllers",
mime_type: "application/json"
)
].freeze
end
|