UNPKG

@n8n/n8n-nodes-langchain

Version:
38 lines 1.37 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getTools = getTools; const utils_1 = require("../shared/utils"); async function getTools(filter, paginationToken) { const authentication = this.getNodeParameter('authentication'); const serverTransport = this.getNodeParameter('serverTransport'); const endpointUrl = this.getNodeParameter('endpointUrl'); const node = this.getNode(); const client = await (0, utils_1.connectMcpClientForCredential)(this, { authentication, serverTransport, endpointUrl, surface: 'MCP Client', }); if (!client.ok) { throw (0, utils_1.mapToNodeOperationError)(node, client.error); } try { const result = await client.result.listTools({ cursor: paginationToken }); const tools = filter ? result.tools.filter((tool) => tool.name.toLowerCase().includes(filter.toLowerCase())) : result.tools; return { results: tools.map((tool) => ({ name: tool.name, value: tool.name, description: tool.description, inputSchema: tool.inputSchema, })), paginationToken: result.nextCursor, }; } finally { await client.result.close(); } } //# sourceMappingURL=listSearch.js.map