Integrate Function Calling into Your Mendix App
Introduction
This document explains how to use function calling in your smart app. To do this, you can use your existing app or or follow the Build a Smart App from a Blank GenAI App guide to start from scratch, as demonstrated in the sections below.
Through this document, you will:
- Understand how to implement function calling within your Mendix application.
- Learn to integrate GenAI capabilities to address specific business requirements effectively.
Prerequisites
Before integrating function calling into your app, make sure you meet the following requirements:
-
An existing app: To simplify your first use case, start building from a preconfigured set up Blank GenAI Starter App. For more information, see Build a Chatbot from Scratch Using the Blank GenAI App.
-
Installation: Install the GenAI For Mendix bundle from the Mendix marketplace. If you start with the Blank GenAI App, skip this installation.
-
Intermediate knowledge of the Mendix platform: Familiarity with Mendix Studio Pro, microflows, and modules.
-
Basic understanding of GenAI concepts: Review the Enrich Your Mendix App with GenAI Capabilities page for foundational knowledge and familiarize yourself with the concepts.
-
Understanding Function Calling and Prompt Engineering: Learn about Function Calling and Prompt Engineering to use them within the Mendix ecosystem.
Function Calling Use Case

In this example, two functions will be implemented with the following purposes:
- Retrieving the display name of the user when an email is requested in a chatbot, allows the information to be automatically filled for the end user.
- Extracting bank holidays in the Netherlands using an API. For this example, a public API from Open Holidays API is used.
Choosing the Infrastructure
Selecting the infrastructure for integrating GenAI into your Mendix application is the first step. Depending on your use case and preferences, you can choose from the following options:
-
Mendix Cloud GenAI Resource Packs: The Mendix Cloud GenAI Connector is part of the GenAI For Mendix bundle on the marketplace, allowing you to utilize Mendix Cloud GenAI Resource Packs directly within your Mendix application.
-
OpenAI: The OpenAI Connector supports both OpenAI’s platform and Azure’s OpenAI service.
-
Amazon Bedrock: The Amazon Bedrock Connector allows you to leverage Amazon Bedrock’s fully managed service to integrate foundation models from Amazon and leading AI providers.
-
Your Own Connector: Optionally, if you prefer a custom connector, you can integrate your chosen infrastructure. However, this document focuses on the Mendix Cloud GenAI, OpenAI, and Amazon Bedrock connectors, as they offer comprehensive support and ease of use to get started.
Customizing Microflows
To make the functions work, create and adjust certain microflows as shown below. These microflows will handle the logic required for gathering the display name of the user and extracting the bank holidays from the Netherlands in 2025 using an API.
-
Locate the pre-built microflow
ChatContext_ChatWithHistory_ActionMicroflow
in the ConversationalUI > USE_ME > Conversational UI > Action microflow examples folder and copy it into yourMyFirstBot
module. -
Locate the
New Chat
action in theACT_FullScreenChat_Open
microflow. Inside this action, change theAction microflow
input parameter to your newMyFirstBot.ChatContext_ChatWithHistory_ActionMicroflow
from yourMyFirstBot
module.
To call a function, create a microflow per function to extract the necessary information.
Function: Extracting the User Name

Create a new microflow with the name GetCurrentUserName_Function
.
-
Start with the
Retrieve
action, where you can use the following modifications as an example:- Source:
From database
- Entity:
Administration.Account
- Range:
First
- XPath constraint:
[id = $currentUser]
- Object name:
Account
- Source:
-
Include a decision where:
- Caption: for example,
Found?
- Decision Type:
Expression
- Expression:
$Account != empty
-
If the decision is
false
, an end event of typeString
is added where the return value can be set toMendix Administrator Chat User
. -
If the decision is
true
, an end event of typeString
is added where the return value is$Account/FullName
.
- Caption: for example,
Function: Getting Bank Holidays in the Netherlands 2025

For this example, call the new microflow GetBankHolidays_Function
.
-
Start with the
Call REST service
action, where you can use the following modifications as an example:General tab:
- Location:
https://openholidaysapi.org/PublicHolidays?countryIsoCode=NL&validFrom=2025-01-01&validTo=2025-12-31&languageIsoCode=EN
- HTTP method:
GET
- Use timeout on request:
Yes
- Timeout (s): You can choose the value, here we set it to
300
- The rest can be set to default.
Response tab:
- Response handling:
Store in a string
- Store in variable:
Yes
- Variable name:
HolidayJSON
- Location:
-
Right-click on the
Call REST
action and selectSet $HolidayJSON
as the return value.
Calling the Functions
Now, the following steps will focus exclusively on the ChatContext_ChatWithHistory_ActionMicroflow
from your MyFirstBot
module.

As shown in the image, two key steps must be completed to enable the execution of both functions.
Adding Functions to the Request
-
After the outgoing
Request found
equalstrue
decision, add theTools: Add Function to Request
toolbox action for the first function with the following settings:- Request:
$Request
- Tool name:
get-current-user-name
- Tool description:
This function has no input, and returns a string containing the name of the user using the chat. It can be used to generate texts on behalf of the user, for example, the signature of an email, "Best regards, [user's name]".
- Function microflow: select the
GetCurrentUserName_Function
microflow created in the previous step. - Use return value: No
- Request:
-
Following this action, continue with the second function by adding the
Tools: Add Function to Request
action with the following settings:- Request:
$Request
- Tool name:
get-bank-holidays-2025
- Tool description:
This function has no input, and returns a JSON containing the bank holidays in the Netherlands for the year 2025.
- Function microflow: select the
GetBankHolidays_Function
microflow created in the previous step. - Use return value: No
- Request:
Optional: Changing the System Prompt
Optionally, you can change the system prompt to provide the model additional instructions, for example, the tone of voice. Therefore, follow a similar approach described in the Build a Chatbot from Scratch Using the Blank GenAI App.
- Open the copied
ACT_FullScreenChat_Open
microflow from yourMyFirstBot
module. - Locate the New Chat action.
- Inside this action, find the
System prompt
parameter, which has by default an empty value. - Update the
System prompt
value to reflect your desired behavior. For example,Answer like a Gen Z person. Always keep your answers short.
- Save the changes.
Testing and Troubleshooting
Before testing, ensure that you have completed the Mendix Cloud GenAI, OpenAI, or Bedrock configuration as described in the Build a Chatbot from Scratch Using the Blank GenAI App, particularly the Infrastructure Configuration section.
To test the Chatbot, go to the Home icon to open the chatbot interface. Start interacting with your chatbot by typing in the chat box.
For example, type—Write a message to my colleague Max asking about a meeting to discuss the content for our next GenAI how-to.
or How many bank holidays do I have in December?
Congratulations! Your chatbot is now ready to use.
If an error occurs, check the Console in Studio Pro for detailed information to assist in resolving the issue.