Capture Coordinates or Plugin Architecture

See:

I suspect if you want to interact programmatically you will need to use a 3rd party communication/control program (though I’d love to be wrong)

The Grbl folks have a page on options: