Class: PromptObjects::MCP::Tools::InspectPO

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

Overview

Get detailed information about a prompt object

Class Method Summary collapse

Class Method Details

.call(po_name:, server_context:) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/prompt_objects/mcp/tools/inspect_po.rb', line 22

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

  po = env.registry.get(po_name)
  unless po.is_a?(PromptObjects::PromptObject)
    return ::MCP::Tool::Response.new([{
      type: "text",
      text: JSON.generate({ error: "Prompt object '#{po_name}' not found" })
    }])
  end

  info = po.to_inspect_hash(registry: env.registry)

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