@velaro/mcp-server 2.0.21 → 2.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/parity/part-finder.customer.js +109 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@velaro/mcp-server",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.22",
|
|
4
4
|
"description": "Velaro MCP server — connect Claude and other AI agents directly to your Velaro account: KB, workflows, bots, conversations, contacts, routing, and more.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// velaro part-finder: the per-site Part Finder (one ordered lookup). Site scope comes from the credential only, never from arguments.
|
|
2
|
+
// Parity module (CLI group `part-finder` -> MCP tools). Needs the Part Finder package (EnablePartFinder).
|
|
3
|
+
|
|
4
|
+
const need = (a, ...ks) => { for (const k of ks) if (a[k] === undefined || a[k] === null || a[k] === '') throw new Error(k + ' is required'); };
|
|
5
|
+
const pid = (v, n = 'id') => { const x = Number(v); if (!Number.isInteger(x) || x <= 0) throw new Error(n + ' must be a positive integer'); return x; };
|
|
6
|
+
|
|
7
|
+
export const tools = [
|
|
8
|
+
{
|
|
9
|
+
name: 'part_finder_find',
|
|
10
|
+
description: 'Run the Part Finder lookup the bot uses for a part number, competitor model or description: approved matrix, connected business system, own catalog, then labelled possible matches. Returns status (confirmed, candidates, no_result), source, recommendations, candidates, handoff and the per-step trace. Calls POST /PartFinder/Find.',
|
|
11
|
+
inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'The part number, model or description as the customer wrote it' } }, required: ['query'] },
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: 'part_finder_config',
|
|
15
|
+
description: 'Read the Part Finder settings, or change them when any field is given: enabled, steps (ordered list of {id: matrix|erp|catalog_exact|spec_search, enabled, timeoutMs}), minConfidence (0 to 1), noResultAction (handoff|categories|handoff_and_categories|capture_lead). Matrix and catalog_exact cannot both be off. Calls GET or PUT /PartFinder/Config.',
|
|
16
|
+
inputSchema: {
|
|
17
|
+
type: 'object',
|
|
18
|
+
properties: {
|
|
19
|
+
enabled: { type: 'boolean' },
|
|
20
|
+
steps: { type: 'array', items: { type: 'object', properties: { id: { type: 'string' }, enabled: { type: 'boolean' }, timeoutMs: { type: 'number' } }, required: ['id'] } },
|
|
21
|
+
minConfidence: { type: 'number' },
|
|
22
|
+
noResultAction: { type: 'string' },
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'part_finder_sources',
|
|
28
|
+
description: 'List the matrix sources (SharePoint, OneDrive, upload) with load mode and last sync status. Calls GET /PartFinder/Sources.',
|
|
29
|
+
inputSchema: { type: 'object', properties: {} },
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'part_finder_source_add',
|
|
33
|
+
description: 'Add a matrix source. type is sharepoint or onedrive, fileName is the file name or link, loadMode is preload (default) or live. New rows are not approved unless the file says so. Calls POST /PartFinder/Sources.',
|
|
34
|
+
inputSchema: { type: 'object', properties: { type: { type: 'string' }, fileName: { type: 'string' }, loadMode: { type: 'string' } }, required: ['type', 'fileName'] },
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'part_finder_source_preview',
|
|
38
|
+
description: 'Preview what a sync would change (added, changed, removed rows) without applying anything. Calls GET /PartFinder/Sources/{id}/Preview.',
|
|
39
|
+
inputSchema: { type: 'object', properties: { id: { type: 'number' } }, required: ['id'] },
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'part_finder_source_sync',
|
|
43
|
+
description: 'Sync one matrix source now. Unchanged files are not downloaded. Removed rows are switched to not approved, never deleted. Calls POST /PartFinder/Sources/{id}/SyncNow.',
|
|
44
|
+
inputSchema: { type: 'object', properties: { id: { type: 'number' } }, required: ['id'] },
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'part_finder_source_remove',
|
|
48
|
+
description: 'Remove one matrix source. Rows it already loaded stay in the matrix until removed there. Calls DELETE /PartFinder/Sources/{id}.',
|
|
49
|
+
inputSchema: { type: 'object', properties: { id: { type: 'number' } }, required: ['id'] },
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'part_finder_misses',
|
|
53
|
+
description: 'List what customers asked that found nothing (normalized text, count, last time), or dismiss one when dismissId is given. Calls GET /PartFinder/Misses or POST /PartFinder/Misses/{id}/Dismiss.',
|
|
54
|
+
inputSchema: { type: 'object', properties: { dismissId: { type: 'number' } } },
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'part_finder_suggestions',
|
|
58
|
+
description: 'List the AI-suggested matrix rows waiting for a person (never recommended until approved). Calls GET /PartFinder/Suggestions.',
|
|
59
|
+
inputSchema: { type: 'object', properties: {} },
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'part_finder_suggestions_generate',
|
|
63
|
+
description: 'Create suggestions for the top missed questions from catalog text. Suggestions start not approved. Capped per month by plan. Calls POST /PartFinder/Suggestions/Generate.',
|
|
64
|
+
inputSchema: { type: 'object', properties: {} },
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: 'part_finder_suggestion_decide',
|
|
68
|
+
description: 'Approve or reject one suggestion (approved defaults to true). Only approved rows are ever recommended. Calls POST /PartFinder/Suggestions/{id}/Approve or /Reject.',
|
|
69
|
+
inputSchema: { type: 'object', properties: { id: { type: 'number' }, approved: { type: 'boolean' } }, required: ['id'] },
|
|
70
|
+
},
|
|
71
|
+
];
|
|
72
|
+
|
|
73
|
+
export const handlers = {
|
|
74
|
+
part_finder_find: async (a, ctx) => {
|
|
75
|
+
need(a, 'query');
|
|
76
|
+
return ctx.messagingPost('/PartFinder/Find', { query: String(a.query) });
|
|
77
|
+
},
|
|
78
|
+
part_finder_config: async (a, ctx) => {
|
|
79
|
+
const patch = {};
|
|
80
|
+
if (typeof a.enabled === 'boolean') patch.enabled = a.enabled;
|
|
81
|
+
if (Array.isArray(a.steps)) patch.steps = a.steps.map((s) => ({ id: String(s.id), enabled: s.enabled !== false, timeoutMs: Number(s.timeoutMs ?? 1000) }));
|
|
82
|
+
if (a.minConfidence !== undefined) {
|
|
83
|
+
const v = Number(a.minConfidence);
|
|
84
|
+
if (!Number.isFinite(v) || v < 0 || v > 1) throw new Error('minConfidence must be between 0 and 1');
|
|
85
|
+
patch.minConfidence = v;
|
|
86
|
+
}
|
|
87
|
+
if (a.noResultAction !== undefined) patch.noResultAction = String(a.noResultAction);
|
|
88
|
+
if (Object.keys(patch).length === 0) return ctx.messagingGet('/PartFinder/Config');
|
|
89
|
+
return ctx.messagingPut('/PartFinder/Config', patch);
|
|
90
|
+
},
|
|
91
|
+
part_finder_sources: async (_a, ctx) => ctx.messagingGet('/PartFinder/Sources'),
|
|
92
|
+
part_finder_source_add: async (a, ctx) => {
|
|
93
|
+
need(a, 'type', 'fileName');
|
|
94
|
+
return ctx.messagingPost('/PartFinder/Sources', { type: String(a.type), fileName: String(a.fileName), loadMode: a.loadMode ? String(a.loadMode) : 'preload', enabled: true });
|
|
95
|
+
},
|
|
96
|
+
part_finder_source_preview: async (a, ctx) => ctx.messagingGet('/PartFinder/Sources/' + pid(a.id) + '/Preview'),
|
|
97
|
+
part_finder_source_sync: async (a, ctx) => ctx.messagingPost('/PartFinder/Sources/' + pid(a.id) + '/SyncNow', {}),
|
|
98
|
+
part_finder_source_remove: async (a, ctx) => ctx.messagingDel('/PartFinder/Sources/' + pid(a.id)),
|
|
99
|
+
part_finder_misses: async (a, ctx) => {
|
|
100
|
+
if (a.dismissId !== undefined) return ctx.messagingPost('/PartFinder/Misses/' + pid(a.dismissId, 'dismissId') + '/Dismiss', {});
|
|
101
|
+
return ctx.messagingGet('/PartFinder/Misses');
|
|
102
|
+
},
|
|
103
|
+
part_finder_suggestions: async (_a, ctx) => ctx.messagingGet('/PartFinder/Suggestions'),
|
|
104
|
+
part_finder_suggestions_generate: async (_a, ctx) => ctx.messagingPost('/PartFinder/Suggestions/Generate', {}),
|
|
105
|
+
part_finder_suggestion_decide: async (a, ctx) => {
|
|
106
|
+
const verb = a.approved === false ? 'Reject' : 'Approve';
|
|
107
|
+
return ctx.messagingPost('/PartFinder/Suggestions/' + pid(a.id) + '/' + verb, {});
|
|
108
|
+
},
|
|
109
|
+
};
|