@omnidim-ai/mcp-server 0.5.1 → 0.7.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.
@@ -0,0 +1,77 @@
1
+ // MCP tool annotations: a display title plus read-only / destructive /
2
+ // open-world hints, so clients can parallelize reads and confirm before
3
+ // destructive or real-world actions. Hand-authored (regen-safe); index.ts
4
+ // imports toolAnnotations and applies it in the tools/list handler.
5
+ // Human-readable display names, separate from the machine `name` the model sees.
6
+ const TOOL_TITLES = {
7
+ listAgents: "List agents",
8
+ createAgent: "Create agent",
9
+ getAgent: "Get agent",
10
+ updateAgent: "Update agent",
11
+ deleteAgent: "Delete agent",
12
+ dispatchCall: "Dispatch call",
13
+ listCallLogs: "List call logs",
14
+ getCallLog: "Get call log",
15
+ fetchBulkCalls: "List bulk campaigns",
16
+ createBulkCall: "Create bulk campaign",
17
+ addBulkCallContact: "Add contact to campaign",
18
+ getBulkCall: "Get bulk campaign",
19
+ bulkCallActions: "Control bulk campaign",
20
+ cancelBulkCall: "Cancel bulk campaign",
21
+ getBulkCallLiveStatus: "Get campaign live status",
22
+ listKnowledgeBaseFiles: "List knowledge base files",
23
+ canUploadFile: "Check file upload eligibility",
24
+ uploadKnowledgeBaseFile: "Upload knowledge base file",
25
+ attachKnowledgeBaseFiles: "Attach knowledge base files",
26
+ detachKnowledgeBaseFiles: "Detach knowledge base files",
27
+ deleteKnowledgeBaseFile: "Delete knowledge base file",
28
+ listPhoneNumbers: "List phone numbers",
29
+ attachPhoneNumber: "Attach phone number",
30
+ detachPhoneNumber: "Detach phone number",
31
+ importTwilioNumber: "Import Twilio number",
32
+ importExotelNumber: "Import Exotel number",
33
+ importSipTrunk: "Import SIP trunk",
34
+ listLLMProviders: "List LLM providers",
35
+ listVoices: "List voices",
36
+ listSTTProviders: "List speech-to-text providers",
37
+ listTTSProviders: "List text-to-speech providers",
38
+ listAllProviders: "List all providers",
39
+ getVoice: "Get voice",
40
+ listChildOrganizations: "List child organizations",
41
+ addUser: "Add child user",
42
+ setUserAccessControl: "Set user access control",
43
+ setUserExpiry: "Set user expiry",
44
+ setChildConcurrency: "Set child concurrency limit",
45
+ calculateCreditOperation: "Preview credit operation",
46
+ transferCreditsToChild: "Transfer credits to child",
47
+ revertCreditsFromChild: "Revert credits from child",
48
+ getResellerCreditLogs: "Get reseller credit logs",
49
+ };
50
+ // POST tools that only validate or preview, with no state change.
51
+ const READ_ONLY_TOOLS = new Set(["canUploadFile", "calculateCreditOperation"]);
52
+ // Irreversible removals plus tools that place real outbound calls.
53
+ const DESTRUCTIVE_TOOLS = new Set([
54
+ "deleteAgent", "deleteKnowledgeBaseFile", "detachKnowledgeBaseFiles", "detachPhoneNumber",
55
+ "cancelBulkCall", "revertCreditsFromChild", "dispatchCall", "createBulkCall", "addBulkCallContact",
56
+ ]);
57
+ // Tools that reach the external phone network.
58
+ const OPEN_WORLD_TOOLS = new Set(["dispatchCall", "createBulkCall", "addBulkCallContact"]);
59
+ // Spec defaults are conservative (destructiveHint and openWorldHint default to
60
+ // true), so set every hint explicitly to mark plain writes as safe.
61
+ export function toolAnnotations(def) {
62
+ const annotations = {};
63
+ const title = TOOL_TITLES[def.name];
64
+ if (title)
65
+ annotations.title = title;
66
+ const readOnly = def.method.toUpperCase() === "GET" || READ_ONLY_TOOLS.has(def.name);
67
+ annotations.readOnlyHint = readOnly;
68
+ if (readOnly) {
69
+ annotations.openWorldHint = false;
70
+ }
71
+ else {
72
+ annotations.destructiveHint = DESTRUCTIVE_TOOLS.has(def.name);
73
+ annotations.openWorldHint = OPEN_WORLD_TOOLS.has(def.name);
74
+ }
75
+ return annotations;
76
+ }
77
+ //# sourceMappingURL=tool-annotations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-annotations.js","sourceRoot":"","sources":["../src/tool-annotations.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,wEAAwE;AACxE,0EAA0E;AAC1E,oEAAoE;AAEpE,iFAAiF;AACjF,M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AAI,GAAG,CAAC,CAAC,eAAe,EAAE,0BAA0B,CAAC,CAAC,CAAC;AAE/E,mEAAmE;AACnE,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;IAChC,aAAa,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,mBAAmB;IACzF,gBAAgB,EAAE,wBAAwB,EAAE,cAAc,EAAE,gBAAgB,EAAE,oBAAoB;CACnG,CAAC,CAAC;AAEH,+CAA+C;AAC/C,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,cAAc,EAAE,gBAAgB,EAAE,oBAAoB,CAAC,CAAC,CAAC;AAS3F,+EAA+E;AAC/E,oEAAoE;AACpE,MAAM,UAAU,eAAe,CAAC,GAAqC;IACnE,MAAM,WAAW,GAAoB,EAAE,CAAC;IACxC,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACpC,IAAI,KAAK;QAAE,WAAW,CAAC,KAAK,GAAG,KAAK,CAAC;IACrC,MAAM,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,KAAK,IAAI,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACrF,WAAW,CAAC,YAAY,GAAG,QAAQ,CAAC;IACpC,IAAI,QAAQ,EAAE,CAAC;QACb,WAAW,CAAC,aAAa,GAAG,KAAK,CAAC;IACpC,CAAC;SAAM,CAAC;QACN,WAAW,CAAC,eAAe,GAAG,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC9D,WAAW,CAAC,aAAa,GAAG,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC"}
@@ -0,0 +1,7 @@
1
+ export declare function releaseTagUrl(version: string): string;
2
+ /** True when `a` is a strictly newer semver than `b` (pre-release suffix ignored). */
3
+ export declare function isNewer(a: string, b: string): boolean;
4
+ export declare function updatedNotice(version: string): string;
5
+ export declare function availableNotice(current: string, latest: string): string;
6
+ /** Fire-and-forget. Synchronous local notice, async npm check that never blocks. */
7
+ export declare function notifyUpdates(currentVersion: string): void;
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Update notifier. This server is run by an MCP client via `npx`, so it cannot
3
+ * relaunch itself; an unpinned `npx` install already picks up the newest
4
+ * published version the next time the client restarts the server. This module
5
+ * just makes that visible: a one-line notice (stderr only, never stdout, which
6
+ * is the JSON-RPC channel) when the running version changed since last time, or
7
+ * when a newer version exists on npm. Everything here is best-effort and
8
+ * fail-silent: a notice must never delay startup or crash the server.
9
+ */
10
+ import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
11
+ import { homedir } from "node:os";
12
+ import { join } from "node:path";
13
+ const PACKAGE = "@omnidim-ai/mcp-server";
14
+ const RELEASES = "https://github.com/Omnidim/omnidim-mcp-server/releases";
15
+ const CONFIG_DIR = join(homedir(), ".config", "omnidim");
16
+ const LAST_VERSION_FILE = join(CONFIG_DIR, "last-version");
17
+ const LAST_CHECK_FILE = join(CONFIG_DIR, "last-update-check");
18
+ const CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000; // throttle the npm check to once a day
19
+ const FETCH_TIMEOUT_MS = 2500;
20
+ export function releaseTagUrl(version) {
21
+ return `${RELEASES}/tag/v${version}`;
22
+ }
23
+ /** True when `a` is a strictly newer semver than `b` (pre-release suffix ignored). */
24
+ export function isNewer(a, b) {
25
+ const parse = (v) => v.split("-")[0].split(".").map((n) => parseInt(n, 10) || 0);
26
+ const [a1, a2, a3] = parse(a);
27
+ const [b1, b2, b3] = parse(b);
28
+ if (a1 !== b1)
29
+ return a1 > b1;
30
+ if (a2 !== b2)
31
+ return a2 > b2;
32
+ return a3 > b3;
33
+ }
34
+ export function updatedNotice(version) {
35
+ return `${PACKAGE} updated to v${version}. What's new: ${releaseTagUrl(version)}`;
36
+ }
37
+ export function availableNotice(current, latest) {
38
+ return `A newer ${PACKAGE} is available: v${latest} (you have v${current}). `
39
+ + `Release notes: ${releaseTagUrl(latest)}. It updates automatically the next time your MCP client restarts.`;
40
+ }
41
+ function readFileSafe(path) {
42
+ try {
43
+ return readFileSync(path, "utf8").trim() || null;
44
+ }
45
+ catch {
46
+ return null;
47
+ }
48
+ }
49
+ function writeFileSafe(path, value) {
50
+ try {
51
+ mkdirSync(CONFIG_DIR, { recursive: true });
52
+ writeFileSync(path, value);
53
+ }
54
+ catch { /* best-effort */ }
55
+ }
56
+ /** Print "just updated to vX" when the stored version differs from the running one. */
57
+ function notifyVersionChanged(current) {
58
+ const stored = readFileSafe(LAST_VERSION_FILE);
59
+ if (stored && stored !== current && isNewer(current, stored)) {
60
+ console.error(updatedNotice(current));
61
+ }
62
+ if (stored !== current)
63
+ writeFileSafe(LAST_VERSION_FILE, current);
64
+ }
65
+ /** Best-effort npm check (throttled, timeout-bounded, opt-out via env). */
66
+ async function notifyNewerAvailable(current) {
67
+ if (process.env.OMNIDIM_NO_UPDATE_CHECK)
68
+ return;
69
+ if (typeof fetch !== "function")
70
+ return;
71
+ const last = readFileSafe(LAST_CHECK_FILE);
72
+ if (last && Date.now() - Number(last) < CHECK_INTERVAL_MS)
73
+ return;
74
+ writeFileSafe(LAST_CHECK_FILE, String(Date.now()));
75
+ try {
76
+ const ctrl = new AbortController();
77
+ const timer = setTimeout(() => ctrl.abort(), FETCH_TIMEOUT_MS);
78
+ const res = await fetch(`https://registry.npmjs.org/${PACKAGE}/latest`, { signal: ctrl.signal });
79
+ clearTimeout(timer);
80
+ if (!res.ok)
81
+ return;
82
+ const latest = (await res.json())?.version;
83
+ if (typeof latest === "string" && isNewer(latest, current)) {
84
+ console.error(availableNotice(current, latest));
85
+ }
86
+ }
87
+ catch { /* offline / timeout / parse error: stay silent */ }
88
+ }
89
+ /** Fire-and-forget. Synchronous local notice, async npm check that never blocks. */
90
+ export function notifyUpdates(currentVersion) {
91
+ try {
92
+ notifyVersionChanged(currentVersion);
93
+ }
94
+ catch { /* never block startup */ }
95
+ void notifyNewerAvailable(currentVersion);
96
+ }
97
+ //# sourceMappingURL=update_notifier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update_notifier.js","sourceRoot":"","sources":["../src/update_notifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,OAAO,GAAG,wBAAwB,CAAC;AACzC,MAAM,QAAQ,GAAG,wDAAwD,CAAC;AAC1E,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AACzD,MAAM,iBAAiB,GAAG,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;AAC3D,MAAM,eAAe,GAAG,IAAI,CAAC,UAAU,EAAE,mBAAmB,CAAC,CAAC;AAC9D,MAAM,iBAAiB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,uCAAuC;AACtF,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAE9B,MAAM,UAAU,aAAa,CAAC,OAAe;IACzC,OAAO,GAAG,QAAQ,SAAS,OAAO,EAAE,CAAC;AACzC,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,OAAO,CAAC,CAAS,EAAE,CAAS;IACxC,MAAM,KAAK,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IACzF,MAAM,CAAC,EAAE,EAAE,EAA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OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;QACpD,CAAC;IACL,CAAC;IAAC,MAAM,CAAC,CAAC,kDAAkD,CAAC,CAAC;AAClE,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,aAAa,CAAC,cAAsB;IAChD,IAAI,CAAC;QAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC,CAAC,yBAAyB,CAAC,CAAC;IACjF,KAAK,oBAAoB,CAAC,cAAc,CAAC,CAAC;AAC9C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnidim-ai/mcp-server",
3
- "version": "0.5.1",
3
+ "version": "0.7.0",
4
4
  "mcpName": "io.github.Omnidim/omnidim-mcp-server",
5
5
  "description": "Official MCP server for OmniDimension. Drive voice agents, dispatch calls, and manage knowledge bases from Claude, Cursor, Windsurf, and any MCP client.",
6
6
  "type": "module",
package/src/index.ts CHANGED
@@ -4,6 +4,9 @@
4
4
  */
5
5
  import { readApiKey } from "./credentials.js";
6
6
  import { isInteractive, printInteractiveHelp, startupBanner, trimLargeResponse } from "./helpers.js";
7
+ import { registerProcedures } from "./procedures.js";
8
+ import { toolAnnotations } from "./tool-annotations.js";
9
+ import { notifyUpdates } from "./update_notifier.js";
7
10
  import { beginSession, emitSessionCrash, emitSessionEnd, endSession, recordToolError, recordToolResult } from "./telemetry.js";
8
11
 
9
12
 
@@ -44,12 +47,9 @@ interface McpToolDefinition {
44
47
  * Server configuration
45
48
  */
46
49
  export const SERVER_NAME = "OmniDimension";
47
- export const SERVER_VERSION = "0.5.0";
48
- // Base URL for the API, can be set via environment variable or determined from OpenAPI spec
49
- export const API_BASE_URL = process.env.API_BASE_URL || "https://backend.omnidim.io/api/v1";
50
- if (process.env.API_BASE_URL) {
51
- console.error(`API_BASE_URL override: ${API_BASE_URL}`);
52
- }
50
+ export const SERVER_VERSION = "0.7.0";
51
+ // Base URL for the API. Pinned to production; not env-overridable.
52
+ export const API_BASE_URL = "https://backend.omnidim.io/api/v1";
53
53
 
54
54
  /**
55
55
  * MCP Server instance
@@ -74,9 +74,12 @@ Conventions:
74
74
 
75
75
  const server = new Server(
76
76
  { name: SERVER_NAME, version: SERVER_VERSION },
77
- { capabilities: { tools: {} }, instructions: SERVER_INSTRUCTIONS }
77
+ { capabilities: { tools: {}, prompts: {}, resources: {} }, instructions: SERVER_INSTRUCTIONS }
78
78
  );
79
79
 
80
+ // Prompts (procedures) and resources (reference) layered on top of the tools.
81
+ registerProcedures(server);
82
+
80
83
  /**
81
84
  * Map of tool definitions by name
82
85
  */
@@ -583,7 +586,8 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
583
586
  const toolsForClient: Tool[] = Array.from(toolDefinitionMap.values()).map(def => ({
584
587
  name: def.name,
585
588
  description: def.description,
586
- inputSchema: def.inputSchema
589
+ inputSchema: def.inputSchema,
590
+ annotations: toolAnnotations(def)
587
591
  }));
588
592
  return { tools: toolsForClient };
589
593
  });
@@ -736,10 +740,10 @@ async function executeApiTool(
736
740
  recordToolResult(toolName, 'validation');
737
741
  if (error instanceof ZodError) {
738
742
  const validationErrorMessage = `Invalid arguments for tool '${toolName}': ${error.errors.map(e => `${e.path.join('.')} (${e.code}): ${e.message}`).join(', ')}`;
739
- return { content: [{ type: 'text', text: validationErrorMessage }] };
743
+ return { isError: true, content: [{ type: 'text', text: validationErrorMessage }] };
740
744
  } else {
741
745
  const errorMessage = error instanceof Error ? error.message : String(error);
742
- return { content: [{ type: 'text', text: `Internal error during validation setup: ${errorMessage}` }] };
746
+ return { isError: true, content: [{ type: 'text', text: `Internal error during validation setup: ${errorMessage}` }] };
743
747
  }
744
748
  }
745
749
 
@@ -917,6 +921,7 @@ async function executeApiTool(
917
921
  else if (definition.securityRequirements?.length > 0) {
918
922
  recordToolResult(toolName, 'no_api_key');
919
923
  return {
924
+ isError: true,
920
925
  content: [{
921
926
  type: 'text',
922
927
  text: `OMNIDIM_API_KEY is not set. Configure it in your MCP client's "env" block, then restart the client. Get a key at https://omnidim.io/api-management.`,
@@ -1010,7 +1015,7 @@ async function executeApiTool(
1010
1015
  console.error(`Error during execution of tool '${toolName}':`, errorMessage);
1011
1016
 
1012
1017
  // Return error message to client
1013
- return { content: [{ type: "text", text: errorMessage }] };
1018
+ return { isError: true, content: [{ type: "text", text: errorMessage }] };
1014
1019
  }
1015
1020
  }
1016
1021
 
@@ -1040,6 +1045,7 @@ async function main() {
1040
1045
  await server.connect(transport);
1041
1046
  console.error(startupBanner(SERVER_VERSION, toolDefinitionMap.size));
1042
1047
  beginSession();
1048
+ notifyUpdates(SERVER_VERSION);
1043
1049
  } catch (error) {
1044
1050
  try { await emitSessionCrash(error); } catch { /* telemetry must never mask the crash */ }
1045
1051
  console.error("Error during server startup:", error);
@@ -0,0 +1,206 @@
1
+ /**
2
+ * Procedure layer: MCP prompts (parameterized procedures) and resources
3
+ * (reference material) that sit on top of the raw API tools. The tools say
4
+ * WHAT can be called; these say which tool to call WHEN, in what order, with
5
+ * which payload shape, and which gotchas to avoid. Every step here was proven
6
+ * against the live API before being written down.
7
+ */
8
+ import type { Server } from "@modelcontextprotocol/sdk/server/index.js";
9
+ import {
10
+ GetPromptRequestSchema,
11
+ ListPromptsRequestSchema,
12
+ ListResourcesRequestSchema,
13
+ ReadResourceRequestSchema,
14
+ } from "@modelcontextprotocol/sdk/types.js";
15
+
16
+ interface PromptArg { name: string; description: string; required?: boolean; }
17
+ interface PromptDef {
18
+ name: string;
19
+ description: string;
20
+ arguments: PromptArg[];
21
+ build: (args: Record<string, string>) => string;
22
+ }
23
+ interface ResourceDef { uri: string; name: string; description: string; mimeType: string; text: string; }
24
+
25
+ /**
26
+ * Cross-cutting routing reference. An agent reads this to learn the platform
27
+ * shape and the non-obvious rules that the per-operation tool schemas do not
28
+ * surface on their own.
29
+ */
30
+ const ROUTING_GUIDE = `# OmniDimension routing guide
31
+
32
+ OmniDimension is a voice AI platform. You create an **agent** (a.k.a. "bot"),
33
+ give it a **phone number** and optionally a **knowledge base**, then place
34
+ **calls** (one-off or as a bulk **campaign**) and read **call logs**.
35
+
36
+ ## How to pick the right tool
37
+
38
+ - "Create / set up an agent that does X" -> the \`provision_agent\` prompt.
39
+ - "Why did calls fail / what happened on a call / summarize calls" -> the
40
+ \`audit_calls\` prompt, then \`listCallLogs\` + \`getCallLog\`.
41
+ - "List / inspect what exists" -> \`listAgents\`, \`listPhoneNumbers\`,
42
+ \`listVoices\`, \`listKnowledgeBaseFiles\`.
43
+ - "Place one call now" -> \`dispatchCall\`. "Call many contacts" -> the bulk
44
+ call tools.
45
+
46
+ ## Rules that are easy to get wrong (proven against the live API)
47
+
48
+ 1. **Write tools wrap their payload in \`requestBody\`.** \`createAgent\`,
49
+ \`updateAgent\`, \`attachPhoneNumber\`, \`dispatchCall\`, etc. all take
50
+ \`{ "requestBody": { ... } }\`. Flat arguments fail validation.
51
+ 2. **Voices: use the \`name\` string as \`voice_id\`.** \`listVoices\` returns
52
+ \`id: null\` for most voices; the usable identifier is the \`name\` field.
53
+ Not every listed voice is synthesizable: an arbitrary one can produce a
54
+ silent call. Prefer a known premade voice and confirm audio on a test call.
55
+ 3. **The agent's numeric \`voice\` field is not used for speech.** It can read
56
+ back as \`false\` on an API-created agent; that is normal. The call handler
57
+ uses \`voice_external_id\` + \`voice_provider\`.
58
+ 4. **Set a transcriber** (e.g. \`deepgram_stream\` / \`nova-3\` / \`en-US\`).
59
+ 5. **\`dispatchCall\` returning \`success: true\` does NOT mean a call
60
+ connected.** It means the request was accepted. Proof of a real call is a
61
+ resulting entry in \`listCallLogs\` whose \`getCallLog\` shows a non-empty
62
+ \`call_conversation\`. Never treat the dispatch response as the outcome.
63
+ 6. **Reading agents:** \`getAgent\` reports \`voice: false\`; read
64
+ \`voice_external_id\` for the configured voice. \`listAgents\` puts the voice
65
+ in the \`voice\` field. Do not report "no voice" from \`getAgent.voice\`.
66
+ 7. **\`listCallLogs\` rows are large** and the response is trimmed if it grows
67
+ past the size cap. Use a small \`pagesize\` (1-3) and fetch detail per row
68
+ with \`getCallLog\`.
69
+ 8. **Outbound \`from_number_id\`:** omit it to use the platform default number.
70
+ A number that cannot reach the destination country yields an accepted
71
+ dispatch but no connected call.
72
+ 9. **IDs flow between calls:** \`createAgent\` -> \`id\` (the agent_id used
73
+ everywhere downstream); \`listPhoneNumbers\` -> \`id\` (used as
74
+ \`phone_number_id\` to attach and as \`from_number_id\` to dispatch).
75
+ 10. **Phone numbers are E.164 with a leading \`+\`** everywhere.
76
+ `;
77
+
78
+ const RESOURCES: ResourceDef[] = [
79
+ {
80
+ uri: "omnidim://guide/routing",
81
+ name: "OmniDimension routing guide",
82
+ description: "Which tool to call when, ID flow between calls, and the non-obvious rules proven against the live API.",
83
+ mimeType: "text/markdown",
84
+ text: ROUTING_GUIDE,
85
+ },
86
+ ];
87
+
88
+ const PROMPTS: PromptDef[] = [
89
+ {
90
+ name: "provision_agent",
91
+ description: "Create a working voice agent end to end: configure it, give it a number, and verify it can place a call and speak.",
92
+ arguments: [
93
+ { name: "purpose", description: "What the agent should do, in plain language (e.g. 'book dental appointments and answer FAQs').", required: true },
94
+ { name: "voice_id", description: "Optional voice name from listVoices. If omitted, use a known premade voice and confirm audio on the test call.", required: false },
95
+ { name: "test_number", description: "Optional E.164 number to place a verification call to after setup (e.g. +15551234567).", required: false },
96
+ ],
97
+ build: (a) => {
98
+ const purpose = a.purpose || "(describe the agent's job)";
99
+ const voiceLine = a.voice_id
100
+ ? `Use voice_id "${a.voice_id}" (the \`name\` from listVoices).`
101
+ : `Call \`listVoices\` and pick a premade voice; use its \`name\` as voice_id. Remember not every listed voice synthesizes, so verify audio on the test call.`;
102
+ const testLine = a.test_number
103
+ ? `5. Place a verification call with \`dispatchCall\` { requestBody: { agent_id, to_number: "${a.test_number}" } } (omit from_number_id to use the default outbound number). Capture the returned requestId.
104
+ 6. Poll \`listCallLogs\` { pagesize: 1 } until a new row appears for ${a.test_number}, then \`getCallLog\` on its id. The call is verified ONLY if \`call_conversation\` is non-empty (the agent actually spoke). A successful dispatch response alone is not proof.`
105
+ : `5. (No test_number given.) Tell the user the agent is configured and offer to place a verification call to a number they control. Until a call log shows a non-empty \`call_conversation\`, do not claim the agent works end to end.`;
106
+ return `Provision a working OmniDimension voice agent for this purpose:
107
+
108
+ "${purpose}"
109
+
110
+ Follow these steps in order. Each write tool wraps its payload in \`requestBody\`.
111
+
112
+ 1. Voice + models: ${voiceLine} A good default model is gpt-4.1-mini.
113
+ 2. Create the agent with \`createAgent\`:
114
+ {
115
+ "requestBody": {
116
+ "name": "<short name>",
117
+ "welcome_message": "<first line the agent speaks>",
118
+ "context_breakdown": [ { "title": "Purpose", "body": "<the agent's instructions, derived from the purpose above>" } ],
119
+ "call_type": "Outgoing",
120
+ "model": { "model": "gpt-4.1-mini", "temperature": 0.5 },
121
+ "voice": { "provider": "eleven_labs", "voice_id": "<voice name>" },
122
+ "transcriber": { "provider": "deepgram_stream", "model": "nova-3", "language": "en-US" }
123
+ }
124
+ }
125
+ Capture the returned \`id\` as agent_id. (\`status\` is always "Completed"; it is not a build signal.)
126
+ 3. Give it a number: \`listPhoneNumbers\` -> pick a number \`id\`. Attach it with
127
+ \`attachPhoneNumber\` { requestBody: { phone_number_id, agent_id } }. If no
128
+ number exists, import one first (importTwilioNumber / importExotelNumber / importSipTrunk).
129
+ 4. Optional knowledge base: \`uploadKnowledgeBaseFile\` then \`attachKnowledgeBaseFiles\` { requestBody: { file_ids, agent_id } }.
130
+ ${testLine}
131
+
132
+ Throughout: phone numbers are E.164 with a leading \`+\`. See the \`omnidim://guide/routing\` resource for the full gotcha list.`;
133
+ },
134
+ },
135
+ {
136
+ name: "audit_calls",
137
+ description: "Review and summarize call logs: find failures, inspect transcripts and sentiment, or audit a specific agent or campaign.",
138
+ arguments: [
139
+ { name: "focus", description: "What to look into, in plain language (e.g. 'why are calls failing', 'summarize today's calls for agent 123').", required: true },
140
+ { name: "agent_id", description: "Optional agent id to filter to (the listAgents / createAgent id).", required: false },
141
+ { name: "call_status", description: "Optional status filter. Note the enum uses a hyphen for no-answer: completed | busy | failed | no-answer.", required: false },
142
+ ],
143
+ build: (a) => {
144
+ const focus = a.focus || "(describe what to look into)";
145
+ const filters: string[] = ["\"pagesize\": 3"];
146
+ if (a.agent_id) filters.push(`"agentid": ${a.agent_id}`);
147
+ if (a.call_status) filters.push(`"call_status": "${a.call_status}"`);
148
+ return `Audit OmniDimension call logs for this question:
149
+
150
+ "${focus}"
151
+
152
+ 1. List recent calls with \`listCallLogs\` { ${filters.join(", ")} }.
153
+ - Keep \`pagesize\` small (1-3). Each row is large and the response is
154
+ trimmed past a size cap, so a big page comes back truncated and unparseable.
155
+ - Filters: \`agentid\` (note: no underscore) for one agent, \`bulk_call_id\`
156
+ for one campaign, \`call_status\` for triage. The status enum uses a hyphen:
157
+ completed | busy | failed | no-answer.
158
+ - Each row carries \`id\`, \`call_status\`, \`sentiment_score\`, cost, and a
159
+ summary. There is no date-range filter; filter by \`time_of_call\`
160
+ (MM/DD/YYYY HH:MM:SS) yourself if needed.
161
+ 2. For each call of interest, call \`getCallLog\` { call_log_id: <row id> } for
162
+ the full transcript (\`call_conversation\`), \`interactions\`,
163
+ \`extracted_variables\`, \`recording_url\`, and per-turn latency/cost.
164
+ Note: an empty \`call_conversation\` means the agent never spoke (a silent
165
+ call), not that the call is missing.
166
+ 3. Summarize the answer to "${focus}": group by status or agent, surface failure
167
+ reasons and low-sentiment calls, and cite specific \`call_log_id\`s.
168
+
169
+ See the \`omnidim://guide/routing\` resource for the full gotcha list.`;
170
+ },
171
+ },
172
+ ];
173
+
174
+ export function getPromptText(name: string, args: Record<string, string> = {}): string | null {
175
+ const p = PROMPTS.find((x) => x.name === name);
176
+ return p ? p.build(args) : null;
177
+ }
178
+ export function getResourceText(uri: string): string | null {
179
+ const r = RESOURCES.find((x) => x.uri === uri);
180
+ return r ? r.text : null;
181
+ }
182
+ export const PROMPT_NAMES = PROMPTS.map((p) => p.name);
183
+ export const RESOURCE_URIS = RESOURCES.map((r) => r.uri);
184
+
185
+ export function registerProcedures(server: Server): void {
186
+ server.setRequestHandler(ListPromptsRequestSchema, async () => ({
187
+ prompts: PROMPTS.map(({ name, description, arguments: args }) => ({ name, description, arguments: args })),
188
+ }));
189
+ server.setRequestHandler(GetPromptRequestSchema, async (request) => {
190
+ const p = PROMPTS.find((x) => x.name === request.params.name);
191
+ if (!p) throw new Error(`Unknown prompt: ${request.params.name}`);
192
+ const args = (request.params.arguments ?? {}) as Record<string, string>;
193
+ return {
194
+ description: p.description,
195
+ messages: [{ role: "user", content: { type: "text", text: p.build(args) } }],
196
+ };
197
+ });
198
+ server.setRequestHandler(ListResourcesRequestSchema, async () => ({
199
+ resources: RESOURCES.map(({ uri, name, description, mimeType }) => ({ uri, name, description, mimeType })),
200
+ }));
201
+ server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
202
+ const r = RESOURCES.find((x) => x.uri === request.params.uri);
203
+ if (!r) throw new Error(`Unknown resource: ${request.params.uri}`);
204
+ return { contents: [{ uri: r.uri, mimeType: r.mimeType, text: r.text }] };
205
+ });
206
+ }
@@ -0,0 +1,86 @@
1
+ // MCP tool annotations: a display title plus read-only / destructive /
2
+ // open-world hints, so clients can parallelize reads and confirm before
3
+ // destructive or real-world actions. Hand-authored (regen-safe); index.ts
4
+ // imports toolAnnotations and applies it in the tools/list handler.
5
+
6
+ // Human-readable display names, separate from the machine `name` the model sees.
7
+ const TOOL_TITLES: Record<string, string> = {
8
+ listAgents: "List agents",
9
+ createAgent: "Create agent",
10
+ getAgent: "Get agent",
11
+ updateAgent: "Update agent",
12
+ deleteAgent: "Delete agent",
13
+ dispatchCall: "Dispatch call",
14
+ listCallLogs: "List call logs",
15
+ getCallLog: "Get call log",
16
+ fetchBulkCalls: "List bulk campaigns",
17
+ createBulkCall: "Create bulk campaign",
18
+ addBulkCallContact: "Add contact to campaign",
19
+ getBulkCall: "Get bulk campaign",
20
+ bulkCallActions: "Control bulk campaign",
21
+ cancelBulkCall: "Cancel bulk campaign",
22
+ getBulkCallLiveStatus: "Get campaign live status",
23
+ listKnowledgeBaseFiles: "List knowledge base files",
24
+ canUploadFile: "Check file upload eligibility",
25
+ uploadKnowledgeBaseFile: "Upload knowledge base file",
26
+ attachKnowledgeBaseFiles: "Attach knowledge base files",
27
+ detachKnowledgeBaseFiles: "Detach knowledge base files",
28
+ deleteKnowledgeBaseFile: "Delete knowledge base file",
29
+ listPhoneNumbers: "List phone numbers",
30
+ attachPhoneNumber: "Attach phone number",
31
+ detachPhoneNumber: "Detach phone number",
32
+ importTwilioNumber: "Import Twilio number",
33
+ importExotelNumber: "Import Exotel number",
34
+ importSipTrunk: "Import SIP trunk",
35
+ listLLMProviders: "List LLM providers",
36
+ listVoices: "List voices",
37
+ listSTTProviders: "List speech-to-text providers",
38
+ listTTSProviders: "List text-to-speech providers",
39
+ listAllProviders: "List all providers",
40
+ getVoice: "Get voice",
41
+ listChildOrganizations: "List child organizations",
42
+ addUser: "Add child user",
43
+ setUserAccessControl: "Set user access control",
44
+ setUserExpiry: "Set user expiry",
45
+ setChildConcurrency: "Set child concurrency limit",
46
+ calculateCreditOperation: "Preview credit operation",
47
+ transferCreditsToChild: "Transfer credits to child",
48
+ revertCreditsFromChild: "Revert credits from child",
49
+ getResellerCreditLogs: "Get reseller credit logs",
50
+ };
51
+
52
+ // POST tools that only validate or preview, with no state change.
53
+ const READ_ONLY_TOOLS = new Set(["canUploadFile", "calculateCreditOperation"]);
54
+
55
+ // Irreversible removals plus tools that place real outbound calls.
56
+ const DESTRUCTIVE_TOOLS = new Set([
57
+ "deleteAgent", "deleteKnowledgeBaseFile", "detachKnowledgeBaseFiles", "detachPhoneNumber",
58
+ "cancelBulkCall", "revertCreditsFromChild", "dispatchCall", "createBulkCall", "addBulkCallContact",
59
+ ]);
60
+
61
+ // Tools that reach the external phone network.
62
+ const OPEN_WORLD_TOOLS = new Set(["dispatchCall", "createBulkCall", "addBulkCallContact"]);
63
+
64
+ export interface ToolAnnotations {
65
+ title?: string;
66
+ readOnlyHint?: boolean;
67
+ destructiveHint?: boolean;
68
+ openWorldHint?: boolean;
69
+ }
70
+
71
+ // Spec defaults are conservative (destructiveHint and openWorldHint default to
72
+ // true), so set every hint explicitly to mark plain writes as safe.
73
+ export function toolAnnotations(def: { name: string; method: string }): ToolAnnotations {
74
+ const annotations: ToolAnnotations = {};
75
+ const title = TOOL_TITLES[def.name];
76
+ if (title) annotations.title = title;
77
+ const readOnly = def.method.toUpperCase() === "GET" || READ_ONLY_TOOLS.has(def.name);
78
+ annotations.readOnlyHint = readOnly;
79
+ if (readOnly) {
80
+ annotations.openWorldHint = false;
81
+ } else {
82
+ annotations.destructiveHint = DESTRUCTIVE_TOOLS.has(def.name);
83
+ annotations.openWorldHint = OPEN_WORLD_TOOLS.has(def.name);
84
+ }
85
+ return annotations;
86
+ }