-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-tools.mjs
More file actions
67 lines (60 loc) · 1.61 KB
/
test-tools.mjs
File metadata and controls
67 lines (60 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env node
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
const transport = new StdioClientTransport({
command: 'node',
args: ['dist/index.js']
});
const client = new Client({
name: 'test-client',
version: '1.0.0'
}, {
capabilities: {}
});
await client.connect(transport);
console.log('\n=== Testing build_workflow ===');
try {
const result1 = await client.callTool({
name: 'build_workflow',
arguments: {
description: 'Send email when webhook receives data',
name: 'Test Workflow',
pattern: 'linear'
}
});
console.log('✅ build_workflow:', result1.content[0].text.substring(0, 200));
} catch (e) {
console.log('❌ build_workflow error:', e.message);
}
console.log('\n=== Testing add_node ===');
try {
const result2 = await client.callTool({
name: 'add_node',
arguments: {
workflow: {
name: 'Test',
nodes: [],
connections: {}
},
nodeType: 'n8n-nodes-base.webhook',
parameters: { httpMethod: 'POST', path: 'test' }
}
});
console.log('✅ add_node:', result2.content[0].text.substring(0, 200));
} catch (e) {
console.log('❌ add_node error:', e.message);
}
console.log('\n=== Testing search_nodes ===');
try {
const result3 = await client.callTool({
name: 'search_nodes',
arguments: {
query: 'slack'
}
});
console.log('✅ search_nodes:', result3.content[0].text.substring(0, 200));
} catch (e) {
console.log('❌ search_nodes error:', e.message);
}
await client.close();
process.exit(0);