@velaro/mcp-server 2.0.108 → 2.0.110

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velaro/mcp-server",
3
- "version": "2.0.108",
3
+ "version": "2.0.110",
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,68 @@
1
+ // MCP parity for `velaro crm calc-values` and `velaro crm calc-deps` (cli/lib/commands/crm-calculated-fields.js).
2
+ // The dry run `crm_formula_test` lives in crm-studio.customer.js (CLI: `velaro crm formula-test`, alias `calc-test`).
3
+ // Backend: velaro-messaging CrmCustomFieldsController (docs/architecture/crm-studio-program.md, feature 6).
4
+ // Site from the credential, never an argument. Calculated values are computed on read and never stored.
5
+
6
+ const data = (r) => (r && typeof r === 'object' && 'data' in r ? r.data : r);
7
+
8
+ const ENTITY = {
9
+ type: 'string',
10
+ pattern: '^(deal|contact|company|ticket|obj:[0-9]+)$',
11
+ description: 'deal, contact, company, ticket, or obj:<typeId> for a custom object type.',
12
+ };
13
+
14
+ export const tools = [
15
+ {
16
+ name: 'crm_calculated_values',
17
+ description: 'Get the calculated field values (formulas and rollups) for up to 100 records of one type, as the caller sees them: fields the caller\'s role cannot read are left out. Values are worked out when asked for and never stored, so they are never stale. Part of the CRM Studio package (see your plan). Each item maps a field id to its value, or null when there is no value.',
18
+ inputSchema: {
19
+ type: 'object',
20
+ properties: {
21
+ entity: ENTITY,
22
+ recordIds: { type: 'array', items: { type: 'number' }, minItems: 1, maxItems: 100, description: 'Record ids of that type.' },
23
+ },
24
+ required: ['entity', 'recordIds'],
25
+ },
26
+ },
27
+ {
28
+ name: 'crm_calculated_deps',
29
+ description: 'Show how the calculated fields of one record type depend on each other: for each field the fields it reads, the order they are worked out in, and any cycles (two fields reading each other). Administrator only. Part of the CRM Studio package (see your plan).',
30
+ inputSchema: { type: 'object', properties: { entity: ENTITY }, required: ['entity'] },
31
+ },
32
+ {
33
+ name: 'crm_calculated_filter',
34
+ description: 'Find records of one type by their calculated values (formulas and rollups), with the same operators saved views use: eq, neq, contains, gt, gte, lt, lte, in, empty, notEmpty. Returns recordIds, how many were scanned, whether the scan was capped, and a message. Values are computed on read, so the answer is never stale. Part of the CRM Studio package (see your plan).',
35
+ inputSchema: {
36
+ type: 'object',
37
+ properties: {
38
+ entity: ENTITY,
39
+ filters: {
40
+ type: 'array',
41
+ minItems: 1,
42
+ items: {
43
+ type: 'object',
44
+ properties: {
45
+ field: { type: 'string', description: 'The calculated field as cf:<fieldId>.' },
46
+ op: { type: 'string', enum: ['eq', 'neq', 'contains', 'gt', 'gte', 'lt', 'lte', 'in', 'empty', 'notEmpty'] },
47
+ value: { description: 'Not needed for empty and notEmpty; a list for in.' },
48
+ },
49
+ required: ['field', 'op'],
50
+ },
51
+ },
52
+ limit: { type: 'number', description: 'Most record ids to return.' },
53
+ },
54
+ required: ['entity', 'filters'],
55
+ },
56
+ },
57
+ {
58
+ name: 'crm_calculated_sources',
59
+ description: 'List the custom object record types a rollup on this record type can read, with their fields (source obj12, fields name and cf45), for building expressions such as SUM(obj12.cf45) or COUNT(obj12). Administrator only. Part of the CRM Studio package (see your plan).',
60
+ inputSchema: { type: 'object', properties: { entity: ENTITY }, required: ['entity'] },
61
+ },
62
+ ];
63
+
64
+ export const handlers = {
65
+ crm_calculated_values: async (a, ctx) => data(await ctx.messagingPost('/CrmCustomFields/calculated/values', { entity: a.entity, recordIds: a.recordIds })),
66
+ crm_calculated_deps: async (a, ctx) => data(await ctx.messagingGet(`/CrmCustomFields/calculated/deps?entity=${encodeURIComponent(a.entity)}`)),
67
+ crm_calculated_sources: async (a, ctx) => data(await ctx.messagingGet(`/CrmCustomFields/calculated/sources?entity=${encodeURIComponent(a.entity)}`)),
68
+ };
@@ -46,11 +46,11 @@ export const tools = [
46
46
  },
47
47
  {
48
48
  name: 'crm_formula_test',
49
- description: 'Dry-run a CRM calculated field expression or rollup before saving it. Administrator only; writes nothing. Pass expr (a formula) or formula (the whole spec, needed for a rollup). sampleValues maps a field name or cf:<fieldId> to a value; recordId uses that record\'s real values underneath the samples and is required to test a rollup. Returns the value, or the reason it could not be calculated.',
49
+ description: 'Dry-run a CRM calculated field expression or rollup before saving it. Administrator only; writes nothing. Pass expr (a formula) or formula (the whole spec, needed for a rollup; rollups may read related custom object records, for example SUM(obj12.cf45)). Returns value, error, resultType, kind and dependsOn. sampleValues maps a field name or cf:<fieldId> to a value; recordId uses that record\'s real values underneath the samples and is required to test a rollup. Returns the value, or the reason it could not be calculated.',
50
50
  inputSchema: {
51
51
  type: 'object',
52
52
  properties: {
53
- entity: { type: 'string', enum: ENTITIES },
53
+ entity: { type: 'string', description: 'deal, contact, company, ticket, or obj:<typeId> for a custom object type.' },
54
54
  expr: { type: 'string', description: 'For example "amount * 2" or "IF(amount > 100, \'big\', \'small\')".' },
55
55
  resultType: { type: 'string', enum: ['number', 'text', 'date', 'boolean'], description: 'Defaults to number.' },
56
56
  formula: { type: 'object', description: 'The whole spec instead of expr: { "kind":"rollup","expr":"COUNT(deals)","where":rule }.' },
package/server.js CHANGED
@@ -3855,6 +3855,26 @@ For multiSelect dynamic options: the variable named in dynamicOptionsVariable mu
3855
3855
  description: 'Verify a NetSuite M2M connection with per-check results (token, REST, customer read) and specific failure reasons and fixes. Lives in velaro-messaging - requires VELARO_MESSAGING_API.',
3856
3856
  inputSchema: { type: 'object', properties: { configId: { type: 'number' } }, required: ['configId'] },
3857
3857
  },
3858
+ {
3859
+ name: 'netsuite_required_permissions',
3860
+ description: 'List the NetSuite role permissions (subtab, level, skill area) the Velaro AI skills need. Same list as the setup guide.',
3861
+ inputSchema: { type: 'object', properties: {} },
3862
+ },
3863
+ {
3864
+ name: 'netsuite_permission_preflight',
3865
+ description: 'Check the connected NetSuite role against the required permissions and list what is missing. Lives in velaro-messaging - requires VELARO_MESSAGING_API.',
3866
+ inputSchema: { type: 'object', properties: { configId: { type: 'number' } }, required: ['configId'] },
3867
+ },
3868
+ {
3869
+ name: 'netsuite_transcript_settings_get',
3870
+ description: 'Show how conversation transcripts are saved to NetSuite (note, or a field overwritten or appended) for one NetSuite config.',
3871
+ inputSchema: { type: 'object', properties: { configId: { type: 'number' } }, required: ['configId'] },
3872
+ },
3873
+ {
3874
+ name: 'netsuite_transcript_settings_set',
3875
+ description: 'Change how transcripts are saved to NetSuite. Returns the before and after; the change applies to the config.',
3876
+ inputSchema: { type: 'object', properties: { configId: { type: 'number' }, transcriptPushMode: { type: 'string' }, transcriptFieldName: { type: 'string' } }, required: ['configId'] },
3877
+ },
3858
3878
 
3859
3879
  // ── Microsoft Teams Phone (config CRUD) ────────────────────────────────────
3860
3880
  // Live in-call actions (hold/resume/end/transfer, TeamsPhoneCtiController) are
@@ -8679,6 +8699,30 @@ reply: ${r?.reply}`;
8679
8699
  return checks.map(c => `${c.ok ? 'PASS' : 'FAIL'} ${c.name}${c.ok ? '' : ` - ${c.detail || c.reasonCode || ''}${c.reasonCode ? ` [${c.reasonCode}]` : ''}${c.howToFix ? ` | Fix: ${c.howToFix}` : ''}${c.providerDetail ? ` | NetSuite said: ${c.providerDetail}` : ''}`}`).join('\n') || 'No checks returned.';
8680
8700
  }
8681
8701
 
8702
+ case 'netsuite_required_permissions': {
8703
+ const { NETSUITE_REQUIRED_PERMISSIONS } = await import('./netsuite-permissions.js');
8704
+ return NETSUITE_REQUIRED_PERMISSIONS.map(p => `${p.area} | ${p.subtab} > ${p.permission} (${p.level})`).join('\n');
8705
+ }
8706
+ case 'netsuite_permission_preflight': {
8707
+ const r = await messagingPost(`/NetSuite/Configs/${encodeURIComponent(args.configId)}/permission-preflight`, {});
8708
+ return JSON.stringify(r, null, 2);
8709
+ }
8710
+ case 'netsuite_transcript_settings_get': {
8711
+ const list = await messagingGet('/NetSuite/Integrations/List');
8712
+ const arr = Array.isArray(list) ? list : Object.values(list || {}).find(Array.isArray) || [];
8713
+ const c = arr.find(x => String(x.id) === String(args.configId));
8714
+ if (!c) throw new Error(`NetSuite config ${args.configId} not found.`);
8715
+ return `Transcript mode: ${c.transcriptPushMode ?? '(default)'}; field: ${c.transcriptFieldName ?? '(none)'}`;
8716
+ }
8717
+ case 'netsuite_transcript_settings_set': {
8718
+ const body = {};
8719
+ if (args.transcriptPushMode) body.transcriptPushMode = args.transcriptPushMode;
8720
+ if (args.transcriptFieldName) body.transcriptFieldName = args.transcriptFieldName;
8721
+ if (!Object.keys(body).length) throw new Error('Pass transcriptPushMode and/or transcriptFieldName.');
8722
+ await messagingPut(`/NetSuite/Integrations/${encodeURIComponent(args.configId)}`, body);
8723
+ return `Updated config ${args.configId}: ${JSON.stringify(body)}`;
8724
+ }
8725
+
8682
8726
  // ── Microsoft Teams Phone (config CRUD) ───────────────────────────────────
8683
8727
  case 'teams_phone_get_config': {
8684
8728
  const config = await messagingGet('/TeamsPhone/Config');