@omnidim-ai/mcp-server 0.7.0 → 0.9.0

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/procedures.ts CHANGED
@@ -75,6 +75,193 @@ give it a **phone number** and optionally a **knowledge base**, then place
75
75
  10. **Phone numbers are E.164 with a leading \`+\`** everywhere.
76
76
  `;
77
77
 
78
+ // Provider recommendations by caller language, grounded in what works in
79
+ // production. Names match the createAgent enums (transcriber/voice/model).
80
+ const RECOMMENDED_STACK = `# Recommended provider stacks
81
+
82
+ Each agent uses a transcriber (speech-to-text), a voice (text-to-speech), and a
83
+ language model, all set on \`createAgent\`. The pairings below work well in
84
+ production, grouped by the language your callers speak. Use \`listSTTProviders\`,
85
+ \`listTTSProviders\`, \`listLLMProviders\`, and \`listVoices\` for the live catalog.
86
+
87
+ ## Language model
88
+
89
+ - Default: \`gpt-4.1-mini\` — fast and accurate across languages, a good first
90
+ choice for almost any agent.
91
+ - Alternatives: \`gemini-2.5-flash\`, \`gpt-4o\` (premium), \`gpt-4.1-nano\` (lighter).
92
+
93
+ ## By caller language
94
+
95
+ - **Indian English (en-IN):** transcriber \`azure_stream\`; voice \`cartesia\`
96
+ (default), \`eleven_labs\`, or \`google\`.
97
+ - **Hindi / Hinglish (mixed Hindi and English):** transcriber \`soniox\`
98
+ (handles code-mixed speech in one stream); voice \`cartesia\` or \`eleven_labs\`.
99
+ - **Other Indian languages (Telugu, Bengali, etc.):** transcriber \`soniox\` or
100
+ \`sarvam\` (tuned for Indian languages); voice \`cartesia\` or \`sarvam\`.
101
+ - **US / UK English:** transcriber \`azure_stream\` or \`deepgram_stream\`; voice
102
+ \`cartesia\` or \`eleven_labs\`.
103
+
104
+ ## Field notes
105
+
106
+ - \`transcriber.provider\` is one of \`deepgram_stream\`, \`azure_stream\`,
107
+ \`soniox\`, \`sarvam\`, \`cartesia\`. \`deepgram_stream\` also needs a \`model\`
108
+ (\`nova-3\` or \`nova-2\`); the others do not.
109
+ - \`voice.provider\` is one of \`cartesia\`, \`eleven_labs\`, \`google\`,
110
+ \`sarvam\`. \`cartesia\` voices need a \`model\` such as \`sonic-3.5\`; for
111
+ \`eleven_labs\` the model is implied by the voice.
112
+
113
+ ## Responsiveness
114
+
115
+ - Keep the system prompt focused. Long prompts add latency to every turn.
116
+ - Verify your chosen voice on a short test call before launch (see
117
+ \`omnidim://reference/voices\`).
118
+ `;
119
+
120
+ // How to choose a voice, with the synthesizable-voice gotcha and per-provider notes.
121
+ const VOICES_GUIDE = `# Choosing a voice
122
+
123
+ \`listVoices\` returns the catalog. Use a voice's \`name\` field as the
124
+ \`voice_id\` you pass to \`createAgent\`. Quality varies by language and not every
125
+ voice synthesizes cleanly, so always place a short test call and listen before
126
+ launch.
127
+
128
+ Filter \`listVoices\` by \`provider\` (\`cartesia\`, \`eleven_labs\`, \`google\`,
129
+ \`sarvam\`). ElevenLabs also supports \`language\`, \`accent\`, and \`gender\`.
130
+
131
+ By provider:
132
+
133
+ - **\`cartesia\`** — low-latency multilingual voices; the platform default. Pass a
134
+ \`model\` such as \`sonic-3.5\`. Example voice_id
135
+ \`bf0a246a-8642-498a-9950-80c35e9276b5\` ("Sophie", English female).
136
+ - **\`eleven_labs\`** — premium, expressive voices; the model is implied by the
137
+ voice. Example voice_id \`JBFqnCBsd6RMkjVDRZzb\` ("George").
138
+ - **\`sarvam\`** — natural prosody for Indian languages.
139
+ - **\`google\`** — broad language coverage.
140
+ `;
141
+
142
+ // The createAgent field shape with two complete, copy-ready examples.
143
+ const AGENT_CONFIG_GUIDE = `# Building an agent with createAgent
144
+
145
+ On this server \`createAgent\` wraps its payload in \`requestBody\` (see the
146
+ routing guide). The fields inside:
147
+
148
+ - \`name\` — agent name.
149
+ - \`welcome_message\` — the first line the agent speaks.
150
+ - \`context_breakdown\` — a list of \`{ title, body }\` sections that form the
151
+ agent's instructions.
152
+ - \`call_type\` — "Incoming" or "Outgoing".
153
+ - \`model\` — \`{ model, temperature? }\`, e.g. \`{ "model": "gpt-4.1-mini" }\`.
154
+ - \`voice\` — \`{ provider, voice_id, model? }\`. \`model\` (e.g. \`sonic-3.5\`)
155
+ is only needed for \`cartesia\`.
156
+ - \`transcriber\` — \`{ provider, model?, language? }\`. \`model\` (\`nova-3\` /
157
+ \`nova-2\`) is only needed for \`deepgram_stream\`.
158
+
159
+ ## Example: Indian-English support agent (inbound)
160
+
161
+ {
162
+ "requestBody": {
163
+ "name": "Support agent",
164
+ "welcome_message": "Hi, thanks for calling. How can I help you today?",
165
+ "context_breakdown": [
166
+ { "title": "Role", "body": "You are a friendly customer-support agent. Answer questions, and if you cannot help, offer to connect the caller to a human." }
167
+ ],
168
+ "call_type": "Incoming",
169
+ "model": { "model": "gpt-4.1-mini" },
170
+ "voice": { "provider": "cartesia", "model": "sonic-3.5", "voice_id": "bf0a246a-8642-498a-9950-80c35e9276b5" },
171
+ "transcriber": { "provider": "azure_stream" }
172
+ }
173
+ }
174
+
175
+ ## Example: Hindi / Hinglish appointment reminder (outbound)
176
+
177
+ {
178
+ "requestBody": {
179
+ "name": "Appointment reminder",
180
+ "welcome_message": "Namaste, main aapke appointment ke baare mein baat karne ke liye call kar rahi hoon.",
181
+ "context_breakdown": [
182
+ { "title": "Role", "body": "You remind customers about an upcoming appointment and confirm whether they can attend. Speak naturally in the caller's language, Hindi or English." }
183
+ ],
184
+ "call_type": "Outgoing",
185
+ "model": { "model": "gpt-4.1-mini" },
186
+ "voice": { "provider": "cartesia", "model": "sonic-3.5", "voice_id": "<pick one from listVoices>" },
187
+ "transcriber": { "provider": "soniox" }
188
+ }
189
+ }
190
+
191
+ Then give the agent a phone number and verify with a test call (the
192
+ \`provision_agent\` prompt walks through this end to end).
193
+ `;
194
+
195
+ const VERSIONING_GUIDE = `# Agent version history
196
+
197
+ A **version** is a frozen snapshot of an agent's configuration at a point in
198
+ time. Use it to save a known-good setup before a risky change, and to roll back
199
+ if a change makes the agent worse.
200
+
201
+ ## The tools
202
+
203
+ - \`listAgentVersions\` { agent_id } - the timeline, newest first. Each entry has
204
+ a \`version_number\`, a \`kind\`, who saved it, and a \`change_summary\` (a
205
+ one-line "what changed in this version vs the one before it").
206
+ - \`createAgentVersion\` { agent_id, requestBody: { name, note? } } - save the
207
+ agent's CURRENT config as a named version.
208
+ - \`diffAgentVersion\` { agent_id, version_number, against? } - what changed (see
209
+ below).
210
+ - \`restoreAgentVersion\` { agent_id, version_number } - write a version back onto
211
+ the live agent.
212
+ - \`renameAgentVersion\` / \`deleteAgentVersion\` - tidy the timeline.
213
+
214
+ \`kind\` is \`manual\` (a person saved it), \`auto\` (saved automatically a few
215
+ minutes after editing settles - you do NOT trigger these), or \`system\` (a
216
+ safety backup taken automatically right before a restore).
217
+
218
+ ## When to snapshot
219
+
220
+ Call \`createAgentVersion\` right BEFORE you make a change you might want to undo
221
+ (swapping the model/voice, rewriting the prompt, changing transfer rules). Give
222
+ it a clear \`name\` ("before pricing-flow rewrite"). You do not need to snapshot
223
+ after routine edits - the platform auto-saves settled states on its own.
224
+
225
+ ## How to read a diff
226
+
227
+ \`diffAgentVersion\` compares two snapshots and returns \`{ changed, groups }\`,
228
+ where each group is an area (Settings, Prompt, Transfer rules, Post-call actions,
229
+ Knowledge, Integrations, Web widget, Conversation flow, Other settings) with the
230
+ specific old -> new changes. Pick the comparison with \`against\`:
231
+
232
+ - **omit / \`against=previous\`** (default): what changed IN this version vs the
233
+ one before it. This matches the \`change_summary\` in the list.
234
+ - **\`against=current\`**: what restoring this version WOULD change vs the agent's
235
+ live config right now. Read this before a restore to preview the effect.
236
+ - **\`against=<number>\`**: compare with a specific other version.
237
+
238
+ ## How to decide and perform a restore
239
+
240
+ 1. \`listAgentVersions\` and scan \`change_summary\` to find the version you want.
241
+ 2. \`diffAgentVersion\` { version_number, against: "current" } to preview exactly
242
+ what restoring changes. If it says nothing meaningful changed, there is
243
+ nothing to restore.
244
+ 3. \`restoreAgentVersion\` { agent_id, version_number }. This first saves the
245
+ current state as a \`system\` "Backup before restore" version (so the restore
246
+ is itself undoable), then writes the chosen config back. The response
247
+ includes a \`skipped\` list: references (knowledge files, integrations) that no
248
+ longer exist are dropped and reported rather than failing the restore.
249
+ 4. Confirm with \`listAgentVersions\` (a new \`system\` backup should appear) or
250
+ \`getAgent\` to see the live config.
251
+
252
+ ## Gotchas
253
+
254
+ - Version history is enabled per organization. If it is off for the caller's
255
+ org, these endpoints return 403 (\`feature_disabled\`).
256
+ - \`createAgentVersion\` refuses a no-op: if nothing changed since the latest
257
+ version it returns 409 (\`no_changes\`). Make (or intend) a real change first.
258
+ - There is a per-agent cap on versions created through the API; at the cap
259
+ \`createAgentVersion\` returns 409 (\`version_limit_reached\`) - delete an old
260
+ version to make room.
261
+ - \`listAgentVersions\` and \`diffAgentVersion\` are read-only and safe to call
262
+ freely. Restore and delete mutate the live agent - confirm intent first.
263
+ `;
264
+
78
265
  const RESOURCES: ResourceDef[] = [
79
266
  {
80
267
  uri: "omnidim://guide/routing",
@@ -83,6 +270,34 @@ const RESOURCES: ResourceDef[] = [
83
270
  mimeType: "text/markdown",
84
271
  text: ROUTING_GUIDE,
85
272
  },
273
+ {
274
+ uri: "omnidim://reference/recommended-stack",
275
+ name: "Recommended provider stacks by language",
276
+ description: "Which transcriber (STT), voice (TTS), and language model to choose, grouped by the caller's language. Reflects what works in production.",
277
+ mimeType: "text/markdown",
278
+ text: RECOMMENDED_STACK,
279
+ },
280
+ {
281
+ uri: "omnidim://reference/voices",
282
+ name: "Choosing a voice",
283
+ description: "How to pick a voice from listVoices (use the name as voice_id), per-provider notes, and the verify-on-a-test-call rule.",
284
+ mimeType: "text/markdown",
285
+ text: VOICES_GUIDE,
286
+ },
287
+ {
288
+ uri: "omnidim://reference/agent-config",
289
+ name: "Building an agent with createAgent",
290
+ description: "The createAgent field shape with two complete, copy-ready example configurations (Indian-English support, Hindi/Hinglish reminder).",
291
+ mimeType: "text/markdown",
292
+ text: AGENT_CONFIG_GUIDE,
293
+ },
294
+ {
295
+ uri: "omnidim://guide/agent-versioning",
296
+ name: "Agent version history",
297
+ description: "How to save, diff, and restore agent config snapshots: which tool to call, what the diff `against` modes mean, how to decide on a restore, and the 403/409 gotchas.",
298
+ mimeType: "text/markdown",
299
+ text: VERSIONING_GUIDE,
300
+ },
86
301
  ];
87
302
 
88
303
  const PROMPTS: PromptDef[] = [
@@ -169,6 +384,45 @@ Throughout: phone numbers are E.164 with a leading \`+\`. See the \`omnidim://gu
169
384
  See the \`omnidim://guide/routing\` resource for the full gotcha list.`;
170
385
  },
171
386
  },
387
+ {
388
+ name: "restore_agent_version",
389
+ description: "Safely roll an agent back to an earlier saved version: find the right snapshot, preview exactly what restoring changes, then restore.",
390
+ arguments: [
391
+ { name: "agent_id", description: "The agent to roll back (the listAgents / createAgent id).", required: true },
392
+ { name: "goal", description: "What you want to get back to, in plain language (e.g. 'the version before I broke the transfer flow').", required: false },
393
+ ],
394
+ build: (a) => {
395
+ const agentId = a.agent_id || "<agent_id>";
396
+ const goal = a.goal || "(describe which earlier state you want back)";
397
+ return `Roll agent ${agentId} back to an earlier version.
398
+
399
+ Goal: "${goal}"
400
+
401
+ Follow these steps in order. Do NOT restore blindly, preview first.
402
+
403
+ 1. \`listAgentVersions\` { agent_id: ${agentId} }. Versions come newest first;
404
+ each has a \`version_number\`, \`kind\` (manual / auto / system), who saved it,
405
+ when, and a \`change_summary\` (what changed in that version). Use the names,
406
+ timestamps, and change summaries to find the one that matches the goal above.
407
+ If the feature is off for this org these calls return 403 (feature_disabled);
408
+ report that and stop.
409
+ 2. Preview the effect: \`diffAgentVersion\` { agent_id: ${agentId}, version_number: <chosen>, against: "current" }.
410
+ This shows exactly what restoring that version WOULD change vs the agent's
411
+ live config, grouped by area (Settings, Prompt, Transfer rules, etc.). If it
412
+ reports no meaningful change, tell the user there is nothing to restore and
413
+ stop. Show the user this preview and confirm before the next step.
414
+ 3. Restore: \`restoreAgentVersion\` { agent_id: ${agentId}, version_number: <chosen> }.
415
+ This automatically saves the current state as a "Backup before restore"
416
+ version first (so the restore is itself undoable), then writes the chosen
417
+ config back. Check the response's \`skipped\` list: knowledge files or
418
+ integrations that no longer exist are dropped and reported, not restored.
419
+ 4. Confirm: \`listAgentVersions\` again (a new system "Backup before restore"
420
+ entry should be at the top) and tell the user they can undo by restoring it.
421
+
422
+ See the \`omnidim://guide/agent-versioning\` resource for the full tool list and
423
+ the diff \`against\` modes.`;
424
+ },
425
+ },
172
426
  ];
173
427
 
174
428
  export function getPromptText(name: string, args: Record<string, string> = {}): string | null {