Class: PromptObjects::MCP::Tools::ListPromptObjects

Inherits:
MCP::Tool
  • Object
show all
Defined in:
lib/prompt_objects/mcp/tools/list_prompt_objects.rb

Overview

List all loaded prompt objects with their current state

Class Method Summary collapse

Class Method Details

.call(server_context:, **_args) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/prompt_objects/mcp/tools/list_prompt_objects.rb', line 16

def self.call(server_context:, **_args)
  env = server_context[:env]

  pos = env.registry.prompt_objects.map do |po|
    po.to_summary_hash(registry: env.registry)
  end

  ::MCP::Tool::Response.new([{
    type: "text",
    text: JSON.pretty_generate(pos)
  }])
end