[Function Calling Not Working] mwai_functions_list + Meow_MWAI_Query_Function::f
-
Hi,
I’m using the latest Pro version of AI Engine with a valid license, and I’m trying to register a custom PHP function so that it can be called via chatbot using Function Calling. 🔍 My Goal:
I want to call a PHP function (e.g.
fetch_order_info) from a chatbot. I followed the official documentation and used themwai_functions_listfilter along withMeow_MWAI_Query_Function::fromJson()to define and register the function. ✅ What I tried:- I added this code inside the Code Engine → PHP Snippet:
phpCopy
Edit
add_filter('mwai_functions_list', function($functions) { $functions[] = Meow_MWAI_Query_Function::fromJson([ 'id' => 'fetch_order_info', 'type' => 'manual', 'name' => 'fetch_order_info', 'desc' => 'Fetch order data from Airtable', 'args' => [ [ 'name' => 'order_id', 'type' => 'string', 'required' => true, 'desc' => 'Order ID', ], ], ]); return $functions; });But I constantly get:
javascriptCopy
Edit
⚠️ Invalid PHP FunctionEven when trying just the filter line alone. 🧪 Notes:
- I’ve tested and confirmed that the function body (
call_fetch_order_info) works independently. - I’m using a Cloudflare Worker as a proxy to fetch data from Airtable.
- The real issue seems to be the Code Engine not allowing
Meow_MWAI_Query_Function::fromJson()or filters likemwai_functions_list.
❓What I Need:
- Is Function Calling supposed to work inside Code Engine PHP snippets, or must it be registered from theme/plugin only?
- Can you please confirm if there’s another way to declare functions for Function Calling entirely within the UI (like Snippet Vault)?
- If not, can we at least get a toggle to allow
fromJson()inside Code Engine?
Thank you so much — I’d love to integrate this properly without relying on external plugins if possible.
The topic ‘[Function Calling Not Working] mwai_functions_list + Meow_MWAI_Query_Function::f’ is closed to new replies.