@@ -201,6 +201,12 @@ func initPods() []api.ServerTool {
201
201
Type : "string" ,
202
202
Description : "Name of the Pod container to get the logs from (Optional)" ,
203
203
},
204
+ "tailLines" : {
205
+ Type : "integer" ,
206
+ Description : "Number of lines to retrieve from the end of the logs (Optional, default: 256)" ,
207
+ Default : api .ToRawMessage (int64 (256 )),
208
+ Minimum : ptr .To (float64 (0 )),
209
+ },
204
210
"previous" : {
205
211
Type : "boolean" ,
206
212
Description : "Return previous terminated container logs (Optional)" ,
@@ -396,7 +402,24 @@ func podsLog(params api.ToolHandlerParams) (*api.ToolCallResult, error) {
396
402
if previous != nil {
397
403
previousBool = previous .(bool )
398
404
}
399
- ret , err := params .PodsLog (params , ns .(string ), name .(string ), container .(string ), previousBool )
405
+ // Extract tailLines parameter
406
+ tailLines := params .GetArguments ()["tailLines" ]
407
+ var tailLinesInt int64
408
+ if tailLines != nil {
409
+ // Convert to int64 - safely handle both float64 (JSON number) and int types
410
+ switch v := tailLines .(type ) {
411
+ case float64 :
412
+ tailLinesInt = int64 (v )
413
+ case int :
414
+ tailLinesInt = int64 (v )
415
+ case int64 :
416
+ tailLinesInt = v
417
+ default :
418
+ return api .NewToolCallResult ("" , fmt .Errorf ("failed to parse tailLines parameter: expected integer, got %T" , tailLines )), nil
419
+ }
420
+ }
421
+
422
+ ret , err := params .PodsLog (params .Context , ns .(string ), name .(string ), container .(string ), previousBool , tailLinesInt )
400
423
if err != nil {
401
424
return api .NewToolCallResult ("" , fmt .Errorf ("failed to get pod %s log in namespace %s: %v" , name , ns , err )), nil
402
425
} else if ret == "" {
0 commit comments