File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
lib/active_agent/providers/common/messages Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,10 @@ AllCops:
1111 TargetRubyVersion : 3.3
1212 NewCops : enable
1313 SuggestExtensions : false
14+ Exclude :
15+ - " test/dummy/tmp/**/*"
16+ - " node_modules/**/*"
17+ - " vendor/**/*"
1418
1519Style/StringLiterals :
1620 EnforcedStyle : double_quotes
Original file line number Diff line number Diff line change @@ -142,11 +142,15 @@ def split_content_blocks(message)
142142 Common ::Messages ::Assistant . new ( role : "assistant" , content : block [ :text ] , name : message . name )
143143 when "tool_use"
144144 # Create a message with tool use info as string representation
145- tool_info = "[Tool Use: #{ block [ :name ] } ]\n ID: #{ block [ :id ] } \n Input: #{ JSON . pretty_generate ( block [ :input ] ) } "
145+ input = block [ :input ]
146+ input_str = input . nil? || input . empty? ? "{}" : JSON . pretty_generate ( input )
147+ tool_info = "[Tool Use: #{ block [ :name ] } ]\n ID: #{ block [ :id ] } \n Input: #{ input_str } "
146148 Common ::Messages ::Assistant . new ( role : "assistant" , content : tool_info , name : message . name )
147149 when "mcp_tool_use"
148150 # Create a message with MCP tool use info
149- tool_info = "[MCP Tool Use: #{ block [ :name ] } ]\n ID: #{ block [ :id ] } \n Server: #{ block [ :server_name ] } \n Input: #{ JSON . pretty_generate ( block [ :input ] || { } ) } "
151+ input = block [ :input ]
152+ input_str = input . nil? || input . empty? ? "{}" : JSON . pretty_generate ( input )
153+ tool_info = "[MCP Tool Use: #{ block [ :name ] } ]\n ID: #{ block [ :id ] } \n Server: #{ block [ :server_name ] } \n Input: #{ input_str } "
150154 Common ::Messages ::Assistant . new ( role : "assistant" , content : tool_info , name : message . name )
151155 when "mcp_tool_result"
152156 # Create a message with MCP tool result
You can’t perform that action at this time.
0 commit comments