https://retellai.com/?utm_source=discord&utm_medium=seo logo
how can I send variables to MCP tools in post body
# ❓・ai-evy-support
p
@AI Evy how can I send variables to MCP tools in post body?
a
Thanks for tagging me @Paco. I'll look through relevant sources and get back to you shortly.
### Answer To send variables to MCP tools, you can use dynamic variables in combination with the MCP node configuration. Here's how: ## Setting Up MCP with Variables When configuring an MCP node in Conversation Flow or Single/Multi-Prompt agents: 1. *Set request headers (optional) * — Define custom headers to include with the request Retell sends to your MCP Server. [(1) ]() 2. *Set query parameters (optional) * — Define query parameters to include in the request URL that Retell appends to your MCP Server Endpoint. 3. Use dynamic variables — You can inject dynamic variables using the
{{variable_name}}
syntax in tool configurations, including tool descriptions and property descriptions. [(2) ]() ## Extracting Response Variables After the MCP tool executes, you can extract values from the response and save them as dynamic variables for later use: Example response body:
Copy code
json
{
  "properties": {
    "user": {
      "name": "John Doe",
      "age": 26
    }
  }
}
[(1) ]() You can extract values like
user.name
and reference them later using
{{user_name}}
. ## Important Note There's a known issue where MCP tools may return stringified JSON responses, which can cause variable extraction problems. A regular custom function returns like
{"customer_id":"6229"}
, whereas MCP may return
"{\"customer_id\": 12345}"
(stringified) . [(3) ]() If you're having trouble with variables not being extracted from MCP responses, this formatting difference could be the cause.
​ To learn more, see the sources I considered: [[1] MCP](https://docs.retellai.com/build/single-multi-prompt/mcp) [[2] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) [[3] mcp tool variables not extracted](https://discord.com/channels/1186424376300679209/1426340769924382791) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.