Shell helpers can't be embedded in scripts or otherwise used with the rest of the shell's JS functionality.
The shell helpers' help messages should include the analogous JS, e.g.,
use <db_name> set current database (in JS, "db=db.getSiblingDB(<db_name>")
show collections show collections in current database (in JS, db.getCollectionNames())
etc.
Also the docs should mention these.