@@ -190,17 +190,23 @@ impl ChatResponse for CodeGraphChatResponse {
190190 }
191191
192192 fn tool_calls ( & self ) -> Option < Vec < ToolCall > > {
193+ tracing:: info!( "tool_calls() called with content length: {}" , self . content. len( ) ) ;
194+ tracing:: debug!( "Content preview: {}" , & self . content. chars( ) . take( 200 ) . collect:: <String >( ) ) ;
195+
193196 // Try to parse the response as CodeGraph's JSON format
194197 match serde_json:: from_str :: < CodeGraphLLMResponse > ( & self . content ) {
195198 Ok ( parsed) => {
199+ tracing:: info!( "Successfully parsed CodeGraphLLMResponse. has_tool_call={}, is_final={}" ,
200+ parsed. tool_call. is_some( ) , parsed. is_final) ;
201+
196202 // If there's a tool_call and is_final is false, convert to AutoAgents format
197203 if let Some ( tool_call) = parsed. tool_call {
198204 if !parsed. is_final {
199205 // Convert parameters to JSON string
200206 let arguments = match serde_json:: to_string ( & tool_call. parameters ) {
201207 Ok ( json) => json,
202208 Err ( e) => {
203- tracing:: warn !(
209+ tracing:: error !(
204210 "Failed to serialize tool call parameters: {}" ,
205211 e
206212 ) ;
@@ -211,36 +217,38 @@ impl ChatResponse for CodeGraphChatResponse {
211217 // Generate unique ID using atomic counter
212218 let call_id = TOOL_CALL_COUNTER . fetch_add ( 1 , Ordering :: SeqCst ) ;
213219
214- tracing:: debug!(
215- "Parsed tool call: {} with args: {}" ,
216- tool_call. tool_name,
217- arguments
218- ) ;
219-
220220 let autoagents_tool_call = ToolCall {
221221 id : format ! ( "call_{}" , call_id) ,
222222 call_type : "function" . to_string ( ) ,
223223 function : FunctionCall {
224- name : tool_call. tool_name ,
225- arguments,
224+ name : tool_call. tool_name . clone ( ) ,
225+ arguments : arguments . clone ( ) ,
226226 } ,
227227 } ;
228228
229+ tracing:: info!(
230+ "Returning tool call: name='{}', args='{}', id='{}'" ,
231+ tool_call. tool_name,
232+ arguments,
233+ autoagents_tool_call. id
234+ ) ;
235+
229236 return Some ( vec ! [ autoagents_tool_call] ) ;
230237 } else {
231- tracing:: debug !( "is_final is true, not returning tool calls" ) ;
238+ tracing:: info !( "is_final is true, not returning tool calls" ) ;
232239 }
233240 } else {
234- tracing:: debug !( "No tool_call in parsed response" ) ;
241+ tracing:: info !( "No tool_call field in parsed response" ) ;
235242 }
236243 }
237244 Err ( e) => {
238245 // Not a JSON response or doesn't match our format - that's fine
239- tracing:: trace!( "Response is not CodeGraph JSON format: {}" , e) ;
246+ tracing:: warn!( "Response is not CodeGraph JSON format: {}. Content: {}" ,
247+ e, & self . content. chars( ) . take( 500 ) . collect:: <String >( ) ) ;
240248 }
241249 }
242250
243- // No tool calls in response
251+ tracing :: info! ( "tool_calls() returning None" ) ;
244252 None
245253 }
246254}
0 commit comments