Here was my argument against this, the second law of thermodynamics, in effect says that, there is no heat engine that can take all of some energy that was transferred to it by heat and do work on some object. So, if we can not take a 100% the thermal energy of an object, and use it to do work, what about the thermal energy that is rejected to the environment, can we use all of that energy to do work on an object? No, if energy is supposed to be the ability to do work, well that’s a contradiction.
"The ability to do work" is certainly a lousy definition of energy.
Is it "merely" a lousy definition, or is it actually an incorrect definition? I think it could be either, depending on precisely how the word "ability" is interpreted. But if the words are interpreted as they would be in everyday speech and everyday life, I would say it's an incorrect definition.
UPDATE -- What is a definition of energy that is not lousy?
This is a tricky issue. Defining a thing that exists in the real world (like you do in physics) is quite different than defining a concept within an axiomatic framework (like you do in math).
For example, how do you "define" Mount Everest? Well, you don't exactly define it, you merely describe it! You describe where it is, you describe what it looks like, you describe how tall it is, etc. Since there is only one mountain that has all these properties, you wind up with a "definition".
Likewise, if I start describing energy (i.e. listing out various properties of energy), I will eventually wind up with a definition of energy (because nothing except energy has all these properties). Here goes:
The following are examples of energy: Kinetic energy, electric potential energy, gravitational potential energy, ...
The fundamental laws of physics are the same at every moment in time -- they were the same yesterday as they are today. This fact implies, by Noether's theorem, that there is a conserved quantity in our universe... This quantity is energy.
Special relativity relates energy to mass / inertia.
General Relativity relates energy to the curvature of spacetime.
In quantum mechanics, the energy of a system is its eigenvalue with respect to the Hamiltonian operator.
Whatever other things I'm forgetting or haven't learned...
All these properties are interrelated, and out of them bubbles a completely precise and unambiguous understanding of what energy is.
(I'm sure that some people will claim that one bullet point is the fundamental definition of energy, while the other bullet points are "merely" derived consequences. But you should know that this is a somewhat arbitrary decision. The same thing is true even in mathematics. What aspects of "differentiable manifold" are part of its definition, and what aspects are proven by theorems? Different textbooks will disagree.)
But can you boil that understanding of energy down into a one sentence "definition" that is technically correct and easy to understand? Well, I can't, and I doubt anyone on earth can.
The 2nd Law, recasted (as you did) in terms of Carnot efficiency, just says the ideal scenario is all energy is converted to work while in reality there is a loss through some heating. So it doesn't contradict energy being the ability to do work.
Your phrase "energy is the ability to do work" is justified by the Work-Energy theorem, i.e. $W=\triangle KE$. If you didn't start with kinetic energy, then use the Conservation of Energy Law first.
I've always liked and used Feynman's definition of energy as articulated in The Feynman Lectures (don't have the specific reference in front of me, but it's in volume one in the chapter on conservation of energy). Feynman defines energy as a number that doesn't change as Nature undergoes her processes. Of course, there are quite a few such numbers, but nevertheless energy is one of those numbers. You may also find the book Energy, the Subtle Concept: The discovery of Feynman's blocks from Leibniz to Einstein by Jennifer Coopersmith a useful reference.
Your statement of the Second Law is incorrect. Your version should be "there is no heat engine that can take all of some energy that was transferred to it by heat and do work on some object in a cyclic process." (My added words are in italics.)
It is certainly true that in a non-cyclic process all the heat can be converted to work. Think of the expansion of a gas in a cylinder with a movable piston raising a weight.
As for the definition of energy, defining it as the capacity to do work seems to be as good a definition as one can easily get.