{"record":{"id":"f49a7c63cf6003e0","repo":"n8n-io/n8n","slug":"tool-tool-returned-an-error","errorCode":null,"errorMessage":"Tool \"${tool}\" returned an error","messagePattern":"Tool \"(.+?)\" returned an error","errorType":"exception","errorClass":"NodeOperationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/mcp/McpClient/McpClient.node.ts","lineNumber":271,"sourceCode":"\n\t\t\t\t\tconst result = (await client.result.callTool(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: tool,\n\t\t\t\t\t\t\targuments: parameters,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttimeout: options.timeout ? Number(options.timeout) : undefined,\n\t\t\t\t\t\t},\n\t\t\t\t\t)) as CallToolResult;\n\n\t\t\t\t\tif (node.typeVersion >= 1.1 && result.isError) {\n\t\t\t\t\t\tconst textContent = result.content.find((item) => item.type === 'text');\n\t\t\t\t\t\tconst errorMessage =\n\t\t\t\t\t\t\ttextContent && 'text' in textContent\n\t\t\t\t\t\t\t\t? textContent.text\n\t\t\t\t\t\t\t\t: `Tool \"${tool}\" returned an error`;\n\t\t\t\t\t\tthrow new NodeOperationError(node, errorMessage, { itemIndex });\n\t\t\t\t\t}\n\n\t\t\t\t\tlet binaryIndex = 0;\n\t\t\t\t\tconst binary: IBinaryKeyData = {};\n\t\t\t\t\tconst content: IDataObject[] = [];\n\t\t\t\t\tconst convertToBinary = options.convertToBinary ?? true;\n\t\t\t\t\tfor (const contentItem of result.content) {\n\t\t\t\t\t\tif (contentItem.type === 'text') {\n\t\t\t\t\t\t\tcontent.push({\n\t\t\t\t\t\t\t\t...contentItem,\n\t\t\t\t\t\t\t\ttext: jsonParse(contentItem.text, { fallbackValue: contentItem.text }),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (convertToBinary && (contentItem.type === 'image' || contentItem.type === 'audio')) {\n\t\t\t\t\t\t\tbinary[`data_${binaryIndex}`] = await this.helpers.prepareBinaryData(\n\t\t\t\t\t\t\t\tBuffer.from(contentItem.data, 'base64'),","sourceCodeStart":253,"sourceCodeEnd":289,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/mcp/McpClient/McpClient.node.ts#L253-L289","documentation":"Error \"Tool \"${tool}\" returned an error\" thrown in n8n-io/n8n.","triggerScenarios":"Thrown at packages/@n8n/nodes-langchain/nodes/mcp/McpClient/McpClient.node.ts:271 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}