@omnidim-ai/mcp-server 0.8.0 → 0.9.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/build/index.d.ts +1 -1
- package/build/index.js +344 -98
- package/build/index.js.map +1 -1
- package/build/procedures.js +115 -0
- package/build/procedures.js.map +1 -1
- package/build/tool-annotations.js +11 -2
- package/build/tool-annotations.js.map +1 -1
- package/package.json +2 -1
- package/src/index.ts +349 -103
- package/src/procedures.ts +116 -0
- package/src/tool-annotations.ts +11 -2
package/src/procedures.ts
CHANGED
|
@@ -192,6 +192,76 @@ Then give the agent a phone number and verify with a test call (the
|
|
|
192
192
|
\`provision_agent\` prompt walks through this end to end).
|
|
193
193
|
`;
|
|
194
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
|
+
|
|
195
265
|
const RESOURCES: ResourceDef[] = [
|
|
196
266
|
{
|
|
197
267
|
uri: "omnidim://guide/routing",
|
|
@@ -221,6 +291,13 @@ const RESOURCES: ResourceDef[] = [
|
|
|
221
291
|
mimeType: "text/markdown",
|
|
222
292
|
text: AGENT_CONFIG_GUIDE,
|
|
223
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
|
+
},
|
|
224
301
|
];
|
|
225
302
|
|
|
226
303
|
const PROMPTS: PromptDef[] = [
|
|
@@ -307,6 +384,45 @@ Throughout: phone numbers are E.164 with a leading \`+\`. See the \`omnidim://gu
|
|
|
307
384
|
See the \`omnidim://guide/routing\` resource for the full gotcha list.`;
|
|
308
385
|
},
|
|
309
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
|
+
},
|
|
310
426
|
];
|
|
311
427
|
|
|
312
428
|
export function getPromptText(name: string, args: Record<string, string> = {}): string | null {
|
package/src/tool-annotations.ts
CHANGED
|
@@ -10,6 +10,13 @@ const TOOL_TITLES: Record<string, string> = {
|
|
|
10
10
|
getAgent: "Get agent",
|
|
11
11
|
updateAgent: "Update agent",
|
|
12
12
|
deleteAgent: "Delete agent",
|
|
13
|
+
listAgentVersions: "List agent versions",
|
|
14
|
+
createAgentVersion: "Save agent version",
|
|
15
|
+
diffAgentVersion: "Diff agent version",
|
|
16
|
+
restoreAgentVersion: "Restore agent version",
|
|
17
|
+
renameAgentVersion: "Rename agent version",
|
|
18
|
+
deleteAgentVersion: "Delete agent version",
|
|
19
|
+
createSession: "Create voice session",
|
|
13
20
|
dispatchCall: "Dispatch call",
|
|
14
21
|
listCallLogs: "List call logs",
|
|
15
22
|
getCallLog: "Get call log",
|
|
@@ -52,9 +59,11 @@ const TOOL_TITLES: Record<string, string> = {
|
|
|
52
59
|
// POST tools that only validate or preview, with no state change.
|
|
53
60
|
const READ_ONLY_TOOLS = new Set(["canUploadFile", "calculateCreditOperation"]);
|
|
54
61
|
|
|
55
|
-
// Irreversible removals plus tools that place
|
|
62
|
+
// Irreversible removals, overwrites of live config, plus tools that place
|
|
63
|
+
// real outbound calls.
|
|
56
64
|
const DESTRUCTIVE_TOOLS = new Set([
|
|
57
|
-
"deleteAgent", "
|
|
65
|
+
"deleteAgent", "deleteAgentVersion", "restoreAgentVersion",
|
|
66
|
+
"deleteKnowledgeBaseFile", "detachKnowledgeBaseFiles", "detachPhoneNumber",
|
|
58
67
|
"cancelBulkCall", "revertCreditsFromChild", "dispatchCall", "createBulkCall", "addBulkCallContact",
|
|
59
68
|
]);
|
|
60
69
|
|