Class: Rubydex::MCPServer::Error
- Inherits:
-
Object
- Object
- Rubydex::MCPServer::Error
- Defined in:
- lib/rubydex/mcp_server/protocol.rb
Instance Method Summary collapse
-
#initialize(error, message = nil, suggestion = nil) ⇒ Error
constructor
: (String, ?String, ?String) -> void.
-
#to_json(*args) ⇒ Object
: (*untyped) -> String.
Constructor Details
#initialize(error, message = nil, suggestion = nil) ⇒ Error
: (String, ?String, ?String) -> void
32 33 34 35 36 |
# File 'lib/rubydex/mcp_server/protocol.rb', line 32 def initialize(error, = nil, suggestion = nil) @error = error @message = @suggestion = suggestion end |
Instance Method Details
#to_json(*args) ⇒ Object
: (*untyped) -> String
39 40 41 42 43 44 |
# File 'lib/rubydex/mcp_server/protocol.rb', line 39 def to_json(*args) payload = { error: @error } payload[:message] = @message if @message payload[:suggestion] = @suggestion if @suggestion payload.to_json(*args) end |