UNPKG

@n8n/n8n-nodes-langchain

Version:
39 lines 1.42 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getToolParameters = getToolParameters; const n8n_workflow_1 = require("n8n-workflow"); const utils_1 = require("./utils"); const utils_2 = require("../shared/utils"); async function getToolParameters() { const toolId = this.getNodeParameter('tool', 0, { extractValue: true, }); const authentication = this.getNodeParameter('authentication'); const serverTransport = this.getNodeParameter('serverTransport'); const endpointUrl = this.getNodeParameter('endpointUrl'); const node = this.getNode(); const client = await (0, utils_2.connectMcpClientForCredential)(this, { authentication, serverTransport, endpointUrl, surface: 'MCP Client', }); if (!client.ok) { throw (0, utils_2.mapToNodeOperationError)(node, client.error); } try { const result = await (0, utils_2.getAllTools)(client.result); const tool = result.find((tool) => tool.name === toolId); if (!tool) { throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Tool not found'); } const fields = (0, utils_1.convertJsonSchemaToResourceMapperFields)(tool.inputSchema); return { fields, }; } finally { await client.result.close(); } } //# sourceMappingURL=resourceMapping.js.map