If your drawable is a layer*, you can open up one of the dialogs that operate on layers ("Layer->Scale Layer...", "Layer->Set Layer Boundary Size...", any command in the Layer menu with ellipses at the end will open a dialog), and find the numeric value of the drawable identifier at the top of the dialog. The number that follows the layer name is the ID of the drawable. Once you find the ID of the drawable, you can Cancel the dialog.
For example, in the following screenshot the layer's ID (highlighted in blue) would "104". So
(gimp-invert 104) would invert the colors of (the selected portion of) that layer.
Attachment:
File comment: Dialog with layer ID highlighted in blue
SS-layer-id.png [ 130.85 KiB | Viewed 2220 times ]
A similar approach works for the image, channel, and path IDs; just open a menu command that raises a dialog and look for the ID at the top.