UNPKG

@n8n/n8n-nodes-langchain

Version:

![Banner image](https://user-images.githubusercontent.com/10284570/173569848-c624317f-42b1-45a6-ab09-f0ea3c247648.png)

61 lines 2.44 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var resourceMapping_exports = {}; __export(resourceMapping_exports, { getToolParameters: () => getToolParameters }); module.exports = __toCommonJS(resourceMapping_exports); var import_n8n_workflow = require("n8n-workflow"); var import_utils = require("./utils"); var import_utils2 = 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 { headers } = await (0, import_utils2.getAuthHeaders)(this, authentication); const client = await (0, import_utils2.connectMcpClient)({ serverTransport, endpointUrl, headers, name: node.type, version: node.typeVersion, onUnauthorized: async (headers2) => await (0, import_utils2.tryRefreshOAuth2Token)(this, authentication, headers2) }); if (!client.ok) { throw (0, import_utils2.mapToNodeOperationError)(node, client.error); } const result = await (0, import_utils2.getAllTools)(client.result); const tool = result.find((tool2) => tool2.name === toolId); if (!tool) { throw new import_n8n_workflow.NodeOperationError(this.getNode(), "Tool not found"); } const fields = (0, import_utils.convertJsonSchemaToResourceMapperFields)(tool.inputSchema); return { fields }; } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { getToolParameters }); //# sourceMappingURL=resourceMapping.js.map