@@ -201,6 +201,12 @@ func initPods() []api.ServerTool {
201201 Type : "string" ,
202202 Description : "Name of the Pod container to get the logs from (Optional)" ,
203203 },
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+ },
204210 "previous" : {
205211 Type : "boolean" ,
206212 Description : "Return previous terminated container logs (Optional)" ,
@@ -396,7 +402,24 @@ func podsLog(params api.ToolHandlerParams) (*api.ToolCallResult, error) {
396402 if previous != nil {
397403 previousBool = previous .(bool )
398404 }
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 )
400423 if err != nil {
401424 return api .NewToolCallResult ("" , fmt .Errorf ("failed to get pod %s log in namespace %s: %v" , name , ns , err )), nil
402425 } else if ret == "" {
0 commit comments