Class: Foobara::McpConnector::StdioRunner
- Inherits:
-
Object
- Object
- Foobara::McpConnector::StdioRunner
- Defined in:
- foobara-mcp-connector-0.0.4/src/stdio_runner.rb
Instance Attribute Summary collapse
-
#last_unexpected_error ⇒ Object
Returns the value of attribute last_unexpected_error.
-
#mcp_connector ⇒ Object
Returns the value of attribute mcp_connector.
Instance Method Summary collapse
-
#initialize(mcp_connector) ⇒ StdioRunner
constructor
A new instance of StdioRunner.
- #run(io_in: $stdin, io_out: $stdout, io_err: $stderr) ⇒ Object
Constructor Details
#initialize(mcp_connector) ⇒ StdioRunner
Returns a new instance of StdioRunner.
6 7 8 |
# File 'foobara-mcp-connector-0.0.4/src/stdio_runner.rb', line 6 def initialize(mcp_connector) self.mcp_connector = mcp_connector end |
Instance Attribute Details
#last_unexpected_error ⇒ Object
Returns the value of attribute last_unexpected_error.
4 5 6 |
# File 'foobara-mcp-connector-0.0.4/src/stdio_runner.rb', line 4 def last_unexpected_error @last_unexpected_error end |
#mcp_connector ⇒ Object
Returns the value of attribute mcp_connector.
4 5 6 |
# File 'foobara-mcp-connector-0.0.4/src/stdio_runner.rb', line 4 def mcp_connector @mcp_connector end |
Instance Method Details
#run(io_in: $stdin, io_out: $stdout, io_err: $stderr) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'foobara-mcp-connector-0.0.4/src/stdio_runner.rb', line 10 def run(io_in: $stdin, io_out: $stdout, io_err: $stderr) io_in.each_line do |request| response = mcp_connector.run(request) if response io_out.puts response io_out.flush end rescue => e # :nocov: self.last_unexpected_error = e io_err.puts e. io_err.puts e.backtrace io_err.flush # :nocov: end end |