According to this doc page the result of a control command can be used in a query by using $command_results.
Now, how to achieve that when the query makes use of query_parameters?
.show tables;
declare query_parameters(_rootPath:string = "root")
$command_results
| where Folder startswith _rootPath
This throws
400 - "General_BadRequest: Request is invalid and cannot be executed.
Syntax error: Query could not be parsed: SYN0002: A recognition error occurred. [line:position=3:0]