In the editor, there is a tan box showing the size of the object when it is selected. Is there any way to get this through GDscript?
I'm sure to understand which box you are talking about... I suggest you to share a screenshot (use https://fr.imgbb.com/ if needed)
from my understanding youre talking about the AABB (axis-aligned bounding-box).
godot even has something ready for you: