@velaro/mcp-server 2.0.5 → 2.0.6

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.5",
3
+ "version": "2.0.6",
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": {
@@ -45,6 +45,7 @@
45
45
  "tool-annotations.js",
46
46
  "fetch-retry.js",
47
47
  "messaging-base.js",
48
+ "survey-email.js",
48
49
  "parity/loader.js",
49
50
  "parity/*.customer.js",
50
51
  "workflow-schedule.js",
package/server.js CHANGED
@@ -53,6 +53,7 @@ import { withAnnotations } from './tool-annotations.js';
53
53
  import { loadParity, runParity } from './parity/loader.js';
54
54
  import { resolveMessagingApi } from './messaging-base.js';
55
55
  import { buildResolvePath, buildTimelinePath, buildOverrideBody, buildValidateBody, buildBannerPath, buildOverrideListPath, tolerant, VALIDATE_PATH, OVERRIDE_PATH } from './workflow-schedule.js';
56
+ import { applyEmailSubmissionsTo } from './survey-email.js';
56
57
 
57
58
  // Production admin API by default; set VELARO_ADMIN_API to target staging.
58
59
  const API_BASE = process.env.VELARO_ADMIN_API || 'https://api-admin-us-east.velaro.com';
@@ -1033,10 +1034,12 @@ For multiSelect dynamic options: the variable named in dynamicOptionsVariable mu
1033
1034
  },
1034
1035
  {
1035
1036
  name: 'survey_upsert',
1036
- description: 'Create (omit id or set id=0) or update (set id) a survey. body must be the full SurveyViewModel JSON shape (id, name, questions[], each question with type/text/options/required/variable/etc.). Use survey_get on an existing survey to fetch this full shape as a template rather than guessing the question schema from scratch. Each question also accepts isThemeAnchor (boolean, default false: this answer sets the Chat Intelligence topic) and themeMapping (string: JSON object mapping answer text to a site topic, e.g. "{\\"Pay my bill\\":\\"Billing Questions\\"}"). Both only take effect when the site has the multi-topic setting on. body.compactMode is tri-state: null/omitted = follow default (regular size), true = compact, false = regular.',
1037
+ description: 'Create (omit id or set id=0) or update (set id) a survey. body must be the full SurveyViewModel JSON shape (id, name, questions[], each question with type/text/options/required/variable/etc.). Use survey_get on an existing survey to fetch this full shape as a template rather than guessing the question schema from scratch. Each question also accepts isThemeAnchor (boolean, default false: this answer sets the Chat Intelligence topic) and themeMapping (string: JSON object mapping answer text to a site topic, e.g. "{\\"Pay my bill\\":\\"Billing Questions\\"}"). Both only take effect when the site has the multi-topic setting on. body.compactMode is tri-state: null/omitted = follow default (regular size), true = compact, false = regular. Optional top-level emailSubmissionsTo sets who receives offline / closed-launcher submissions (omit = keep stored list, "" = clear).',
1037
1038
  inputSchema: {
1038
1039
  type: 'object',
1039
- properties: { body: {
1040
+ properties: {
1041
+ emailSubmissionsTo: { type: 'string', description: 'Optional. Comma/semicolon list (max 10) of addresses that receive offline / closed-launcher survey submissions. Overrides body.emailSubmissionsTo. Omit to keep the stored list; pass "" to clear it. Invalid addresses are rejected by the server with a 400.' },
1042
+ body: {
1040
1043
  type: 'object',
1041
1044
  description: 'Full SurveyViewModel JSON',
1042
1045
  properties: {
@@ -5397,7 +5400,7 @@ async function handleTool(name, args) {
5397
5400
 
5398
5401
  case 'survey_upsert': {
5399
5402
  if (!args.body || typeof args.body !== 'object') throw new Error('body is required (full SurveyViewModel JSON)');
5400
- const r = await messagingPost('/Surveys', args.body);
5403
+ const r = await messagingPost('/Surveys', applyEmailSubmissionsTo(args.body, args.emailSubmissionsTo));
5401
5404
  return JSON.stringify(r, null, 2);
5402
5405
  }
5403
5406
 
@@ -0,0 +1,9 @@
1
+ // Survey.EmailSubmissionsTo helper (velaro-messaging PR #3209/#3214).
2
+ // Semantics enforced by the server on POST Surveys: field omitted/null keeps the stored
3
+ // recipients, "" clears them, a non-empty comma/semicolon list replaces them (max 10, validated
4
+ // server-side, 400 with { error } on a bad address). The server is the only validator.
5
+ // Mirrored in cli/lib/survey-email.js; keep in sync (both covered by their tests).
6
+ export function applyEmailSubmissionsTo(body, value) {
7
+ if (value === undefined || value === null) return body;
8
+ return { ...body, emailSubmissionsTo: String(value).trim() };
9
+ }