Files
alighasami 3d5eaf9445
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
first commit
2026-03-17 16:22:57 +03:30

82 lines
2.0 KiB
TypeScript

import { WolframAlphaTool } from '@langchain/community/tools/wolframalpha';
import {
NodeConnectionTypes,
type IExecuteFunctions,
type INodeExecutionData,
type INodeType,
type INodeTypeDescription,
type ISupplyDataFunctions,
type SupplyData,
} from 'n8n-workflow';
import { logWrapper, getConnectionHintNoticeField } from '@n8n/ai-utilities';
export class ToolWolframAlpha implements INodeType {
description: INodeTypeDescription = {
displayName: 'Wolfram|Alpha',
name: 'toolWolframAlpha',
icon: 'file:wolfram-alpha.svg',
group: ['transform'],
version: 1,
description: "Connects to WolframAlpha's computational intelligence engine.",
defaults: {
name: 'Wolfram Alpha',
},
credentials: [
{
name: 'wolframAlphaApi',
required: true,
},
],
codex: {
categories: ['AI'],
subcategories: {
AI: ['Tools'],
Tools: ['Other Tools'],
},
resources: {
primaryDocumentation: [
{
url: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolwolframalpha/',
},
],
},
},
inputs: [],
outputs: [NodeConnectionTypes.AiTool],
outputNames: ['Tool'],
properties: [getConnectionHintNoticeField([NodeConnectionTypes.AiAgent])],
};
async supplyData(this: ISupplyDataFunctions): Promise<SupplyData> {
const credentials = await this.getCredentials('wolframAlphaApi');
return {
response: logWrapper(new WolframAlphaTool({ appid: credentials.appId as string }), this),
};
}
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
const credentials = await this.getCredentials('wolframAlphaApi');
const input = this.getInputData();
const result: INodeExecutionData[] = [];
for (let i = 0; i < input.length; i++) {
const item = input[i];
const tool = new WolframAlphaTool({ appid: credentials.appId as string });
result.push({
json: {
response: await tool.invoke(item.json),
},
pairedItem: {
item: i,
},
});
}
return [result];
}
}