Module: ActionMCP::Server::Handlers::PromptHandler

Includes:
ErrorAware
Included in:
JsonRpcHandler
Defined in:
lib/action_mcp/server/handlers/prompt_handler.rb

Instance Method Summary collapse

Instance Method Details

#process_prompts(rpc_method, id, params) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/action_mcp/server/handlers/prompt_handler.rb', line 9

def process_prompts(rpc_method, id, params)
  params ||= {}

  with_error_handling(id) do
    unless params.is_a?(Hash)
      raise JSON_RPC::JsonRpcError.new(:invalid_params, message: "Prompt params must be an object")
    end

    handler = prompt_method_handlers[rpc_method]
    if handler
      send(handler, id, params)
    else
      Rails.logger.warn("Unknown prompts method: #{rpc_method}")
      raise JSON_RPC::JsonRpcError.new(:method_not_found, message: "Unknown prompts method: #{rpc_method}")
    end
  end
end