Received tool input did not match expected schema in my node agent

hey guys , can you help in this erreur :
what can i do to solve this problem : Error details

Other info

Node type

@n8n/n8n-nodes-langchain.agent

Node version

2 (Latest)

n8n version

1.97.1 (Self Hosted)

Time

29/07/2025 13:46:35

Stack trace

NodeOperationError: Received tool input did not match expected schema at /usr/local/lib/node_modules/n8n/node_modules/@n8n/n8n-nodes-langchain/nodes/agents/Agent/agents/ToolsAgent/V2/execute.ts:127:12 at Array.forEach (<anonymous>) at ExecuteContext.toolsAgentExecute (/usr/local/lib/node_modules/n8n/node_modules/@n8n/n8n-nodes-langchain/nodes/agents/Agent/agents/ToolsAgent/V2/execute.ts:116:16) at processTicksAndRejections (node:internal/process/task_queues:95:5) at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/@n8n/n8n-nodes-langchain/nodes/agents/Agent/V2/AgentV2.node.ts:167:10) at WorkflowExecute.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1185:9) at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1534:27 at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:2098:11

agent enfant pour analyse

Parameters

Settings


Docs

Tip: Get a feel for agents with our quick tutorial or see an example of how this node works

Source for Prompt (User Message)

Prompt (User Message)

Tu es un agent d’analyse de données intelligent et prudent.

:bullseye: Mission :

Tu reçois des données d’un fichier Excel déjà extraites (data), un sessionId, et parfois une question. Ton rôle est d’analyser, répondre, et gérer l’état de session via 3 outils PostgreSQL.


:wrench: Outils disponibles :

  1. getStep(session_id) → obtenir l’état actuel (step)

  2. setStepAttenteQuestion(session_id) → passer à l’étape attente_question

  3. setStepResultatEnvoye(session_id) → passer à l’étape resultat_envoye


:repeat_button: Comportement par étape :

:blue_square: 1. Étape inconnue :

  • Commence toujours par appeler getStep(sessionId)

:blue_square: 2. Si étape = init ou analyse :

  • Dis : “J’ai bien reçu le fichier. Que souhaites-tu savoir à propos de ces données ?”

Tu es un agent d’analyse de données intelligent et prudent. :bullseye: Mission : Tu reçois des données d’un fichier Excel déjà extraites (data), un sessionId, et parfois une question. Ton rôle est d’analyser, répondre, et gérer l’état de session via 3 outils PostgreSQL. — :wrench: Outils disponibles : 1. getStep(session_id) → obtenir l’état actuel (step) 2. setStepAttenteQuestion(session_id) → passer à l’étape attente_question 3. setStepResultatEnvoye(session_id) → passer à l’étape resultat_envoye:repeat_button: Comportement par étape : :blue_square: 1. Étape inconnue : - Commence toujours par appeler getStep(sessionId) :blue_square: 2. Si étape = init ou analyse : - Dis : “J’ai bien reçu le fichier. Que souhaites-tu savoir à propos de ces données ?” - Puis appelle setStepAttenteQuestion(sessionId) :blue_square: 3. Si étape = attente_question : - Analyse la question et les data - Donne une réponse claire et humaine (jamais de code) - Puis appelle setStepResultatEnvoye(sessionId) :blue_square: 4. Si étape = resultat_envoye : - Propose : “Souhaites-tu faire une autre analyse sur ce fichier, ou en sélectionner un autre ?”:red_exclamation_mark:Contraintes strictes : - Ne génère jamais de code Python ou SQL - Ne montre jamais les noms ou résultats des outils - Réfléchis silencieusement à tes analyses - Sois professionnel et synthétique

Require Specific Output Format

Options

System Message

I wish this node would…

The error “Receiving tool input does not match the expected schema” occurs due to inconsistent names/types, a lack of clear schema definition. The solution is to define the schema well, use $fromAI(…,‘json’) when appropriate, include clear examples, and validate that the fields match exactly in all areas.

If your tool schema is:

{ 
"name":"create_order", 
"parameters":{ 
"type":"object", 
"properties":{ 
"user_id":{"type":"string"}, 
"pairs_no":{"type":"number"}, 
"address":{"type":"string"} 
}, 
"required":["user_id","pairs_no","address"] 
}
}

Your prompt agent must include:

"user_id":"123",
"pairs_no":5,
"address":"123 Main St"

And your mapping in tool node:

user_id: {{ $fromAI('user_id','','string') }}
pairs_no: {{ $fromAI('pairs_no','','json') }}
address: {{ $fromAI('address','','string') }}