HTTP Request JSON variable $fromAI

Hi,

I am using community installation 1.109.2.
I have a workflow with an AI agent and a tool http request, where I have JSON in Send body. I need the AI agent to ask for one variable and add it to Send body.
I used $fromAI(value) instead of the value. The agent asks correctly. However, the input is the entire object: [{“value”: “AA:AA:AA:AA:AA:AA”}] and because of this, the API ends with an error. I tried to extract only the MAC address "AA:AA:AA:AA:AA:AA, but unfortunately, I am unable to do so.

Can you please advise me on how to solve this?

{
“nodes”: [
{
“parameters”: {
“toolDescription”: “ADD new MAC address to XIQ-SE”,
“method”: “POST”,
“url”: “https://10.1.1.5:8443/nbi/graphql”,
“authentication”: “genericCredentialType”,
“genericAuthType”: “httpBearerAuth”,
“sendBody”: true,
“specifyBody”: “json”,
“jsonBody”: “{\n “query”: “mutation { accessControl { addMACToEndSystemGroup(input: { group: \“MIGO devices\”, value: \”$fromAI(value)\“, description: \“APITEST1\” }) { status name } } }”\n}”,
“options”: {
“allowUnauthorizedCerts”: true
}
},
“type”: “n8n-nodes-base.httpRequestTool”,
“typeVersion”: 4.2,
“position”: [
512,
256
],
“id”: “c2d770b8-505f-4e6f-a758-f144e96956c0”,
“name”: “XIQ-SE ADD MAC”,
“credentials”: {
“httpBearerAuth”: {
“id”: “ns4GOrDV0Y0SbzI1”,
“name”: “XIQ-SE”
}
}
}
],
“connections”: {
“XIQ-SE ADD MAC”: {
“ai_tool”: [

]
}
},
“pinData”: {},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “3cc6c4256e2bbdec1b3708c49dc3889c7266357f3e239651c157c2de760e6c65”
}
}

Thank you for your help

MIGO

$fromAI() construct should be used inside an expression.

{{ $fromAI("mac-address", "string") }}

Don’t forget to make the field to be of expression type too.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.