Class: SolidLoop::McpToolExecutionService
- Inherits:
-
Object
- Object
- SolidLoop::McpToolExecutionService
- Defined in:
- app/services/solid_loop/mcp_tool_execution_service.rb
Instance Attribute Summary collapse
-
#agent ⇒ Object
readonly
Returns the value of attribute agent.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#mcp_config ⇒ Object
readonly
Returns the value of attribute mcp_config.
-
#mcp_tool ⇒ Object
readonly
Returns the value of attribute mcp_tool.
-
#retries_count ⇒ Object
readonly
Returns the value of attribute retries_count.
-
#session ⇒ Object
readonly
Returns the value of attribute session.
-
#tool_call ⇒ Object
readonly
Returns the value of attribute tool_call.
Class Method Summary collapse
Instance Method Summary collapse
- #call(arguments) ⇒ Object
-
#initialize(mcp_tool, agent, tool_call: nil) ⇒ McpToolExecutionService
constructor
A new instance of McpToolExecutionService.
Constructor Details
#initialize(mcp_tool, agent, tool_call: nil) ⇒ McpToolExecutionService
Returns a new instance of McpToolExecutionService.
9 10 11 12 13 14 15 16 |
# File 'app/services/solid_loop/mcp_tool_execution_service.rb', line 9 def initialize(mcp_tool, agent, tool_call: nil) @mcp_tool = mcp_tool @agent = agent @tool_call = tool_call @session = mcp_tool.mcp_session @mcp_config = agent.mcps.find { |c| c[:name].to_s == @session&.mcp_name } @retries_count = 0 end |
Instance Attribute Details
#agent ⇒ Object (readonly)
Returns the value of attribute agent.
3 4 5 |
# File 'app/services/solid_loop/mcp_tool_execution_service.rb', line 3 def agent @agent end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
3 4 5 |
# File 'app/services/solid_loop/mcp_tool_execution_service.rb', line 3 def client @client end |
#mcp_config ⇒ Object (readonly)
Returns the value of attribute mcp_config.
3 4 5 |
# File 'app/services/solid_loop/mcp_tool_execution_service.rb', line 3 def mcp_config @mcp_config end |
#mcp_tool ⇒ Object (readonly)
Returns the value of attribute mcp_tool.
3 4 5 |
# File 'app/services/solid_loop/mcp_tool_execution_service.rb', line 3 def mcp_tool @mcp_tool end |
#retries_count ⇒ Object (readonly)
Returns the value of attribute retries_count.
3 4 5 |
# File 'app/services/solid_loop/mcp_tool_execution_service.rb', line 3 def retries_count @retries_count end |
#session ⇒ Object (readonly)
Returns the value of attribute session.
3 4 5 |
# File 'app/services/solid_loop/mcp_tool_execution_service.rb', line 3 def session @session end |
#tool_call ⇒ Object (readonly)
Returns the value of attribute tool_call.
3 4 5 |
# File 'app/services/solid_loop/mcp_tool_execution_service.rb', line 3 def tool_call @tool_call end |
Class Method Details
.call(mcp_tool:, agent:, arguments:, tool_call: nil) ⇒ Object
5 6 7 |
# File 'app/services/solid_loop/mcp_tool_execution_service.rb', line 5 def self.call(mcp_tool:, agent:, arguments:, tool_call: nil) new(mcp_tool, agent, tool_call: tool_call).call(arguments) end |
Instance Method Details
#call(arguments) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'app/services/solid_loop/mcp_tool_execution_service.rb', line 18 def call(arguments) @start_time = Time.current validate_context! @client = create_client execute_with_retries(arguments) rescue => e build_error_result(e) end |