KQL Plugin: custom page model method not allowed in api context

While I can’t answer your question I wonder why you need this model method at all instead of:

"query": "page('projekte').children.filterBy('category', 'in', ['foo', 'bar'], ',')"