https://retellai.com/?utm_source=discord&utm_medium=seo logo
Are response variables working after calling an MC...
# ❓・ai-evy-support
m
@AI Evy Are response variables working after calling an MCP in test chat working? Currently I use MCP and it returns a response but the variable is not being saved when I run batch testing
a
Thanks for tagging me @minus.ace. I'll look through relevant sources and get back to you shortly.
### Answer Response variables should work with MCP calls in Retell AI [(1) ]() [(2) ]() [(3) ]() . The documentation shows that you can extract values from MCP tool responses and save them as dynamic variables for use later in the conversation . For example, with a response body like this [(1) ]() [(3) ]() :
Copy code
json
{
 "properties": {
 "user": {
 "name": "John Doe",
 "age": 26
 }
 }
}
[(1) ]() , [(3) ]() You should be able to extract
properties.user.name
as a variable like
user_name
and reference it later using
{{user_name}}
. If response variables aren't being saved during batch testing, this could indicate a configuration issue with how the response variables are mapped or extracted from the MCP response [(1) ]() [(2) ]() . Make sure you've properly configured the response variable extraction in step 5 of your MCP setup [(1) ]() [(3) ]() . I don't have specific troubleshooting information for batch testing scenarios with MCP response variables in the available sources. You might want to check: - [Contact Sales]() - [) Would you like a general answer based on my knowledge instead?
​ To learn more, see the sources I considered: [[1] MCP](https://docs.retellai.com/build/single-multi-prompt/mcp) [[2] MCP Node](https://docs.retellai.com/build/conversation-flow/mcp-node) [[3] Connect any AI Voice Agent to MCP with Retell AI MCP Node (Guide) | Retell AI](https://www.retellai.com/blog/connect-any-ai-voice-agent-to-mcp-with-retell-ai-mcp-node) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
m
@AI Evy I am getting this response from my MCP. How should I store the response variable? tool_call_id: mcp_32afa5 "[{"access_token":"eyJraWQiOiJhdXR
a
Thanks for the follow-up, @minus.ace. I'll get back to you soon.
### Answer Based on your MCP response, you're receiving a JSON array with an
access_token
field [(1) ]() . To store this as a response variable in Retell AI, you'll need to configure the response variable extraction in step 5 of your MCP setup [(1) ]() [(2) ]() . Since your response is a JSON array, you would extract the
access_token
from the first element using this path: - **Variable Path**:
[0].access_token
- **Variable Name**:
access_token
(or whatever name you prefer) In the MCP configuration, when setting response variables, you can extract values from the MCP tool response and save them as dynamic variables for use later in the conversation . For example, you can extract the access token from the response and reference it later using
{{access_token}}
. The response variable extraction allows you to map specific fields from your MCP response into dynamic variables that can be used throughout the rest of the conversation .
​ To learn more, see the sources I considered: [[1] MCP](https://docs.retellai.com/build/single-multi-prompt/mcp) [[2] Connect any AI Voice Agent to MCP with Retell AI MCP Node (Guide) | Retell AI](https://www.retellai.com/blog/connect-any-ai-voice-agent-to-mcp-with-retell-ai-mcp-node) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
m
After I call the MCP can I add a node extract variable after to store the access token @AI Evy
a
Thanks for the follow-up, @minus.ace. I'll get back to you soon.
### Answer The MCP Node itself has built-in response variable extraction functionality, so you don't need a separate Extract Variable node after it [(1) ]() [(2) ]() . The MCP Node allows you to set response variables directly in step 5 of the setup, where you can extract values from the MCP tool response and save them as dynamic variables . For your specific case with the access token response, you would configure the response variable extraction within the MCP Node itself by: 1. Setting the variable path to
[0].access_token
(since your response is a JSON array) 2. Naming the variable something like
access_token
3. This creates a dynamic variable
{{access_token}}
that can be used later in the conversation The Extract Variable node documented in the sources is designed for extracting variables from user responses during conversation, not from MCP tool responses [(3) ]() . The MCP Node's built-in response variable functionality is the appropriate method for capturing data returned from MCP calls [(1) ]() [(2) ]() .
​ To learn more, see the sources I considered: [[1] MCP Node](https://docs.retellai.com/build/conversation-flow/mcp-node) [[2] Connect any AI Voice Agent to MCP with Retell AI MCP Node (Guide) | Retell AI](https://www.retellai.com/blog/connect-any-ai-voice-agent-to-mcp-with-retell-ai-mcp-node) [[3] Extract Dynamic Variables](https://docs.retellai.com/build/single-multi-prompt/extract-dv) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.