@omnidim-ai/mcp-server 0.17.0 → 0.18.1

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/src/telemetry.ts CHANGED
@@ -3,7 +3,7 @@ import { homedir } from "node:os";
3
3
  import { dirname, join } from "node:path";
4
4
  import { randomUUID } from "node:crypto";
5
5
 
6
- import { classifyToolError } from "./helpers.js";
6
+ import { classifyToolError, packageVersion } from "./helpers.js";
7
7
  import { appendLog } from "./logger.js";
8
8
 
9
9
  const ENDPOINT = "https://mcp.omnidim.io/api/telemetry/event";
@@ -62,17 +62,8 @@ interface BaseFields {
62
62
  }
63
63
 
64
64
  function baseFields(): BaseFields {
65
- let version = "unknown";
66
- try {
67
- const pkg = JSON.parse(
68
- readFileSync(new URL("../package.json", import.meta.url), "utf8")
69
- ) as { version?: string };
70
- version = pkg.version ?? "unknown";
71
- } catch {
72
- // keep "unknown"
73
- }
74
65
  return {
75
- package_version: version,
66
+ package_version: packageVersion(),
76
67
  node_version: process.version,
77
68
  os_platform: process.platform,
78
69
  os_arch: process.arch,
@@ -59,7 +59,6 @@ const TOOL_TITLES: Record<string, string> = {
59
59
  releasePhoneNumber: "Release phone number",
60
60
  getAccountBalance: "Get account balance",
61
61
  listClonedVoices: "List cloned voices",
62
- createClonedVoice: "Clone a voice",
63
62
  getClonedVoice: "Get cloned voice",
64
63
  updateClonedVoice: "Update cloned voice",
65
64
  deleteClonedVoice: "Delete cloned voice",
@@ -85,29 +84,70 @@ const TOOL_TITLES: Record<string, string> = {
85
84
  deletePostCallAction: "Delete a post-call action",
86
85
  updatePostCallAction: "Update a post-call action",
87
86
  listIntegrations: "List integrations",
87
+ createCustomApiIntegration: "Create custom API integration",
88
+ listAgentIntegrations: "List agent integrations",
89
+ attachAgentIntegration: "Attach integration to agent",
90
+ detachAgentIntegration: "Detach integration from agent",
91
+ setBulkCallRotation: "Set campaign number rotation",
92
+ setPhoneNumberAutoRenew: "Set phone number auto-renew",
93
+ listWhatsappNumbers: "List WhatsApp numbers",
94
+ importWhatsappNumbers: "Import WhatsApp numbers",
95
+ previewWhatsappNumbers: "Preview WhatsApp numbers to import",
96
+ getWhatsappNumber: "Get WhatsApp number",
97
+ listWhatsappTemplates: "List WhatsApp templates",
98
+ syncWhatsappTemplates: "Sync WhatsApp templates",
99
+ getWhatsappCalling: "Get WhatsApp calling setting",
100
+ setWhatsappCalling: "Turn WhatsApp calling on or off",
101
+ listWhatsappConversations: "List WhatsApp conversations",
102
+ getWhatsappConversation: "Get WhatsApp conversation",
103
+ takeOverWhatsappConversation: "Take over WhatsApp conversation",
104
+ handBackWhatsappConversation: "Hand WhatsApp conversation back to agent",
105
+ listWhatsappMessages: "List WhatsApp messages",
106
+ sendWhatsappMessage: "Send WhatsApp message",
107
+ getWhatsappMessage: "Get WhatsApp message",
108
+ listWhatsappOptOuts: "List WhatsApp opt-outs",
109
+ addWhatsappOptOut: "Add WhatsApp opt-out",
110
+ liftWhatsappOptOut: "Lift WhatsApp opt-out",
111
+ listWhatsappCampaigns: "List WhatsApp campaigns",
112
+ createWhatsappCampaign: "Create WhatsApp campaign",
113
+ getWhatsappCampaign: "Get WhatsApp campaign",
114
+ listWhatsappCampaignContacts: "List WhatsApp campaign contacts",
115
+ addWhatsappCampaignContacts: "Add contacts to WhatsApp campaign",
116
+ launchWhatsappCampaign: "Launch WhatsApp campaign",
117
+ pauseWhatsappCampaign: "Pause WhatsApp campaign",
118
+ resumeWhatsappCampaign: "Resume WhatsApp campaign",
119
+ cancelWhatsappCampaign: "Cancel WhatsApp campaign",
88
120
  };
89
121
 
90
122
  // POST tools that only validate or preview, with no state change.
91
- const READ_ONLY_TOOLS = new Set(["canUploadFile", "validateWorkflow"]);
123
+ const READ_ONLY_TOOLS = new Set(["canUploadFile", "validateWorkflow", "previewWhatsappNumbers"]);
92
124
 
93
125
  // Irreversible removals, overwrites of live config, plus tools that place
94
- // real outbound calls.
126
+ // real outbound calls or send real messages.
95
127
  const DESTRUCTIVE_TOOLS = new Set([
96
128
  "deleteAgent", "deleteAgentVersion", "restoreAgentVersion",
97
129
  "deleteKnowledgeBaseFile", "detachKnowledgeBaseFiles", "detachPhoneNumber",
98
130
  "cancelBulkCall", "dispatchCall", "createBulkCall", "addBulkCallContact",
99
- "addBulkCallContacts", "startBulkCall", "retryBulkCall",
131
+ "addBulkCallContacts", "startBulkCall", "retryBulkCall", "bulkCallActions",
100
132
  "purchasePhoneNumber", "releasePhoneNumber",
101
- "deleteClonedVoice", "deleteWorkflow", "publishWorkflow", "activateWorkflow",
133
+ "deleteClonedVoice", "regenerateClonedVoiceSample", "deleteWorkflow", "publishWorkflow", "activateWorkflow",
102
134
  "deactivateWorkflow", "testWorkflow", "deletePostCallAction",
135
+ "sendWhatsappMessage", "launchWhatsappCampaign", "resumeWhatsappCampaign",
136
+ "addWhatsappCampaignContacts", "cancelWhatsappCampaign", "liftWhatsappOptOut",
137
+ "importWhatsappNumbers", "attachAgentIntegration", "detachAgentIntegration",
138
+ "setPhoneNumberAutoRenew",
103
139
  ]);
104
140
 
105
- // Tools that reach the external phone network (a carrier, not just our API).
141
+ // Tools that reach people or systems outside our API: a carrier, Meta, or
142
+ // (attachAgentIntegration) a live agent calling a caller-supplied URL.
106
143
  const OPEN_WORLD_TOOLS = new Set([
107
144
  "testWorkflow",
108
145
  "dispatchCall", "createBulkCall", "addBulkCallContact",
109
- "addBulkCallContacts", "startBulkCall", "retryBulkCall",
146
+ "addBulkCallContacts", "startBulkCall", "retryBulkCall", "bulkCallActions",
110
147
  "purchasePhoneNumber", "releasePhoneNumber",
148
+ "sendWhatsappMessage", "launchWhatsappCampaign", "resumeWhatsappCampaign",
149
+ "addWhatsappCampaignContacts", "importWhatsappNumbers", "setWhatsappCalling",
150
+ "attachAgentIntegration",
111
151
  ]);
112
152
 
113
153
  export interface ToolAnnotations {
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ import { jsonSchemaToZod } from 'json-schema-to-zod';
3
+
4
+ /**
5
+ * Builds the zod schema that checks a tool's arguments. json-schema-to-zod's code
6
+ * drops unknown keys, so it stays first. Its oneOf output carries TypeScript
7
+ * generics that new Function cannot parse, so those tools use zod's own converter
8
+ * instead of skipping validation.
9
+ */
10
+ export function buildToolSchema(jsonSchema: unknown): z.ZodType {
11
+ if (typeof jsonSchema !== 'object' || jsonSchema === null) return z.looseObject({});
12
+ try {
13
+ const schema = new Function('z', `return (${jsonSchemaToZod(jsonSchema as any)});`)(z);
14
+ if (typeof schema?.parse === 'function') return schema;
15
+ } catch {
16
+ // Falls through to the native converter below.
17
+ }
18
+ return z.fromJSONSchema(jsonSchema as any);
19
+ }