diff --git a/internal/version/VERSION b/internal/version/VERSION index cf59a272..0f757933 100644 --- a/internal/version/VERSION +++ b/internal/version/VERSION @@ -1 +1 @@ -v5.0.0-beta-2505271334 +v5.0.0-beta-2505271342 diff --git a/uixt/mcp_server.go b/uixt/mcp_server.go index 7e2fb3d3..4a4d96ff 100644 --- a/uixt/mcp_server.go +++ b/uixt/mcp_server.go @@ -986,8 +986,8 @@ func (t *ToolSwipeDirection) Implement() server.ToolHandlerFunc { opts := []option.ActionOption{ option.WithPreMarkOperation(true), - option.WithDuration(getFloat64ValueOrDefault(&unifiedReq.Duration, 0.5)), - option.WithPressDuration(getFloat64ValueOrDefault(&unifiedReq.PressDuration, 0.1)), + option.WithDuration(getFloat64ValueOrDefault(unifiedReq.Duration, 0.5)), + option.WithPressDuration(getFloat64ValueOrDefault(unifiedReq.PressDuration, 0.1)), } // Convert direction to coordinates and perform swipe @@ -2413,31 +2413,9 @@ func (t *ToolFinished) ConvertActionToCallToolRequest(action MobileAction) (mcp. return mcp.CallToolRequest{}, fmt.Errorf("invalid finished params: %v", action.Params) } -// Helper functions for pointer type handling -func getFloat64Value(ptr *float64) float64 { - if ptr == nil { - return 0 - } - return *ptr -} - -func getFloat64ValueOrDefault(ptr *float64, defaultValue float64) float64 { - if ptr == nil { +func getFloat64ValueOrDefault(value float64, defaultValue float64) float64 { + if value == 0 { return defaultValue } - return *ptr -} - -func getIntValue(ptr *int) int { - if ptr == nil { - return 0 - } - return *ptr -} - -func getBoolValue(ptr *bool) bool { - if ptr == nil { - return false - } - return *ptr + return value }