@velaro/mcp-server 2.0.10 → 2.0.11

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.10",
3
+ "version": "2.0.11",
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,69 @@
1
+ // velaro callpresence: call-presence policy (chat and call routing while an agent is on a phone call).
2
+ // Site comes from the credential only. Parity module (CLI group -> MCP tools).
3
+
4
+ const enc = encodeURIComponent;
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
+ const need = (a, ...ks) => { for (const k of ks) if (a[k] === undefined || a[k] === null || a[k] === '') throw new Error(k + ' is required'); };
7
+
8
+ const SCOPE = { type: 'string', enum: ['site', 'group', 'agent'], description: 'Level: site default, a routing group (id = team id) or an agent (id = agent id)' };
9
+
10
+ export const tools = [
11
+ {
12
+ name: 'callpresence_get',
13
+ description: 'Get the call-presence policy: site default, routing-group and agent overrides, whether agents may override, and the allowed values. Controls chat/call routing while an agent is on a phone call and what happens when the call ends.',
14
+ inputSchema: { type: 'object', properties: {} },
15
+ },
16
+ {
17
+ name: 'callpresence_get_effective',
18
+ description: 'Get the resolved call-presence policy for one agent, with where each setting comes from (Agent override, Group override, Inherited from site, Platform default).',
19
+ inputSchema: { type: 'object', properties: { agentId: { type: 'integer', description: 'Agent (workspace user) id' }, teamId: { type: 'integer', description: 'Routing group to resolve against, for agents in several groups' } }, required: ['agentId'] },
20
+ },
21
+ {
22
+ name: 'callpresence_status',
23
+ description: 'List agents who are on a live phone call right now (Ringing, Active or OnHold call records), with call counts and whether a second call is live.',
24
+ inputSchema: { type: 'object', properties: {} },
25
+ },
26
+ {
27
+ name: 'callpresence_set',
28
+ description: 'Set the call-presence policy at one level. Omit a setting to inherit it. whileOnCall: NoChats | TakeChats | FinishThenOffline. afterCall: ReturnAutomatically | AskAgent | StayOffline. callsWhileBusy: NoCallsWhileBusy | RingEvenWhenBusy. allowAgentOverrides applies to the site level only.',
29
+ inputSchema: {
30
+ type: 'object',
31
+ properties: {
32
+ scope: SCOPE,
33
+ id: { type: 'integer', description: 'Team id (group) or agent id (agent). Omit for site.' },
34
+ whileOnCall: { type: 'string', enum: ['NoChats', 'TakeChats', 'FinishThenOffline'] },
35
+ afterCall: { type: 'string', enum: ['ReturnAutomatically', 'AskAgent', 'StayOffline'] },
36
+ callsWhileBusy: { type: 'string', enum: ['NoCallsWhileBusy', 'RingEvenWhenBusy'] },
37
+ allowAgentOverrides: { type: 'boolean', description: 'Site level only: may agents set their own override' },
38
+ },
39
+ required: ['scope'],
40
+ },
41
+ },
42
+ {
43
+ name: 'callpresence_clear',
44
+ description: 'Remove the call-presence policy at one level so it inherits from the level above again.',
45
+ inputSchema: { type: 'object', properties: { scope: SCOPE, id: { type: 'integer', description: 'Team id (group) or agent id (agent). Omit for site.' } }, required: ['scope'] },
46
+ },
47
+ ];
48
+
49
+ const target = (a) => {
50
+ need(a, 'scope');
51
+ if (!['site', 'group', 'agent'].includes(a.scope)) throw new Error('scope must be site, group or agent');
52
+ return a.scope === 'site' ? 'site/0' : `${a.scope}/${pid(a.id, 'id')}`;
53
+ };
54
+
55
+ export const handlers = {
56
+ callpresence_get: async (a, ctx) => ctx.messagingGet('/CallPresencePolicy'),
57
+ callpresence_get_effective: async (a, ctx) => {
58
+ need(a, 'agentId');
59
+ const q = a.teamId ? `?teamId=${pid(a.teamId, 'teamId')}` : '';
60
+ return ctx.messagingGet(`/CallPresencePolicy/effective/${pid(a.agentId, 'agentId')}${q}`);
61
+ },
62
+ callpresence_status: async (a, ctx) => ctx.messagingGet('/CallPresencePolicy/presence'),
63
+ callpresence_set: async (a, ctx) => {
64
+ const body = { whileOnCall: a.whileOnCall ?? null, afterCall: a.afterCall ?? null, callsWhileBusy: a.callsWhileBusy ?? null };
65
+ if (a.scope === 'site' && a.allowAgentOverrides !== undefined) body.allowAgentOverrides = a.allowAgentOverrides;
66
+ return ctx.messagingRequest('PUT', '/CallPresencePolicy/' + target(a), body);
67
+ },
68
+ callpresence_clear: async (a, ctx) => ctx.messagingRequest('DELETE', '/CallPresencePolicy/' + target(a)),
69
+ };
@@ -24,7 +24,7 @@ const MUTATING = new Set([
24
24
  'monday_set_field_mapping', 'teams_push_settings_update', 'teams_channel_config_update',
25
25
  'routing_team_update_config', 'pickup_update_config', 'payment_recovery_update_config',
26
26
  'recruiting_sync_jobs', 'ai_config_set_reply_format', 'magento_set_sidebar_fields',
27
- 'zoom_phone_set_config',
27
+ 'zoom_phone_set_config', 'callpresence_set', 'callpresence_clear',
28
28
  'billing_insights_set_preferences', 'billing_insights_dismiss_recommendation',
29
29
  'site_sale_create', 'site_sale_update', 'site_sale_end',
30
30
  ]);