@omnidim-ai/mcp-server 0.4.2 → 0.5.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/index.ts CHANGED
@@ -4,11 +4,11 @@
4
4
  */
5
5
  import { readApiKey } from "./credentials.js";
6
6
  import { isInteractive, printInteractiveHelp, startupBanner, trimLargeResponse } from "./helpers.js";
7
+ import { beginSession, emitSessionCrash, emitSessionEnd, endSession, recordToolError, recordToolResult } from "./telemetry.js";
7
8
 
8
9
 
9
10
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
10
11
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
11
- import { beginSession, emitSessionCrash, emitSessionEnd, endSession, recordToolError, recordToolResult } from "./telemetry.js";
12
12
  import {
13
13
  CallToolRequestSchema,
14
14
  ListToolsRequestSchema,
@@ -44,7 +44,7 @@ interface McpToolDefinition {
44
44
  * Server configuration
45
45
  */
46
46
  export const SERVER_NAME = "OmniDimension";
47
- export const SERVER_VERSION = "0.2.0";
47
+ export const SERVER_VERSION = "0.5.0";
48
48
  // Base URL for the API, can be set via environment variable or determined from OpenAPI spec
49
49
  export const API_BASE_URL = process.env.API_BASE_URL || "https://backend.omnidim.io/api/v1";
50
50
  if (process.env.API_BASE_URL) {
@@ -63,12 +63,12 @@ Surfaces:
63
63
  - Knowledge base: upload PDFs and attach to agents.
64
64
  - Phone numbers: list, attach to agents, import from Twilio, Exotel, or SIP.
65
65
  - Providers: discover available LLMs, voices, STT, and TTS engines.
66
- - Simulations: run scripted test scenarios against an agent.
67
66
  - Reseller: child organization management (requires partner-level credentials; non-reseller keys get 403).
68
67
 
69
68
  Conventions:
70
69
  - List endpoints accept pageno (>= 1) and pagesize (1-150). Use name to filter.
71
70
  - For details on one item, call get<Resource>(id) after listing.
71
+ - Dispatching calls: run listPhoneNumbers first. If the account has numbers, pass the chosen one as from_number_id. If it has none, omit from_number_id and the platform's default number is used. Never guess a from_number_id.
72
72
  - Configure OMNIDIM_API_KEY in your MCP client config to authenticate.
73
73
  - API reference: https://docs.omnidim.io`;
74
74
 
@@ -99,7 +99,7 @@ config supports transcriber, model, voice, web search, transfer,
99
99
  end-call conditions, post-call actions (email + webhook),
100
100
  ambient background track, initial ringing sound, and multilingual support.
101
101
  `,
102
- inputSchema: {"type":"object","properties":{"requestBody":{"allOf":[{"type":"object","description":"Agent configuration.","properties":{"name":{"type":"string","description":"Name for the agent.","example":"Customer Support Agent"},"welcome_message":{"type":"string","description":"Initial message the agent will say when answering a call.","example":"Hello! How can I help you today?"},"is_welcome_message_interruption":{"type":"boolean","description":"Allow the caller to interrupt the welcome message. When false, the agent finishes speaking the welcome before listening."},"is_interruption_allowed":{"type":"boolean","description":"Global toggle for whether the caller can interrupt the agent mid-sentence at any point in the call."},"dynamic_variables":{"type":"object","description":"Key/value map used to substitute placeholders in the agent's\nprompt and welcome message at call time. Reference a variable\nin your prompt with `{{variable_name}}`. Useful for\npersonalising the same agent across many calls.\n","additionalProperties":{"type":"string"},"example":{"customer_name":"Jane Doe","order_id":"ORD-12345"}},"context_breakdown":{"type":"array","description":"List of context breakdowns, each containing `title`, `body`, and optional `is_enabled`.","items":{"type":"object","required":["title","body"],"properties":{"title":{"type":"string","description":"Title of the breakdown.","example":"Purpose"},"body":{"type":"string","description":"Body of the breakdown — the detailed prompt content.","example":"This agent helps customers with product inquiries and support issues."},"is_enabled":{"type":"boolean","default":true,"description":"Whether this section is included in the prompt."}}}},"call_type":{"type":"string","enum":["Incoming","Outgoing"],"description":"Call type of the assistant."},"transcriber":{"type":"object","description":"Configuration for the speech-to-text transcriber.","properties":{"provider":{"type":"string","enum":["deepgram_stream","cartesia","sarvam","azure_stream","soniox"],"description":"The speech-to-text provider to use.","example":"deepgram_stream"},"model":{"type":"string","enum":["nova-3","nova-2"],"description":"The model to use for transcription (required when provider is `deepgram_stream`).","example":"nova-3"},"language":{"type":"string","description":"Language code for the transcriber. Format and supported\nvalues depend on the provider (e.g. `en-US` for Deepgram,\n`hi-IN` for Sarvam). Applies regardless of which\n`provider` is selected.\n","example":"en-US"},"silence_timeout_ms":{"type":"integer","description":"Silence timeout in milliseconds.","example":400},"should_apply_noise_reduction":{"type":"boolean","description":"Reduce background noise on the inbound audio stream before transcription."},"interruption_min_words":{"type":"integer","minimum":1,"description":"Minimum number of words the caller must say before their speech is treated as an interruption.","example":2},"max_call_duration_in_sec":{"type":"integer","minimum":1,"description":"Hard upper bound on call length in seconds. The agent will end the call once this is reached.","example":600},"first_ideal_message":{"type":"string","description":"First nudge spoken when the caller goes silent past the\nidle threshold. Set `is_first_ideal_message_dynamic` to\n`true` to have the LLM regenerate this each time.\n"},"is_first_ideal_message_dynamic":{"type":"boolean","description":"When true, `first_ideal_message` is treated as a prompt and the LLM generates a fresh nudge each call."},"second_ideal_message":{"type":"string","description":"Second nudge spoken if silence continues after the first."},"is_second_ideal_message_dynamic":{"type":"boolean","description":"When true, `second_ideal_message` is treated as a prompt and the LLM generates a fresh nudge each call."},"numerals":{"type":"boolean","description":"Convert numbers from words to digits."},"punctuate":{"type":"boolean","description":"Add punctuation to the transcript."},"smart_format":{"type":"boolean","description":"Apply smart formatting to the transcript."},"diarize":{"type":"boolean","description":"Identify different speakers in the transcript."}}},"model":{"type":"object","description":"Configuration for the language model.","properties":{"model":{"type":"string","enum":["azure-gpt-4.1-mini","azure-gpt-4.1-nano","azure-gpt-4o","azure-gpt-4o-mini","claude-3-5-haiku-latest","claude-3-5-sonnet-latest","claude-3-7-sonnet-latest","claude-3-opus-latest","claude-opus-4-0","claude-sonnet-4-0","gemini-1.5-pro","gemini-2.0-flash","gemini-2.5-flash","gemini-2.5-flash-lite","gemini-2.5-pro","gemini-3-flash-preview","gemini-3-pro-preview","gemma2-9b-it","gpt-3.5-turbo","gpt-4o","gpt-4o-mini","gpt-5.4","llama-3.3-70b-versatile","llama3-70b-8192","llama3-8b-8192"],"description":"The language model to use.","example":"gpt-4o-mini"},"temperature":{"type":"number","minimum":0,"maximum":1,"description":"Controls randomness in the model's output (0.0 to 1.0).","example":0.7}}},"voice":{"type":"object","description":"Configuration for the text-to-speech voice.","properties":{"provider":{"type":"string","enum":["eleven_labs","deepgram","google","cartesia","rime"],"description":"The voice provider to use.","example":"eleven_labs"},"voice_id":{"type":"string","description":"The specific external voice identifier from the provider.","example":"JBFqnCBsd6RMkjVDRZzb"},"model":{"type":"string","description":"TTS model identifier. Only consumed when `provider` is\n`cartesia` (e.g. `sonic-3.5`). For ElevenLabs and other\nproviders the model is implied by `voice_id` and this\nfield is ignored.\n","example":"sonic-3.5"},"speech_speed":{"type":"number","minimum":0.5,"maximum":2,"default":1,"description":"Playback speed multiplier for the agent's voice. 1.0 is normal speed."}}},"web_search":{"type":"object","description":"Configuration for web search capabilities.","properties":{"enabled":{"type":"boolean","description":"Enable or disable web search functionality."},"provider":{"type":"string","enum":["DuckDuckGo"],"description":"The search provider to use.","example":"DuckDuckGo"}}},"post_call_actions":{"type":"object","description":"Side effects that fire once the call ends. Configure email, webhook, or both.","properties":{"email":{"type":"object","properties":{"enabled":{"type":"boolean"},"recipients":{"type":"array","description":"Email addresses that should receive the notification.","items":{"type":"string","format":"email"},"example":["support@example.com"]},"include":{"type":"array","description":"Which sections to include in the email body.","items":{"type":"string","enum":["summary","extracted_variables","fullConversation","sentiment"]}},"extracted_variables":{"type":"array","description":"Variables the model should pull out of the conversation for the email.","items":{"type":"object","required":["key","prompt"],"properties":{"key":{"type":"string","description":"Unique identifier for the variable in the post-call payload.","example":"customer_issue"},"prompt":{"type":"string","description":"Instruction for the model on what to pull out of the conversation.","example":"Identify the main issue the customer is experiencing."}}}},"trigger_call_statuses":{"type":"array","description":"Call outcomes that should fire this action. Omit to\nuse the default (`completed`, `voicemail_detected`).\nPass an explicit list to also include failed calls,\nno-answers, busy signals, etc.\n","items":{"type":"string","enum":["completed","voicemail_detected","failed","no_answer","busy","cancelled"]},"example":["completed","voicemail_detected"]}}},"webhook":{"type":"object","properties":{"enabled":{"type":"boolean"},"url":{"type":"string","format":"uri","description":"Endpoint that receives a POST with the call payload.","example":"https://your-webhook-endpoint.com/omnidim-callback"},"include":{"type":"array","description":"Which sections to include in the webhook body.","items":{"type":"string","enum":["summary","extracted_variables","fullConversation","sentiment"]}},"extracted_variables":{"type":"array","description":"Variables the model should pull out of the conversation for the webhook.","items":{"type":"object","required":["key","prompt"],"properties":{"key":{"type":"string","description":"Unique identifier for the variable in the post-call payload.","example":"customer_issue"},"prompt":{"type":"string","description":"Instruction for the model on what to pull out of the conversation.","example":"Identify the main issue the customer is experiencing."}}}},"trigger_call_statuses":{"type":"array","description":"Call outcomes that should fire this webhook. Omit to\nuse the default (`completed`, `voicemail_detected`).\n","items":{"type":"string","enum":["completed","voicemail_detected","failed","no_answer","busy","cancelled"]},"example":["completed","failed"]}}}}},"transfer":{"type":"object","description":"Conditional call transfer to a human agent or another number.","properties":{"enabled":{"type":"boolean"},"transfer_options":{"type":"array","description":"Where to transfer the call and under what condition. The first matching condition wins.","items":{"type":"object","required":["number","transfer_condition","transfer_message"],"properties":{"number":{"type":"string","description":"Primary phone number to transfer to. Include country code with leading `+`.","example":"+15551234567"},"type":{"type":"string","enum":["static","dynamic"],"default":"static","description":"`static` transfers to `number`. `dynamic` lets the agent\npick a number at runtime based on the conversation.\n"},"backup_numbers":{"type":"array","description":"Fallback numbers tried if the primary is unreachable.","items":{"type":"string"}},"transfer_condition":{"type":"string","description":"Natural-language condition that triggers this transfer option.","example":"Transfer if the customer asks to speak with a human."},"transfer_message":{"type":"string","description":"Message the agent says to the caller before executing the transfer.","example":"Please hold while I connect you to one of our agents."}}}}}},"end_call":{"type":"object","description":"Hang up automatically when a condition is met.","properties":{"enabled":{"type":"boolean"},"condition":{"type":"string","description":"Natural-language condition that triggers ending the call. Only evaluated when `enabled` is true.","example":"End the call once the customer's issue is resolved."},"message":{"type":"string","description":"What the agent says before hanging up.","example":"Thank you for contacting us. Have a great day!"},"message_type":{"type":"string","enum":["static","prompt"],"description":"`static` speaks `message` verbatim. `prompt` treats\n`message_prompt` as an LLM instruction and generates a\nfresh closing line each call (useful for matching the\ncaller's language and tone).\n"},"message_prompt":{"type":"string","description":"LLM prompt used to generate the closing line when `message_type` is `prompt`.","example":"End the call politely in the same language the user is speaking."}}},"background_track":{"type":"object","description":"Ambient background noise that plays under the agent's voice.","properties":{"enabled":{"type":"boolean","description":"Whether to mix the ambient track under the agent's audio."},"name":{"type":"string","enum":["call_center","filler","office","office_1","restaurant"],"description":"Ambient track to mix under the agent."},"volume":{"type":"number","minimum":0,"maximum":1,"default":0.2,"description":"Volume level on a 0–1 scale. Default 0.2."},"tts_volume_reduction":{"type":"number","minimum":0,"maximum":1,"description":"Amount to drop the agent's TTS volume while the ambient track plays, on a 0–1 scale. Helps the voice cut through without raising the overall mix."}}},"initial_ringing_sound_enabled":{"type":"boolean","description":"Plays a ringing tone after the call is picked up, until the agent starts speaking."},"voicemail":{"type":"object","description":"Voicemail / answering-machine handling for outbound calls.","properties":{"enabled":{"type":"boolean","description":"Detect voicemail and react instead of speaking to a machine."},"message":{"type":"string","description":"Message to leave when voicemail is detected."}}},"languages":{"type":"array","description":"Languages the agent should support. Pass each language as a display-name string.","items":{"type":"string","enum":["English","English (India)","English (US)","Hindi","Bengali","Spanish","Tamil","Marathi","Telugu","Gujarati","French"]},"example":["English","Hindi"]}}},{"type":"object","required":["name","welcome_message","context_breakdown"]}],"description":"The JSON request body."}},"required":["requestBody"]},
102
+ inputSchema: {"type":"object","properties":{"requestBody":{"allOf":[{"type":"object","description":"Agent configuration.","properties":{"name":{"type":"string","description":"Name for the agent.","example":"Customer Support Agent"},"welcome_message":{"type":"string","description":"Initial message the agent will say when answering a call.","example":"Hello! How can I help you today?"},"is_welcome_message_interruption":{"type":"boolean","description":"Allow the caller to interrupt the welcome message. When false, the agent finishes speaking the welcome before listening."},"is_interruption_allowed":{"type":"boolean","description":"Global toggle for whether the caller can interrupt the agent mid-sentence at any point in the call."},"dynamic_variables":{"type":"object","description":"Key/value map used to substitute placeholders in the agent's\nprompt and welcome message at call time. Reference a variable\nin your prompt with `{{variable_name}}`. Useful for\npersonalising the same agent across many calls.\n","additionalProperties":{"type":"string"},"example":{"customer_name":"Jane Doe","order_id":"ORD-12345"}},"context_breakdown":{"type":"array","description":"List of context breakdowns, each containing `title`, `body`, and optional `is_enabled`.","items":{"type":"object","required":["title","body"],"properties":{"title":{"type":"string","description":"Title of the breakdown.","example":"Purpose"},"body":{"type":"string","description":"Body of the breakdown, the detailed prompt content.","example":"This agent helps customers with product inquiries and support issues."},"is_enabled":{"type":"boolean","default":true,"description":"Whether this section is included in the prompt."}}}},"call_type":{"type":"string","enum":["Incoming","Outgoing"],"description":"Call type of the assistant."},"transcriber":{"type":"object","description":"Configuration for the speech-to-text transcriber.","properties":{"provider":{"type":"string","enum":["deepgram_stream","cartesia","sarvam","azure_stream","soniox"],"description":"The speech-to-text provider to use.","example":"deepgram_stream"},"model":{"type":"string","enum":["nova-3","nova-2"],"description":"The model to use for transcription (required when provider is `deepgram_stream`).","example":"nova-3"},"language":{"type":"string","description":"Language code for the transcriber. Format and supported\nvalues depend on the provider (e.g. `en-US` for Deepgram,\n`hi-IN` for Sarvam). Applies regardless of which\n`provider` is selected.\n","example":"en-US"},"silence_timeout_ms":{"type":"integer","description":"Silence timeout in milliseconds.","example":400},"should_apply_noise_reduction":{"type":"boolean","description":"Reduce background noise on the inbound audio stream before transcription."},"interruption_min_words":{"type":"integer","minimum":1,"description":"Minimum number of words the caller must say before their speech is treated as an interruption.","example":2},"max_call_duration_in_sec":{"type":"integer","minimum":1,"description":"Hard upper bound on call length in seconds. The agent will end the call once this is reached.","example":600},"first_ideal_message":{"type":"string","description":"First nudge spoken when the caller goes silent past the\nidle threshold. Set `is_first_ideal_message_dynamic` to\n`true` to have the LLM regenerate this each time.\n"},"is_first_ideal_message_dynamic":{"type":"boolean","description":"When true, `first_ideal_message` is treated as a prompt and the LLM generates a fresh nudge each call."},"second_ideal_message":{"type":"string","description":"Second nudge spoken if silence continues after the first."},"is_second_ideal_message_dynamic":{"type":"boolean","description":"When true, `second_ideal_message` is treated as a prompt and the LLM generates a fresh nudge each call."},"numerals":{"type":"boolean","description":"Convert numbers from words to digits."},"punctuate":{"type":"boolean","description":"Add punctuation to the transcript."},"smart_format":{"type":"boolean","description":"Apply smart formatting to the transcript."},"diarize":{"type":"boolean","description":"Identify different speakers in the transcript."}}},"model":{"type":"object","description":"Configuration for the language model.","properties":{"model":{"type":"string","enum":["azure-gpt-4.1-mini","azure-gpt-4.1-nano","azure-gpt-4o","azure-gpt-4o-mini","gemini-2.5-flash","gemini-2.5-flash-lite","gpt-3.5-turbo","gpt-4.1-mini","gpt-4.1-nano","gpt-4o","gpt-4o-mini","gpt-5.1","llama-3.3-70b-versatile"],"description":"The language model to use. The current catalog is returned by the LLM providers list.","example":"gpt-4.1-mini"},"temperature":{"type":"number","minimum":0,"maximum":1,"description":"Controls randomness in the model's output (0.0 to 1.0).","example":0.7}}},"voice":{"type":"object","description":"Configuration for the text-to-speech voice.","properties":{"provider":{"type":"string","enum":["eleven_labs","google","cartesia","sarvam"],"description":"The voice provider to use. The current catalog is returned by the TTS providers list.","example":"eleven_labs"},"voice_id":{"type":"string","description":"The provider's voice identifier, returned in the `name` field of the voices list (not the numeric `id`).","example":"JBFqnCBsd6RMkjVDRZzb"},"model":{"type":"string","description":"TTS model identifier. Only consumed when `provider` is\n`cartesia` (e.g. `sonic-3.5`). For ElevenLabs and other\nproviders the model is implied by `voice_id` and this\nfield is ignored.\n","example":"sonic-3.5"},"speech_speed":{"type":"number","minimum":0.5,"maximum":2,"default":1,"description":"Playback speed multiplier for the agent's voice. 1.0 is normal speed."}}},"web_search":{"type":"object","description":"Configuration for web search capabilities.","properties":{"enabled":{"type":"boolean","description":"Enable or disable web search functionality."},"provider":{"type":"string","enum":["DuckDuckGo"],"description":"The search provider to use.","example":"DuckDuckGo"}}},"post_call_actions":{"type":"object","description":"Side effects that fire once the call ends. Configure email, webhook, or both.","properties":{"email":{"type":"object","properties":{"enabled":{"type":"boolean"},"recipients":{"type":"array","description":"Email addresses that should receive the notification.","items":{"type":"string","format":"email"},"example":["support@example.com"]},"include":{"type":"array","description":"Which sections to include in the email body.","items":{"type":"string","enum":["summary","extracted_variables","fullConversation","sentiment"]}},"extracted_variables":{"type":"array","description":"Variables the model should pull out of the conversation for the email.","items":{"type":"object","required":["key","prompt"],"properties":{"key":{"type":"string","description":"Unique identifier for the variable in the post-call payload.","example":"customer_issue"},"prompt":{"type":"string","description":"Instruction for the model on what to pull out of the conversation.","example":"Identify the main issue the customer is experiencing."}}}},"trigger_call_statuses":{"type":"array","description":"Call outcomes that should fire this action. Omit to\nuse the default (`completed`, `voicemail_detected`).\nPass an explicit list to also include failed calls,\nno-answers, busy signals, etc.\n","items":{"type":"string","enum":["completed","voicemail_detected","failed","no_answer","busy","cancelled"]},"example":["completed","voicemail_detected"]}}},"webhook":{"type":"object","properties":{"enabled":{"type":"boolean"},"url":{"type":"string","format":"uri","description":"Endpoint that receives a POST with the call payload.","example":"https://your-webhook-endpoint.com/omnidim-callback"},"include":{"type":"array","description":"Which sections to include in the webhook body.","items":{"type":"string","enum":["summary","extracted_variables","fullConversation","sentiment"]}},"extracted_variables":{"type":"array","description":"Variables the model should pull out of the conversation for the webhook.","items":{"type":"object","required":["key","prompt"],"properties":{"key":{"type":"string","description":"Unique identifier for the variable in the post-call payload.","example":"customer_issue"},"prompt":{"type":"string","description":"Instruction for the model on what to pull out of the conversation.","example":"Identify the main issue the customer is experiencing."}}}},"trigger_call_statuses":{"type":"array","description":"Call outcomes that should fire this webhook. Omit to\nuse the default (`completed`, `voicemail_detected`).\n","items":{"type":"string","enum":["completed","voicemail_detected","failed","no_answer","busy","cancelled"]},"example":["completed","failed"]}}}}},"transfer":{"type":"object","description":"Conditional call transfer to a human agent or another number.","properties":{"enabled":{"type":"boolean"},"transfer_options":{"type":"array","description":"Where to transfer the call and under what condition. The first matching condition wins.","items":{"type":"object","required":["number","transfer_condition","transfer_message"],"properties":{"number":{"type":"string","description":"Primary phone number to transfer to. Include country code with leading `+`.","example":"+15551234567"},"type":{"type":"string","enum":["static","dynamic"],"default":"static","description":"`static` transfers to `number`. `dynamic` lets the agent\npick a number at runtime based on the conversation.\n"},"backup_numbers":{"type":"array","description":"Fallback numbers tried if the primary is unreachable.","items":{"type":"string"}},"transfer_condition":{"type":"string","description":"Natural-language condition that triggers this transfer option.","example":"Transfer if the customer asks to speak with a human."},"transfer_message":{"type":"string","description":"Message the agent says to the caller before executing the transfer.","example":"Please hold while I connect you to one of our agents."}}}}}},"end_call":{"type":"object","description":"Hang up automatically when a condition is met.","properties":{"enabled":{"type":"boolean"},"condition":{"type":"string","description":"Natural-language condition that triggers ending the call. Only evaluated when `enabled` is true.","example":"End the call once the customer's issue is resolved."},"message":{"type":"string","description":"What the agent says before hanging up.","example":"Thank you for contacting us. Have a great day!"},"message_type":{"type":"string","enum":["static","prompt"],"description":"`static` speaks `message` verbatim. `prompt` treats\n`message_prompt` as an LLM instruction and generates a\nfresh closing line each call (useful for matching the\ncaller's language and tone).\n"},"message_prompt":{"type":"string","description":"LLM prompt used to generate the closing line when `message_type` is `prompt`.","example":"End the call politely in the same language the user is speaking."}}},"background_track":{"type":"object","description":"Ambient background noise that plays under the agent's voice.","properties":{"enabled":{"type":"boolean","description":"Whether to mix the ambient track under the agent's audio."},"name":{"type":"string","enum":["call_center","filler","office","office_1","restaurant"],"description":"Ambient track to mix under the agent."},"volume":{"type":"number","minimum":0,"maximum":1,"default":0.2,"description":"Volume level on a 0–1 scale. Default 0.2."},"tts_volume_reduction":{"type":"number","minimum":0,"maximum":1,"description":"Amount to drop the agent's TTS volume while the ambient track plays, on a 0–1 scale. Helps the voice cut through without raising the overall mix."}}},"initial_ringing_sound_enabled":{"type":"boolean","description":"Plays a ringing tone after the call is picked up, until the agent starts speaking."},"voicemail":{"type":"object","description":"Voicemail / answering-machine handling for outbound calls.","properties":{"enabled":{"type":"boolean","description":"Detect voicemail and react instead of speaking to a machine."},"message":{"type":"string","description":"Message to leave when voicemail is detected."}}},"languages":{"type":"array","description":"Languages the agent should support. Pass each language as a display-name string exactly as it appears in the dashboard's language picker. Unrecognized names are skipped.","items":{"type":"string"},"example":["English (India)","Hindi"]}}},{"type":"object","required":["name","welcome_message","context_breakdown"]}],"description":"The JSON request body."}},"required":["requestBody"]},
103
103
  method: "post",
104
104
  pathTemplate: "/agents/create",
105
105
  executionParameters: [],
@@ -119,7 +119,7 @@ ambient background track, initial ringing sound, and multilingual support.
119
119
  ["updateAgent", {
120
120
  name: "updateAgent",
121
121
  description: `Update an existing agent. Send only the fields you want to change.`,
122
- inputSchema: {"type":"object","properties":{"agent_id":{"type":"number","description":"The ID of the agent."},"requestBody":{"type":"object","description":"Agent configuration.","properties":{"name":{"type":"string","description":"Name for the agent."},"welcome_message":{"type":"string","description":"Initial message the agent will say when answering a call."},"is_welcome_message_interruption":{"type":"boolean","description":"Allow the caller to interrupt the welcome message. When false, the agent finishes speaking the welcome before listening."},"is_interruption_allowed":{"type":"boolean","description":"Global toggle for whether the caller can interrupt the agent mid-sentence at any point in the call."},"dynamic_variables":{"type":"object","description":"Key/value map used to substitute placeholders in the agent's\nprompt and welcome message at call time. Reference a variable\nin your prompt with `{{variable_name}}`. Useful for\npersonalising the same agent across many calls.\n","additionalProperties":{"type":"string"}},"context_breakdown":{"type":"array","description":"List of context breakdowns, each containing `title`, `body`, and optional `is_enabled`.","items":{"type":"object","required":["title","body"],"properties":{"title":{"type":"string","description":"Title of the breakdown."},"body":{"type":"string","description":"Body of the breakdown — the detailed prompt content."},"is_enabled":{"type":"boolean","default":true,"description":"Whether this section is included in the prompt."}}}},"call_type":{"type":"string","enum":["Incoming","Outgoing"],"description":"Call type of the assistant."},"transcriber":{"type":"object","description":"Configuration for the speech-to-text transcriber.","properties":{"provider":{"type":"string","enum":["deepgram_stream","cartesia","sarvam","azure_stream","soniox"],"description":"The speech-to-text provider to use."},"model":{"type":"string","enum":["nova-3","nova-2"],"description":"The model to use for transcription (required when provider is `deepgram_stream`)."},"language":{"type":"string","description":"Language code for the transcriber. Format and supported\nvalues depend on the provider (e.g. `en-US` for Deepgram,\n`hi-IN` for Sarvam). Applies regardless of which\n`provider` is selected.\n"},"silence_timeout_ms":{"type":"number","description":"Silence timeout in milliseconds."},"should_apply_noise_reduction":{"type":"boolean","description":"Reduce background noise on the inbound audio stream before transcription."},"interruption_min_words":{"type":"number","minimum":1,"description":"Minimum number of words the caller must say before their speech is treated as an interruption."},"max_call_duration_in_sec":{"type":"number","minimum":1,"description":"Hard upper bound on call length in seconds. The agent will end the call once this is reached."},"first_ideal_message":{"type":"string","description":"First nudge spoken when the caller goes silent past the\nidle threshold. Set `is_first_ideal_message_dynamic` to\n`true` to have the LLM regenerate this each time.\n"},"is_first_ideal_message_dynamic":{"type":"boolean","description":"When true, `first_ideal_message` is treated as a prompt and the LLM generates a fresh nudge each call."},"second_ideal_message":{"type":"string","description":"Second nudge spoken if silence continues after the first."},"is_second_ideal_message_dynamic":{"type":"boolean","description":"When true, `second_ideal_message` is treated as a prompt and the LLM generates a fresh nudge each call."},"numerals":{"type":"boolean","description":"Convert numbers from words to digits."},"punctuate":{"type":"boolean","description":"Add punctuation to the transcript."},"smart_format":{"type":"boolean","description":"Apply smart formatting to the transcript."},"diarize":{"type":"boolean","description":"Identify different speakers in the transcript."}}},"model":{"type":"object","description":"Configuration for the language model.","properties":{"model":{"type":"string","enum":["azure-gpt-4.1-mini","azure-gpt-4.1-nano","azure-gpt-4o","azure-gpt-4o-mini","claude-3-5-haiku-latest","claude-3-5-sonnet-latest","claude-3-7-sonnet-latest","claude-3-opus-latest","claude-opus-4-0","claude-sonnet-4-0","gemini-1.5-pro","gemini-2.0-flash","gemini-2.5-flash","gemini-2.5-flash-lite","gemini-2.5-pro","gemini-3-flash-preview","gemini-3-pro-preview","gemma2-9b-it","gpt-3.5-turbo","gpt-4o","gpt-4o-mini","gpt-5.4","llama-3.3-70b-versatile","llama3-70b-8192","llama3-8b-8192"],"description":"The language model to use."},"temperature":{"type":"number","minimum":0,"maximum":1,"description":"Controls randomness in the model's output (0.0 to 1.0)."}}},"voice":{"type":"object","description":"Configuration for the text-to-speech voice.","properties":{"provider":{"type":"string","enum":["eleven_labs","deepgram","google","cartesia","rime"],"description":"The voice provider to use."},"voice_id":{"type":"string","description":"The specific external voice identifier from the provider."},"model":{"type":"string","description":"TTS model identifier. Only consumed when `provider` is\n`cartesia` (e.g. `sonic-3.5`). For ElevenLabs and other\nproviders the model is implied by `voice_id` and this\nfield is ignored.\n"},"speech_speed":{"type":"number","minimum":0.5,"maximum":2,"default":1,"description":"Playback speed multiplier for the agent's voice. 1.0 is normal speed."}}},"web_search":{"type":"object","description":"Configuration for web search capabilities.","properties":{"enabled":{"type":"boolean","description":"Enable or disable web search functionality."},"provider":{"type":"string","enum":["DuckDuckGo"],"description":"The search provider to use."}}},"post_call_actions":{"type":"object","description":"Side effects that fire once the call ends. Configure email, webhook, or both.","properties":{"email":{"type":"object","properties":{"enabled":{"type":"boolean"},"recipients":{"type":"array","description":"Email addresses that should receive the notification.","items":{"type":"string","format":"email"}},"include":{"type":"array","description":"Which sections to include in the email body.","items":{"type":"string","enum":["summary","extracted_variables","fullConversation","sentiment"]}},"extracted_variables":{"type":"array","description":"Variables the model should pull out of the conversation for the email.","items":{"type":"object","required":["key","prompt"],"properties":{"key":{"type":"string","description":"Unique identifier for the variable in the post-call payload."},"prompt":{"type":"string","description":"Instruction for the model on what to pull out of the conversation."}}}},"trigger_call_statuses":{"type":"array","description":"Call outcomes that should fire this action. Omit to\nuse the default (`completed`, `voicemail_detected`).\nPass an explicit list to also include failed calls,\nno-answers, busy signals, etc.\n","items":{"type":"string","enum":["completed","voicemail_detected","failed","no_answer","busy","cancelled"]}}}},"webhook":{"type":"object","properties":{"enabled":{"type":"boolean"},"url":{"type":"string","format":"uri","description":"Endpoint that receives a POST with the call payload."},"include":{"type":"array","description":"Which sections to include in the webhook body.","items":{"type":"string","enum":["summary","extracted_variables","fullConversation","sentiment"]}},"extracted_variables":{"type":"array","description":"Variables the model should pull out of the conversation for the webhook.","items":{"type":"object","required":["key","prompt"],"properties":{"key":{"type":"string","description":"Unique identifier for the variable in the post-call payload."},"prompt":{"type":"string","description":"Instruction for the model on what to pull out of the conversation."}}}},"trigger_call_statuses":{"type":"array","description":"Call outcomes that should fire this webhook. Omit to\nuse the default (`completed`, `voicemail_detected`).\n","items":{"type":"string","enum":["completed","voicemail_detected","failed","no_answer","busy","cancelled"]}}}}}},"transfer":{"type":"object","description":"Conditional call transfer to a human agent or another number.","properties":{"enabled":{"type":"boolean"},"transfer_options":{"type":"array","description":"Where to transfer the call and under what condition. The first matching condition wins.","items":{"type":"object","required":["number","transfer_condition","transfer_message"],"properties":{"number":{"type":"string","description":"Primary phone number to transfer to. Include country code with leading `+`."},"type":{"type":"string","enum":["static","dynamic"],"default":"static","description":"`static` transfers to `number`. `dynamic` lets the agent\npick a number at runtime based on the conversation.\n"},"backup_numbers":{"type":"array","description":"Fallback numbers tried if the primary is unreachable.","items":{"type":"string"}},"transfer_condition":{"type":"string","description":"Natural-language condition that triggers this transfer option."},"transfer_message":{"type":"string","description":"Message the agent says to the caller before executing the transfer."}}}}}},"end_call":{"type":"object","description":"Hang up automatically when a condition is met.","properties":{"enabled":{"type":"boolean"},"condition":{"type":"string","description":"Natural-language condition that triggers ending the call. Only evaluated when `enabled` is true."},"message":{"type":"string","description":"What the agent says before hanging up."},"message_type":{"type":"string","enum":["static","prompt"],"description":"`static` speaks `message` verbatim. `prompt` treats\n`message_prompt` as an LLM instruction and generates a\nfresh closing line each call (useful for matching the\ncaller's language and tone).\n"},"message_prompt":{"type":"string","description":"LLM prompt used to generate the closing line when `message_type` is `prompt`."}}},"background_track":{"type":"object","description":"Ambient background noise that plays under the agent's voice.","properties":{"enabled":{"type":"boolean","description":"Whether to mix the ambient track under the agent's audio."},"name":{"type":"string","enum":["call_center","filler","office","office_1","restaurant"],"description":"Ambient track to mix under the agent."},"volume":{"type":"number","minimum":0,"maximum":1,"default":0.2,"description":"Volume level on a 0–1 scale. Default 0.2."},"tts_volume_reduction":{"type":"number","minimum":0,"maximum":1,"description":"Amount to drop the agent's TTS volume while the ambient track plays, on a 0–1 scale. Helps the voice cut through without raising the overall mix."}}},"initial_ringing_sound_enabled":{"type":"boolean","description":"Plays a ringing tone after the call is picked up, until the agent starts speaking."},"voicemail":{"type":"object","description":"Voicemail / answering-machine handling for outbound calls.","properties":{"enabled":{"type":"boolean","description":"Detect voicemail and react instead of speaking to a machine."},"message":{"type":"string","description":"Message to leave when voicemail is detected."}}},"languages":{"type":"array","description":"Languages the agent should support. Pass each language as a display-name string.","items":{"type":"string","enum":["English","English (India)","English (US)","Hindi","Bengali","Spanish","Tamil","Marathi","Telugu","Gujarati","French"]}}}}},"required":["agent_id","requestBody"]},
122
+ inputSchema: {"type":"object","properties":{"agent_id":{"type":"number","description":"The ID of the agent."},"requestBody":{"type":"object","description":"Agent configuration.","properties":{"name":{"type":"string","description":"Name for the agent."},"welcome_message":{"type":"string","description":"Initial message the agent will say when answering a call."},"is_welcome_message_interruption":{"type":"boolean","description":"Allow the caller to interrupt the welcome message. When false, the agent finishes speaking the welcome before listening."},"is_interruption_allowed":{"type":"boolean","description":"Global toggle for whether the caller can interrupt the agent mid-sentence at any point in the call."},"dynamic_variables":{"type":"object","description":"Key/value map used to substitute placeholders in the agent's\nprompt and welcome message at call time. Reference a variable\nin your prompt with `{{variable_name}}`. Useful for\npersonalising the same agent across many calls.\n","additionalProperties":{"type":"string"}},"context_breakdown":{"type":"array","description":"List of context breakdowns, each containing `title`, `body`, and optional `is_enabled`.","items":{"type":"object","required":["title","body"],"properties":{"title":{"type":"string","description":"Title of the breakdown."},"body":{"type":"string","description":"Body of the breakdown, the detailed prompt content."},"is_enabled":{"type":"boolean","default":true,"description":"Whether this section is included in the prompt."}}}},"call_type":{"type":"string","enum":["Incoming","Outgoing"],"description":"Call type of the assistant."},"transcriber":{"type":"object","description":"Configuration for the speech-to-text transcriber.","properties":{"provider":{"type":"string","enum":["deepgram_stream","cartesia","sarvam","azure_stream","soniox"],"description":"The speech-to-text provider to use."},"model":{"type":"string","enum":["nova-3","nova-2"],"description":"The model to use for transcription (required when provider is `deepgram_stream`)."},"language":{"type":"string","description":"Language code for the transcriber. Format and supported\nvalues depend on the provider (e.g. `en-US` for Deepgram,\n`hi-IN` for Sarvam). Applies regardless of which\n`provider` is selected.\n"},"silence_timeout_ms":{"type":"number","description":"Silence timeout in milliseconds."},"should_apply_noise_reduction":{"type":"boolean","description":"Reduce background noise on the inbound audio stream before transcription."},"interruption_min_words":{"type":"number","minimum":1,"description":"Minimum number of words the caller must say before their speech is treated as an interruption."},"max_call_duration_in_sec":{"type":"number","minimum":1,"description":"Hard upper bound on call length in seconds. The agent will end the call once this is reached."},"first_ideal_message":{"type":"string","description":"First nudge spoken when the caller goes silent past the\nidle threshold. Set `is_first_ideal_message_dynamic` to\n`true` to have the LLM regenerate this each time.\n"},"is_first_ideal_message_dynamic":{"type":"boolean","description":"When true, `first_ideal_message` is treated as a prompt and the LLM generates a fresh nudge each call."},"second_ideal_message":{"type":"string","description":"Second nudge spoken if silence continues after the first."},"is_second_ideal_message_dynamic":{"type":"boolean","description":"When true, `second_ideal_message` is treated as a prompt and the LLM generates a fresh nudge each call."},"numerals":{"type":"boolean","description":"Convert numbers from words to digits."},"punctuate":{"type":"boolean","description":"Add punctuation to the transcript."},"smart_format":{"type":"boolean","description":"Apply smart formatting to the transcript."},"diarize":{"type":"boolean","description":"Identify different speakers in the transcript."}}},"model":{"type":"object","description":"Configuration for the language model.","properties":{"model":{"type":"string","enum":["azure-gpt-4.1-mini","azure-gpt-4.1-nano","azure-gpt-4o","azure-gpt-4o-mini","gemini-2.5-flash","gemini-2.5-flash-lite","gpt-3.5-turbo","gpt-4.1-mini","gpt-4.1-nano","gpt-4o","gpt-4o-mini","gpt-5.1","llama-3.3-70b-versatile"],"description":"The language model to use. The current catalog is returned by the LLM providers list."},"temperature":{"type":"number","minimum":0,"maximum":1,"description":"Controls randomness in the model's output (0.0 to 1.0)."}}},"voice":{"type":"object","description":"Configuration for the text-to-speech voice.","properties":{"provider":{"type":"string","enum":["eleven_labs","google","cartesia","sarvam"],"description":"The voice provider to use. The current catalog is returned by the TTS providers list."},"voice_id":{"type":"string","description":"The provider's voice identifier, returned in the `name` field of the voices list (not the numeric `id`)."},"model":{"type":"string","description":"TTS model identifier. Only consumed when `provider` is\n`cartesia` (e.g. `sonic-3.5`). For ElevenLabs and other\nproviders the model is implied by `voice_id` and this\nfield is ignored.\n"},"speech_speed":{"type":"number","minimum":0.5,"maximum":2,"default":1,"description":"Playback speed multiplier for the agent's voice. 1.0 is normal speed."}}},"web_search":{"type":"object","description":"Configuration for web search capabilities.","properties":{"enabled":{"type":"boolean","description":"Enable or disable web search functionality."},"provider":{"type":"string","enum":["DuckDuckGo"],"description":"The search provider to use."}}},"post_call_actions":{"type":"object","description":"Side effects that fire once the call ends. Configure email, webhook, or both.","properties":{"email":{"type":"object","properties":{"enabled":{"type":"boolean"},"recipients":{"type":"array","description":"Email addresses that should receive the notification.","items":{"type":"string","format":"email"}},"include":{"type":"array","description":"Which sections to include in the email body.","items":{"type":"string","enum":["summary","extracted_variables","fullConversation","sentiment"]}},"extracted_variables":{"type":"array","description":"Variables the model should pull out of the conversation for the email.","items":{"type":"object","required":["key","prompt"],"properties":{"key":{"type":"string","description":"Unique identifier for the variable in the post-call payload."},"prompt":{"type":"string","description":"Instruction for the model on what to pull out of the conversation."}}}},"trigger_call_statuses":{"type":"array","description":"Call outcomes that should fire this action. Omit to\nuse the default (`completed`, `voicemail_detected`).\nPass an explicit list to also include failed calls,\nno-answers, busy signals, etc.\n","items":{"type":"string","enum":["completed","voicemail_detected","failed","no_answer","busy","cancelled"]}}}},"webhook":{"type":"object","properties":{"enabled":{"type":"boolean"},"url":{"type":"string","format":"uri","description":"Endpoint that receives a POST with the call payload."},"include":{"type":"array","description":"Which sections to include in the webhook body.","items":{"type":"string","enum":["summary","extracted_variables","fullConversation","sentiment"]}},"extracted_variables":{"type":"array","description":"Variables the model should pull out of the conversation for the webhook.","items":{"type":"object","required":["key","prompt"],"properties":{"key":{"type":"string","description":"Unique identifier for the variable in the post-call payload."},"prompt":{"type":"string","description":"Instruction for the model on what to pull out of the conversation."}}}},"trigger_call_statuses":{"type":"array","description":"Call outcomes that should fire this webhook. Omit to\nuse the default (`completed`, `voicemail_detected`).\n","items":{"type":"string","enum":["completed","voicemail_detected","failed","no_answer","busy","cancelled"]}}}}}},"transfer":{"type":"object","description":"Conditional call transfer to a human agent or another number.","properties":{"enabled":{"type":"boolean"},"transfer_options":{"type":"array","description":"Where to transfer the call and under what condition. The first matching condition wins.","items":{"type":"object","required":["number","transfer_condition","transfer_message"],"properties":{"number":{"type":"string","description":"Primary phone number to transfer to. Include country code with leading `+`."},"type":{"type":"string","enum":["static","dynamic"],"default":"static","description":"`static` transfers to `number`. `dynamic` lets the agent\npick a number at runtime based on the conversation.\n"},"backup_numbers":{"type":"array","description":"Fallback numbers tried if the primary is unreachable.","items":{"type":"string"}},"transfer_condition":{"type":"string","description":"Natural-language condition that triggers this transfer option."},"transfer_message":{"type":"string","description":"Message the agent says to the caller before executing the transfer."}}}}}},"end_call":{"type":"object","description":"Hang up automatically when a condition is met.","properties":{"enabled":{"type":"boolean"},"condition":{"type":"string","description":"Natural-language condition that triggers ending the call. Only evaluated when `enabled` is true."},"message":{"type":"string","description":"What the agent says before hanging up."},"message_type":{"type":"string","enum":["static","prompt"],"description":"`static` speaks `message` verbatim. `prompt` treats\n`message_prompt` as an LLM instruction and generates a\nfresh closing line each call (useful for matching the\ncaller's language and tone).\n"},"message_prompt":{"type":"string","description":"LLM prompt used to generate the closing line when `message_type` is `prompt`."}}},"background_track":{"type":"object","description":"Ambient background noise that plays under the agent's voice.","properties":{"enabled":{"type":"boolean","description":"Whether to mix the ambient track under the agent's audio."},"name":{"type":"string","enum":["call_center","filler","office","office_1","restaurant"],"description":"Ambient track to mix under the agent."},"volume":{"type":"number","minimum":0,"maximum":1,"default":0.2,"description":"Volume level on a 0–1 scale. Default 0.2."},"tts_volume_reduction":{"type":"number","minimum":0,"maximum":1,"description":"Amount to drop the agent's TTS volume while the ambient track plays, on a 0–1 scale. Helps the voice cut through without raising the overall mix."}}},"initial_ringing_sound_enabled":{"type":"boolean","description":"Plays a ringing tone after the call is picked up, until the agent starts speaking."},"voicemail":{"type":"object","description":"Voicemail / answering-machine handling for outbound calls.","properties":{"enabled":{"type":"boolean","description":"Detect voicemail and react instead of speaking to a machine."},"message":{"type":"string","description":"Message to leave when voicemail is detected."}}},"languages":{"type":"array","description":"Languages the agent should support. Pass each language as a display-name string exactly as it appears in the dashboard's language picker. Unrecognized names are skipped.","items":{"type":"string"}}}}},"required":["agent_id","requestBody"]},
123
123
  method: "put",
124
124
  pathTemplate: "/agents/{agent_id}",
125
125
  executionParameters: [{"name":"agent_id","in":"path"}],
@@ -141,7 +141,7 @@ ambient background track, initial ringing sound, and multilingual support.
141
141
  description: `Initiate a call to a phone number using a specified agent. The
142
142
  phone number must include a country code with a leading plus.
143
143
  `,
144
- inputSchema: {"type":"object","properties":{"requestBody":{"type":"object","required":["agent_id","to_number"],"properties":{"agent_id":{"type":"number","description":"The ID of the agent that will handle the call."},"to_number":{"type":"string","description":"The phone number to call. Must include country code (e.g., +15551234567)."},"from_number_id":{"type":"number","description":"The imported phone number id to call."},"call_context":{"type":"object","description":"Optional context information as key-value pairs to be passed to the agent during the call. Can contain any custom fields relevant to your use case.","additionalProperties":true}},"description":"The JSON request body."}},"required":["requestBody"]},
144
+ inputSchema: {"type":"object","properties":{"requestBody":{"type":"object","required":["agent_id","to_number"],"properties":{"agent_id":{"type":"number","description":"The ID of the agent that will handle the call."},"to_number":{"type":"string","description":"The phone number to call. Must include country code (e.g., +15551234567)."},"from_number_id":{"type":"number","description":"Id of a phone number on your account to place the call from (see the phone number list endpoint). Omit to use the platform's default number."},"call_context":{"type":"object","description":"Optional context information as key-value pairs to be passed to the agent during the call. Can contain any custom fields relevant to your use case.","additionalProperties":true}},"description":"The JSON request body."}},"required":["requestBody"]},
145
145
  method: "post",
146
146
  pathTemplate: "/calls/dispatch",
147
147
  executionParameters: [],
@@ -151,7 +151,7 @@ phone number must include a country code with a leading plus.
151
151
  ["listCallLogs", {
152
152
  name: "listCallLogs",
153
153
  description: `Retrieve call logs with pagination and optional filtering.`,
154
- inputSchema: {"type":"object","properties":{"pageno":{"type":"integer","minimum":1,"default":1,"description":"Page number for pagination."},"pagesize":{"type":"integer","minimum":1,"default":30,"maximum":150,"description":"Number of items per page."},"agentid":{"type":"number","description":"Filter by agent ID."},"call_status":{"type":"string","enum":["completed","busy","failed","no-answer"]},"bulk_call_id":{"type":"number","description":"Filter by bulk-call campaign ID."}}},
154
+ inputSchema: {"type":"object","properties":{"pageno":{"type":"integer","minimum":1,"default":1,"description":"Page number for pagination."},"pagesize":{"type":"integer","minimum":1,"default":30,"maximum":150,"description":"Number of items per page."},"agentid":{"type":"number","description":"Filter by agent ID."},"call_status":{"type":"string","enum":["completed","busy","failed","no-answer"],"description":"Filter by call outcome."},"bulk_call_id":{"type":"number","description":"Filter by bulk-call campaign ID."}}},
155
155
  method: "get",
156
156
  pathTemplate: "/calls/logs",
157
157
  executionParameters: [{"name":"pageno","in":"query"},{"name":"pagesize","in":"query"},{"name":"agentid","in":"query"},{"name":"call_status","in":"query"},{"name":"bulk_call_id","in":"query"}],
@@ -161,7 +161,7 @@ phone number must include a country code with a leading plus.
161
161
  ["getCallLog", {
162
162
  name: "getCallLog",
163
163
  description: `Detailed information about a specific call (duration, status, transcript, sentiment, extracted variables).`,
164
- inputSchema: {"type":"object","properties":{"call_log_id":{"type":"number"}},"required":["call_log_id"]},
164
+ inputSchema: {"type":"object","properties":{"call_log_id":{"type":"number","description":"Id of the call log, as returned by the call log list."}},"required":["call_log_id"]},
165
165
  method: "get",
166
166
  pathTemplate: "/calls/logs/{call_log_id}",
167
167
  executionParameters: [{"name":"call_log_id","in":"path"}],
@@ -171,7 +171,7 @@ phone number must include a country code with a leading plus.
171
171
  ["fetchBulkCalls", {
172
172
  name: "fetchBulkCalls",
173
173
  description: `List bulk-call campaigns with pagination and optional status filter.`,
174
- inputSchema: {"type":"object","properties":{"pageno":{"type":"integer","minimum":1,"default":1},"pagesize":{"type":"integer","minimum":1,"default":10,"maximum":150,"description":"Items per page (max 150 — sending more returns 500)."},"status":{"type":"string","description":"Filter by status (e.g. completed)."}}},
174
+ inputSchema: {"type":"object","properties":{"pageno":{"type":"integer","minimum":1,"default":1,"description":"Page number for pagination."},"pagesize":{"type":"integer","minimum":1,"default":10,"maximum":150,"description":"Items per page (max 150)."},"status":{"type":"string","description":"Filter by status (e.g. completed)."}}},
175
175
  method: "get",
176
176
  pathTemplate: "/calls/bulk_call",
177
177
  executionParameters: [{"name":"pageno","in":"query"},{"name":"pagesize","in":"query"},{"name":"status","in":"query"}],
@@ -180,18 +180,48 @@ phone number must include a country code with a leading plus.
180
180
  }],
181
181
  ["createBulkCall", {
182
182
  name: "createBulkCall",
183
- description: `Create a new bulk-call campaign. Supports immediate, scheduled, and auto-retry modes.`,
184
- inputSchema: {"type":"object","properties":{"requestBody":{"type":"object","required":["name","contact_list","phone_number_id"],"properties":{"name":{"type":"string","description":"Name of the bulk call campaign."},"phone_number_id":{"type":"string","description":"Your phone number id to use for making calls."},"contact_list":{"type":"array","minItems":1,"description":"Array of contact objects. Each row needs `phone_number`.\nAny other key you add on the row (e.g. `customer_name`,\n`account_id`, `priority`) is passed to the agent as a\ncontext variable for that specific call, so the agent\ncan reference it during the conversation.\n","items":{"type":"object","required":["phone_number"],"properties":{"phone_number":{"type":"string","description":"Phone number in international format (e.g., +15551234567)."}},"additionalProperties":true}},"is_scheduled":{"type":"boolean","default":false,"description":"Whether the campaign should be scheduled for future execution."},"scheduled_datetime":{"type":"string","description":"Scheduled execution time in format `YYYY-MM-DD HH:MM:SS` (required if `is_scheduled` is true)."},"timezone":{"type":"string","default":"UTC","description":"Timezone for scheduled execution."},"concurrent_call_limit":{"type":"number","default":1,"minimum":1,"description":"Maximum number of concurrent calls allowed."},"enabled_reschedule_call":{"type":"boolean","default":false,"description":"Enable automatic call rescheduling. When enabled the system can reschedule unreachable calls."},"retry_config":{"type":"object","description":"Auto-retry configuration object containing retry settings.","properties":{"auto_retry":{"type":"boolean","default":false},"auto_retry_schedule":{"type":"string","enum":["immediately","next_day","scheduled_time"],"description":"When to retry failed calls."},"retry_schedule_days":{"type":"number","default":0,"minimum":0,"description":"Days to wait before a scheduled retry."},"retry_schedule_hours":{"type":"number","default":0,"minimum":0,"description":"Hours to wait before a scheduled retry."},"retry_limit":{"type":"number","default":0,"minimum":0,"maximum":5,"description":"Maximum number of retry attempts (0–5)."}}}},"description":"The JSON request body."}},"required":["requestBody"]},
183
+ description: `Create a new bulk-call campaign. Supports immediate, scheduled,
184
+ and auto-retry modes.
185
+
186
+ There are two kinds of campaign:
187
+
188
+ - **Static** (default): you supply the full \`contact_list\` up
189
+ front and the campaign dials through it.
190
+ - **Dynamic**: set \`is_dynamic\` to \`true\` and the campaign accepts
191
+ contacts in real time via the Add contact to dynamic campaign
192
+ webhook. \`contact_list\` is optional here, so you can start the
193
+ campaign empty and feed it from a CRM, form, or automation. A
194
+ dynamic campaign stays alive waiting for contacts instead of
195
+ completing when its queue drains.
196
+ `,
197
+ inputSchema: {"type":"object","properties":{"requestBody":{"type":"object","required":["name","phone_number_id"],"properties":{"name":{"type":"string","description":"Name of the bulk call campaign."},"phone_number_id":{"type":"string","description":"Your phone number id to use for making calls."},"is_dynamic":{"type":"boolean","default":false,"description":"Set to `true` to create a dynamic campaign that accepts\ncontacts in real time via the Add contact to dynamic\ncampaign webhook. When `true`, `contact_list` is optional\nand may be omitted to start the campaign empty.\n"},"contact_list":{"type":"array","description":"Array of contact objects. Each row needs `phone_number`.\nAny other key you add on the row (e.g. `customer_name`,\n`account_id`, `priority`) is passed to the agent as a\ncontext variable for that specific call, so the agent\ncan reference it during the conversation.\n\nRequired for static campaigns. Optional when `is_dynamic`\nis `true` (you can omit it and add contacts later via the\nwebhook).\n","items":{"type":"object","required":["phone_number"],"properties":{"phone_number":{"type":"string","description":"Phone number in international format (e.g., +15551234567)."}},"additionalProperties":true}},"is_scheduled":{"type":"boolean","default":false,"description":"Whether the campaign should be scheduled for future execution."},"scheduled_datetime":{"type":"string","description":"Scheduled execution time in format `YYYY-MM-DD HH:MM:SS` (required if `is_scheduled` is true)."},"timezone":{"type":"string","default":"UTC","description":"Timezone for scheduled execution."},"concurrent_call_limit":{"type":"number","default":1,"minimum":1,"description":"Maximum number of concurrent calls allowed."},"enabled_reschedule_call":{"type":"boolean","default":false,"description":"Enable automatic call rescheduling. When enabled the system can reschedule unreachable calls."},"retry_config":{"type":"object","description":"Auto-retry configuration object containing retry settings.","properties":{"auto_retry":{"type":"boolean","default":false},"auto_retry_schedule":{"type":"string","enum":["immediately","next_day","scheduled_time"],"description":"When to retry failed calls."},"retry_schedule_days":{"type":"number","default":0,"minimum":0,"description":"Days to wait before a scheduled retry."},"retry_schedule_hours":{"type":"number","default":0,"minimum":0,"description":"Hours to wait before a scheduled retry."},"retry_limit":{"type":"number","default":0,"minimum":0,"maximum":5,"description":"Maximum number of retry attempts (0–5)."}}}},"description":"The JSON request body."}},"required":["requestBody"]},
185
198
  method: "post",
186
199
  pathTemplate: "/calls/bulk_call/create",
187
200
  executionParameters: [],
188
201
  requestBodyContentType: "application/json",
189
202
  securityRequirements: [{"BearerAuth":[]}]
190
203
  }],
204
+ ["addBulkCallContact", {
205
+ name: "addBulkCallContact",
206
+ description: `Push a single contact into a dynamic bulk-call campaign in real
207
+ time. Dynamic campaigns are created from the dashboard (Bulk Call
208
+ > Create New Campaign > Dynamic Campaign) and stay alive waiting
209
+ for contacts, so this webhook is how you feed them from a CRM,
210
+ form, or automation platform. The contact is queued immediately,
211
+ and the campaign starts calling it as soon as it is within
212
+ operating hours.
213
+ `,
214
+ inputSchema: {"type":"object","properties":{"campaign_id":{"type":"number","description":"ID of the dynamic campaign to add the contact to."},"requestBody":{"type":"object","required":["to_number"],"properties":{"to_number":{"type":"string","description":"Contact phone number in international format (e.g., +15551234567)."},"custom_variables":{"type":"object","description":"Key-value pairs passed to the agent as context for this\ncall, so the agent can reference them during the\nconversation (e.g. the contact's name or reason for the\ncall). Match these keys to the variables used in your\nagent's welcome message or prompt.\n","additionalProperties":true},"metadata":{"type":"object","description":"Key-value pairs stored on the contact for your own\ntracking (e.g. CRM or lead IDs). Not shared with the\nagent.\n","additionalProperties":true}},"description":"The JSON request body."}},"required":["campaign_id","requestBody"]},
215
+ method: "post",
216
+ pathTemplate: "/calls/bulk_call/{campaign_id}/add_contact",
217
+ executionParameters: [{"name":"campaign_id","in":"path"}],
218
+ requestBodyContentType: "application/json",
219
+ securityRequirements: [{"BearerAuth":[]}]
220
+ }],
191
221
  ["getBulkCall", {
192
222
  name: "getBulkCall",
193
223
  description: `Get detailed information about a bulk-call campaign.`,
194
- inputSchema: {"type":"object","properties":{"bulk_call_id":{"type":"number"}},"required":["bulk_call_id"]},
224
+ inputSchema: {"type":"object","properties":{"bulk_call_id":{"type":"number","description":"Id of the bulk call campaign."}},"required":["bulk_call_id"]},
195
225
  method: "get",
196
226
  pathTemplate: "/calls/bulk_call/{bulk_call_id}",
197
227
  executionParameters: [{"name":"bulk_call_id","in":"path"}],
@@ -201,7 +231,7 @@ phone number must include a country code with a leading plus.
201
231
  ["bulkCallActions", {
202
232
  name: "bulkCallActions",
203
233
  description: `Pause, resume, or reschedule a running campaign.`,
204
- inputSchema: {"type":"object","properties":{"bulk_call_id":{"type":"number"},"requestBody":{"type":"object","required":["action"],"properties":{"action":{"type":"string","enum":["pause","resume","reschedule"],"description":"What to do with the campaign."},"new_scheduled_datetime":{"type":"string","description":"New start time for `reschedule`. Format `YYYY-MM-DD HH:MM:SS`."},"new_timezone":{"type":"string","description":"IANA timezone for `reschedule`."}},"description":"The JSON request body."}},"required":["bulk_call_id","requestBody"]},
234
+ inputSchema: {"type":"object","properties":{"bulk_call_id":{"type":"number","description":"Id of the bulk call campaign."},"requestBody":{"type":"object","required":["action"],"properties":{"action":{"type":"string","enum":["pause","resume","reschedule"],"description":"What to do with the campaign."},"new_scheduled_datetime":{"type":"string","description":"New start time for `reschedule`. Format `YYYY-MM-DD HH:MM:SS`."},"new_timezone":{"type":"string","description":"IANA timezone for `reschedule`."}},"description":"The JSON request body."}},"required":["bulk_call_id","requestBody"]},
205
235
  method: "put",
206
236
  pathTemplate: "/calls/bulk_call/{bulk_call_id}",
207
237
  executionParameters: [{"name":"bulk_call_id","in":"path"}],
@@ -211,7 +241,7 @@ phone number must include a country code with a leading plus.
211
241
  ["cancelBulkCall", {
212
242
  name: "cancelBulkCall",
213
243
  description: `Cancel a bulk-call campaign.`,
214
- inputSchema: {"type":"object","properties":{"bulk_call_id":{"type":"number"}},"required":["bulk_call_id"]},
244
+ inputSchema: {"type":"object","properties":{"bulk_call_id":{"type":"number","description":"Id of the bulk call campaign."}},"required":["bulk_call_id"]},
215
245
  method: "delete",
216
246
  pathTemplate: "/calls/bulk_call/{bulk_call_id}",
217
247
  executionParameters: [{"name":"bulk_call_id","in":"path"}],
@@ -221,7 +251,7 @@ phone number must include a country code with a leading plus.
221
251
  ["getBulkCallLiveStatus", {
222
252
  name: "getBulkCallLiveStatus",
223
253
  description: `Real-time status of a running bulk-call campaign.`,
224
- inputSchema: {"type":"object","properties":{"bulk_call_id":{"type":"number"}},"required":["bulk_call_id"]},
254
+ inputSchema: {"type":"object","properties":{"bulk_call_id":{"type":"number","description":"Id of the bulk call campaign."}},"required":["bulk_call_id"]},
225
255
  method: "get",
226
256
  pathTemplate: "/bulk-call/{bulk_call_id}/live-status",
227
257
  executionParameters: [{"name":"bulk_call_id","in":"path"}],
@@ -291,7 +321,7 @@ phone number must include a country code with a leading plus.
291
321
  ["listPhoneNumbers", {
292
322
  name: "listPhoneNumbers",
293
323
  description: `Retrieve all phone numbers associated with your account.`,
294
- inputSchema: {"type":"object","properties":{"pageno":{"type":"integer","minimum":1,"default":1},"pagesize":{"type":"integer","minimum":1,"default":30,"maximum":150}}},
324
+ inputSchema: {"type":"object","properties":{"pageno":{"type":"integer","minimum":1,"default":1,"description":"Page number for pagination."},"pagesize":{"type":"integer","minimum":1,"default":30,"maximum":150,"description":"Items per page (max 150)."}}},
295
325
  method: "get",
296
326
  pathTemplate: "/phone_number/list",
297
327
  executionParameters: [{"name":"pageno","in":"query"},{"name":"pagesize","in":"query"}],
@@ -404,93 +434,13 @@ Other providers support basic pagination only.
404
434
  ["getVoice", {
405
435
  name: "getVoice",
406
436
  description: `Detailed metadata for a specific voice.`,
407
- inputSchema: {"type":"object","properties":{"voice_id":{"type":"number"}},"required":["voice_id"]},
437
+ inputSchema: {"type":"object","properties":{"voice_id":{"type":"number","description":"Numeric id of the voice, as returned in the `id` field of the voices list."}},"required":["voice_id"]},
408
438
  method: "get",
409
439
  pathTemplate: "/providers/voice/{voice_id}",
410
440
  executionParameters: [{"name":"voice_id","in":"path"}],
411
441
  requestBodyContentType: undefined,
412
442
  securityRequirements: [{"BearerAuth":[]}]
413
443
  }],
414
- ["listSimulations", {
415
- name: "listSimulations",
416
- description: `Retrieve simulations with pagination.`,
417
- inputSchema: {"type":"object","properties":{"pageno":{"type":"integer","minimum":1,"default":1},"pagesize":{"type":"integer","minimum":1,"default":10,"maximum":150}}},
418
- method: "get",
419
- pathTemplate: "/simulations",
420
- executionParameters: [{"name":"pageno","in":"query"},{"name":"pagesize","in":"query"}],
421
- requestBodyContentType: undefined,
422
- securityRequirements: [{"BearerAuth":[]}]
423
- }],
424
- ["createSimulation", {
425
- name: "createSimulation",
426
- description: `Create a new test simulation with scenarios.`,
427
- inputSchema: {"type":"object","properties":{"requestBody":{"type":"object","required":["name","agent_id"],"properties":{"name":{"type":"string","description":"Name of the simulation."},"agent_id":{"type":"number","description":"ID of the agent to test."},"number_of_call_to_make":{"type":"number","default":1,"minimum":1,"maximum":3,"description":"Number of calls to make per scenario (default 1, max 3)."},"concurrent_call_count":{"type":"number","default":3,"minimum":1,"maximum":3,"description":"Number of concurrent calls to run (default 3, max 3)."},"max_call_duration_in_minutes":{"type":"number","default":3,"minimum":1,"maximum":10,"description":"Maximum duration for each call in minutes (default 3, max 10)."},"scenarios":{"type":"array","description":"List of test scenarios to execute.","items":{"type":"object","required":["name","description","expected_result"],"properties":{"name":{"type":"string","description":"Name of the test scenario."},"description":{"type":"string","description":"Detailed instructions for the test scenario."},"expected_result":{"type":"string","description":"Expected outcome or behavior from the agent."},"selected_voices":{"type":"array","description":"Voice configurations for the test calls. If multiple voices are selected, the agent randomly picks one per call per scenario.","items":{"type":"object","required":["id","provider"],"properties":{"id":{"type":"string","description":"Voice ID from the provider."},"provider":{"type":"string","enum":["eleven_labs","play_ht","deepgram","cartesia","rime"]}}}}}}}},"description":"The JSON request body."}},"required":["requestBody"]},
428
- method: "post",
429
- pathTemplate: "/simulations",
430
- executionParameters: [],
431
- requestBodyContentType: "application/json",
432
- securityRequirements: [{"BearerAuth":[]}]
433
- }],
434
- ["getSimulation", {
435
- name: "getSimulation",
436
- description: `Detailed simulation information.`,
437
- inputSchema: {"type":"object","properties":{"simulation_id":{"type":"number"}},"required":["simulation_id"]},
438
- method: "get",
439
- pathTemplate: "/simulations/{simulation_id}",
440
- executionParameters: [{"name":"simulation_id","in":"path"}],
441
- requestBodyContentType: undefined,
442
- securityRequirements: [{"BearerAuth":[]}]
443
- }],
444
- ["updateSimulation", {
445
- name: "updateSimulation",
446
- description: `Update an existing simulation. Pass the full \`scenarios\` array (existing entries you want to keep plus any changes).`,
447
- inputSchema: {"type":"object","properties":{"simulation_id":{"type":"number"},"requestBody":{"type":"object","properties":{"name":{"type":"string","description":"Name of the simulation for identification."},"agent_id":{"type":"number","description":"ID of the agent to test."},"number_of_call_to_make":{"type":"number","minimum":1,"maximum":3,"description":"Number of calls to make per scenario (default 1, max 3)."},"concurrent_call_count":{"type":"number","minimum":1,"maximum":3,"description":"Number of concurrent calls to run (default 3, max 3)."},"max_call_duration_in_minutes":{"type":"number","minimum":1,"maximum":10,"description":"Maximum duration for each call in minutes (default 3, max 10)."},"scenarios":{"type":"array","description":"Full scenario list. Include existing scenarios you want to keep, plus any new or updated ones.","items":{"type":"object","required":["name","description","expected_result"],"properties":{"id":{"type":"number","description":"Include this to update an existing scenario; omit it to add a new one."},"name":{"type":"string","description":"Name of the test scenario."},"description":{"type":"string","description":"Updated instructions for the test scenario."},"expected_result":{"type":"string","description":"Updated expected outcome from the agent."},"selected_voices":{"type":"array","description":"Updated voice configurations for the test calls.","items":{"type":"object","required":["id","provider"],"properties":{"id":{"type":"string","description":"Voice ID from the provider."},"provider":{"type":"string","enum":["eleven_labs","play_ht","deepgram","cartesia","rime"]}}}}}}}},"description":"The JSON request body."}},"required":["simulation_id","requestBody"]},
448
- method: "put",
449
- pathTemplate: "/simulations/{simulation_id}",
450
- executionParameters: [{"name":"simulation_id","in":"path"}],
451
- requestBodyContentType: "application/json",
452
- securityRequirements: [{"BearerAuth":[]}]
453
- }],
454
- ["deleteSimulation", {
455
- name: "deleteSimulation",
456
- description: `Permanently delete a simulation.`,
457
- inputSchema: {"type":"object","properties":{"simulation_id":{"type":"number"}},"required":["simulation_id"]},
458
- method: "delete",
459
- pathTemplate: "/simulations/{simulation_id}",
460
- executionParameters: [{"name":"simulation_id","in":"path"}],
461
- requestBodyContentType: undefined,
462
- securityRequirements: [{"BearerAuth":[]}]
463
- }],
464
- ["startSimulation", {
465
- name: "startSimulation",
466
- description: `Begin running a simulation. Optionally update scenarios at start time (same shape as Update simulation).`,
467
- inputSchema: {"type":"object","properties":{"simulation_id":{"type":"number"},"requestBody":{"type":"object","properties":{"scenarios":{"type":"array","description":"Optional array of scenarios to update before starting.","items":{"type":"object","required":["name","description","expected_result"],"properties":{"id":{"type":"number","description":"Include this to update an existing scenario; omit it to add a new one."},"name":{"type":"string"},"description":{"type":"string","description":"Updated instructions for the test scenario."},"expected_result":{"type":"string","description":"Updated expected outcome from the agent."},"selected_voices":{"type":"array","description":"Updated voice configurations for the test calls.","items":{"type":"object","required":["id","provider"],"properties":{"id":{"type":"string","description":"Voice ID from the provider."},"provider":{"type":"string","enum":["eleven_labs","play_ht","deepgram","cartesia","rime"]}}}}}}}},"description":"The JSON request body."}},"required":["simulation_id"]},
468
- method: "post",
469
- pathTemplate: "/simulations/{simulation_id}/start",
470
- executionParameters: [{"name":"simulation_id","in":"path"}],
471
- requestBodyContentType: "application/json",
472
- securityRequirements: [{"BearerAuth":[]}]
473
- }],
474
- ["stopSimulation", {
475
- name: "stopSimulation",
476
- description: `Stop a running simulation.`,
477
- inputSchema: {"type":"object","properties":{"simulation_id":{"type":"number"}},"required":["simulation_id"]},
478
- method: "post",
479
- pathTemplate: "/simulations/{simulation_id}/stop",
480
- executionParameters: [{"name":"simulation_id","in":"path"}],
481
- requestBodyContentType: undefined,
482
- securityRequirements: [{"BearerAuth":[]}]
483
- }],
484
- ["enhancePrompt", {
485
- name: "enhancePrompt",
486
- description: `Generate prompt-improvement suggestions for a completed simulation.`,
487
- inputSchema: {"type":"object","properties":{"simulation_id":{"type":"number"}},"required":["simulation_id"]},
488
- method: "post",
489
- pathTemplate: "/simulations/{simulation_id}/enhance-prompt",
490
- executionParameters: [{"name":"simulation_id","in":"path"}],
491
- requestBodyContentType: undefined,
492
- securityRequirements: [{"BearerAuth":[]}]
493
- }],
494
444
  ["listChildOrganizations", {
495
445
  name: "listChildOrganizations",
496
446
  description: `List all child organizations and their users under the reseller
@@ -1029,13 +979,13 @@ async function executeApiTool(
1029
979
 
1030
980
  // Return formatted response
1031
981
  recordToolResult(toolName, 'ok');
1032
- return {
1033
- content: [
1034
- {
1035
- type: "text",
1036
- text: `API Response (Status: ${response.status}):\n${responseText}`
1037
- }
1038
- ],
982
+ return {
983
+ content: [
984
+ {
985
+ type: "text",
986
+ text: `API Response (Status: ${response.status}):\n${responseText}`
987
+ }
988
+ ],
1039
989
  };
1040
990
 
1041
991
  } catch (error: unknown) {
@@ -1114,8 +1064,6 @@ async function cleanup() {
1114
1064
  process.on('SIGINT', cleanup);
1115
1065
  process.on('SIGTERM', cleanup);
1116
1066
 
1117
- // A crash never runs the graceful-shutdown path, so flush a session_crash
1118
- // (with the session's tool-call summary) before exiting.
1119
1067
  process.on('uncaughtException', async (error) => {
1120
1068
  try { await emitSessionCrash(error); } catch { /* never mask the crash */ }
1121
1069
  console.error("Uncaught exception:", error);
package/src/logger.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { appendFileSync, existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
1
+ import { appendFileSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
2
2
  import { homedir } from "node:os";
3
3
  import { join } from "node:path";
4
4
 
@@ -39,19 +39,22 @@ export function appendLog(fields: LogFields): void {
39
39
  // grow without bound on a long-lived or repeatedly-failing install.
40
40
  function trimIfLarge(): void {
41
41
  try {
42
- if (!existsSync(LOG_PATH) || statSync(LOG_PATH).size <= MAX_BYTES) return;
43
- const lines = readFileSync(LOG_PATH, "utf8").split("\n");
42
+ // Read once and act on the result rather than stat-then-read, which
43
+ // races (the file can change between the two syscalls).
44
+ const data = readFileSync(LOG_PATH, "utf8");
45
+ if (Buffer.byteLength(data) <= MAX_BYTES) return;
46
+ const lines = data.split("\n");
44
47
  writeFileSync(LOG_PATH, lines.slice(Math.floor(lines.length / 2)).join("\n"), { mode: 0o600 });
45
48
  } catch {
46
- // ignore
49
+ // ignore (file missing or unreadable)
47
50
  }
48
51
  }
49
52
 
50
53
  export function readLogTail(maxLines = 25): string[] {
51
54
  try {
52
- if (!existsSync(LOG_PATH)) return [];
53
55
  return readFileSync(LOG_PATH, "utf8").trimEnd().split("\n").filter(Boolean).slice(-maxLines);
54
56
  } catch {
57
+ // missing or unreadable log
55
58
  return [];
56
59
  }
57
60
  }
package/src/telemetry.ts CHANGED
@@ -37,10 +37,10 @@ export function telemetryStatus(): { disabled: boolean; reason: string } {
37
37
 
38
38
  function loadOrCreateInstallId(): string {
39
39
  try {
40
- if (existsSync(INSTALL_ID_PATH)) {
41
- const v = readFileSync(INSTALL_ID_PATH, "utf8").trim();
42
- if (v.length >= 8 && v.length <= 64) return v;
43
- }
40
+ // Read directly and let a missing file throw, rather than
41
+ // exists-then-read, which races against a concurrent write.
42
+ const v = readFileSync(INSTALL_ID_PATH, "utf8").trim();
43
+ if (v.length >= 8 && v.length <= 64) return v;
44
44
  } catch {
45
45
  // fall through to create a fresh one
46
46
  }