Tree-sitter query API?

For those of us that have a Tree-sitter grammar in place, we could imagine being able to e.g. formulate “issues” strictly as a result of processing that grammar. It would be very nice if we could have access to query results from the extension API. This would (in my case at least) enable a richer level of functionality even when a language server isn’t available.