n8n
Version:
n8n Workflow Automation Tool
31 lines • 1.59 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildResolveIntegrationTool = buildResolveIntegrationTool;
const tool_1 = require("@n8n/agents/tool");
const zod_1 = require("zod");
const builder_tool_names_1 = require("./builder-tool-names");
const resolveIntegrationInputSchema = zod_1.z.object({
queries: zod_1.z
.array(zod_1.z.string())
.min(1)
.describe('External services to resolve (e.g. ["github"], ["slack"])'),
});
function buildResolveIntegrationTool(deps) {
return new tool_1.Tool(builder_tool_names_1.BUILDER_TOOLS.RESOLVE_INTEGRATION)
.description('Resolve external services to MCP servers or n8n node tools. Searches the MCP registry first and returns kind: "mcp" when a match exists; only searches agent-eligible n8n node tools and returns kind: "node" when no MCP server matches. For either kind, load agent-builder-external-services and follow its matching section, using the returned results.')
.input(resolveIntegrationInputSchema)
.handler(async ({ queries }) => {
const mcpResults = await deps.mcpRegistryService.search(queries);
if (mcpResults.length > 0) {
return { kind: 'mcp', results: mcpResults };
}
const nodeResults = await deps.agentsToolsService.searchAgentToolNodes(queries);
return {
kind: 'node',
results: nodeResults.results,
queriesWithNoResults: nodeResults.queriesWithNoResults,
};
})
.build();
}
//# sourceMappingURL=resolve-integration.tool.js.map