Module: Evilution::MCP::InfoTool::ResponseFormatter
- Defined in:
- lib/evilution/mcp/info_tool/response_formatter.rb
Class Method Summary collapse
Class Method Details
.error(type, message) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/evilution/mcp/info_tool/response_formatter.rb', line 14 def error(type, ) ::MCP::Tool::Response.new( [{ type: "text", text: ::JSON.generate({ error: { type: type, message: } }) }], error: true ) end |
.error_for(exception) ⇒ Object
21 22 23 |
# File 'lib/evilution/mcp/info_tool/response_formatter.rb', line 21 def error_for(exception) error(Evilution::MCP::InfoTool::ErrorMapper.type_for(exception), exception.) end |
.success(payload) ⇒ Object
10 11 12 |
# File 'lib/evilution/mcp/info_tool/response_formatter.rb', line 10 def success(payload) ::MCP::Tool::Response.new([{ type: "text", text: ::JSON.generate(payload) }]) end |