@@ -118,24 +118,21 @@ func (t *OpenAI2Transformer) convertContentBlocks(blocks []interface{}, role str
118118 parts = append (parts , transformer.OpenAI2ContentPart {Type : contentType , Text : text })
119119
120120 case "tool_use" :
121- id , _ := blockMap [ "id" ].( string )
121+ // Convert tool_use to output_text representation for Responses API
122122 name , _ := blockMap ["name" ].(string )
123123 input , _ := blockMap ["input" ].(map [string ]interface {})
124124 args , _ := json .Marshal (input )
125125 parts = append (parts , transformer.OpenAI2ContentPart {
126- Type : "tool_use" ,
127- ID : id ,
128- Name : name ,
129- Arguments : string (args ),
126+ Type : "output_text" ,
127+ Text : fmt .Sprintf ("[Tool Call: %s(%s)]" , name , string (args )),
130128 })
131129
132130 case "tool_result" :
133- toolUseID , _ := blockMap [ "tool_use_id" ].( string )
131+ // Convert tool_result to input_text representation for Responses API
134132 output := extractToolResultContent (blockMap ["content" ])
135133 parts = append (parts , transformer.OpenAI2ContentPart {
136- Type : "tool_result" ,
137- ToolUseID : toolUseID ,
138- Output : output ,
134+ Type : "input_text" ,
135+ Text : fmt .Sprintf ("[Tool Result: %s]" , output ),
139136 })
140137 }
141138 }
@@ -386,7 +383,7 @@ func (t *OpenAI2Transformer) handleStreamEvent(event *transformer.OpenAI2StreamE
386383 }
387384
388385 case "response.function_call_arguments.delta" :
389- if ! ctx .ToolBlockStarted {
386+ if ! ctx .ToolBlockStarted && event . Item != nil {
390387 ctx .ToolBlockStarted = true
391388 events = append (events , map [string ]interface {}{
392389 "type" : "content_block_start" ,
0 commit comments