Class: RubyMCP::Prompts
- Inherits:
-
Object
- Object
- RubyMCP::Prompts
- Defined in:
- lib/ruby_mcp/prompts.rb
Instance Method Summary collapse
- #add(name:, description:, arguments: [], result: Proc.new { [] }, completions: nil) ⇒ Object
- #find_by_name(name) ⇒ Object
-
#initialize ⇒ Prompts
constructor
A new instance of Prompts.
- #list ⇒ Object
Constructor Details
#initialize ⇒ Prompts
3 4 5 |
# File 'lib/ruby_mcp/prompts.rb', line 3 def initialize @prompts = {} end |
Instance Method Details
#add(name:, description:, arguments: [], result: Proc.new { [] }, completions: nil) ⇒ Object
7 8 9 |
# File 'lib/ruby_mcp/prompts.rb', line 7 def add(name:, description:, arguments: [], result: Proc.new { [] }, completions: nil) @prompts[name] = { description:, arguments:, result:, completions: } end |
#find_by_name(name) ⇒ Object
21 22 23 |
# File 'lib/ruby_mcp/prompts.rb', line 21 def find_by_name(name) @prompts[name] end |
#list ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/ruby_mcp/prompts.rb', line 11 def list @prompts.map do |name, details| { name: name, description: details[:description], arguments: details[:arguments].map { _1.slice(:name, :description, :required) } } end end |