Class: PromptObjects::MCP::Tools::GetPendingRequests
- Inherits:
-
MCP::Tool
- Object
- MCP::Tool
- PromptObjects::MCP::Tools::GetPendingRequests
- Defined in:
- lib/prompt_objects/mcp/tools/get_pending_requests.rb
Overview
Get pending capability-approval requests from the queue.
Class Method Summary collapse
Class Method Details
.call(po_name: nil, server_context:) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/prompt_objects/mcp/tools/get_pending_requests.rb', line 21 def self.call(po_name: nil, server_context:) env = server_context[:env] queue = env.human_queue requests = if po_name queue.pending_for(po_name) else queue.all_pending end formatted = requests.map do |req| { id: req.id, capability: req.capability, question: req.question, options: req., age: req.age_string, created_at: req.created_at.iso8601 } end ::MCP::Tool::Response.new([{ type: "text", text: JSON.pretty_generate({ count: formatted.length, requests: formatted }) }]) end |