@speakai/mcp-server 1.26.0 → 1.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +83 -2
- package/dist/index.js +1224 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7556,6 +7556,1158 @@ var init_dashboards = __esm({
|
|
|
7556
7556
|
}
|
|
7557
7557
|
});
|
|
7558
7558
|
|
|
7559
|
+
// src/tools/voice.ts
|
|
7560
|
+
var voice_exports = {};
|
|
7561
|
+
__export(voice_exports, {
|
|
7562
|
+
register: () => register17
|
|
7563
|
+
});
|
|
7564
|
+
function register17(server, client) {
|
|
7565
|
+
const api = client ?? speakClient;
|
|
7566
|
+
registerSpeakTool(
|
|
7567
|
+
server,
|
|
7568
|
+
"list_voice_agents",
|
|
7569
|
+
"List the voice agents in the company (newest first). Each agent includes its agentId, name, personality/instructions, and voice/stt/llm/avatar configuration. Use the returned agentId with get_voice_agent or to filter list_voice_conversations.",
|
|
7570
|
+
{},
|
|
7571
|
+
{
|
|
7572
|
+
title: "List Voice Agents",
|
|
7573
|
+
readOnlyHint: true,
|
|
7574
|
+
destructiveHint: false,
|
|
7575
|
+
idempotentHint: true,
|
|
7576
|
+
openWorldHint: false
|
|
7577
|
+
},
|
|
7578
|
+
async () => {
|
|
7579
|
+
try {
|
|
7580
|
+
const result = await api.get("/v1/voice/agents");
|
|
7581
|
+
return {
|
|
7582
|
+
content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }]
|
|
7583
|
+
};
|
|
7584
|
+
} catch (err) {
|
|
7585
|
+
return {
|
|
7586
|
+
content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }],
|
|
7587
|
+
isError: true
|
|
7588
|
+
};
|
|
7589
|
+
}
|
|
7590
|
+
}
|
|
7591
|
+
);
|
|
7592
|
+
registerSpeakTool(
|
|
7593
|
+
server,
|
|
7594
|
+
"get_voice_agent",
|
|
7595
|
+
"Fetch a single voice agent by its agentId. Returns the full agent configuration. A cross-company agentId returns 404.",
|
|
7596
|
+
{
|
|
7597
|
+
agentId: import_zod18.z.string().min(1).describe("ID of the voice agent (from list_voice_agents)")
|
|
7598
|
+
},
|
|
7599
|
+
{
|
|
7600
|
+
title: "Get Voice Agent",
|
|
7601
|
+
readOnlyHint: true,
|
|
7602
|
+
destructiveHint: false,
|
|
7603
|
+
idempotentHint: true,
|
|
7604
|
+
openWorldHint: false
|
|
7605
|
+
},
|
|
7606
|
+
async ({ agentId }) => {
|
|
7607
|
+
try {
|
|
7608
|
+
const result = await api.get(`/v1/voice/agents/${agentId}`);
|
|
7609
|
+
return {
|
|
7610
|
+
content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }]
|
|
7611
|
+
};
|
|
7612
|
+
} catch (err) {
|
|
7613
|
+
return {
|
|
7614
|
+
content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }],
|
|
7615
|
+
isError: true
|
|
7616
|
+
};
|
|
7617
|
+
}
|
|
7618
|
+
}
|
|
7619
|
+
);
|
|
7620
|
+
registerSpeakTool(
|
|
7621
|
+
server,
|
|
7622
|
+
"list_voice_conversations",
|
|
7623
|
+
"List the company's voice conversations (newest first). Optionally filter to a single agent. Each conversation includes its conversationId, agentId, status, duration, transcript summary, and usage/costs. Use conversationId with get_voice_conversation for the full record.",
|
|
7624
|
+
{
|
|
7625
|
+
agentId: import_zod18.z.string().optional().describe("Filter conversations to a single agent (from list_voice_agents)"),
|
|
7626
|
+
page: import_zod18.z.number().int().min(1).optional().describe("1-based page index (default 1)"),
|
|
7627
|
+
limit: import_zod18.z.number().int().min(1).max(200).optional().describe("Results per page (default 50, max 200)")
|
|
7628
|
+
},
|
|
7629
|
+
{
|
|
7630
|
+
title: "List Voice Conversations",
|
|
7631
|
+
readOnlyHint: true,
|
|
7632
|
+
destructiveHint: false,
|
|
7633
|
+
idempotentHint: true,
|
|
7634
|
+
openWorldHint: false
|
|
7635
|
+
},
|
|
7636
|
+
async (params) => {
|
|
7637
|
+
try {
|
|
7638
|
+
const result = await api.get("/v1/voice/conversations", { params });
|
|
7639
|
+
return {
|
|
7640
|
+
content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }]
|
|
7641
|
+
};
|
|
7642
|
+
} catch (err) {
|
|
7643
|
+
return {
|
|
7644
|
+
content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }],
|
|
7645
|
+
isError: true
|
|
7646
|
+
};
|
|
7647
|
+
}
|
|
7648
|
+
}
|
|
7649
|
+
);
|
|
7650
|
+
registerSpeakTool(
|
|
7651
|
+
server,
|
|
7652
|
+
"get_voice_conversation",
|
|
7653
|
+
"Fetch a single voice conversation by its conversationId, including transcript, usage, costs, and analysis. A cross-company conversationId returns 404.",
|
|
7654
|
+
{
|
|
7655
|
+
conversationId: import_zod18.z.string().min(1).describe("ID of the conversation (from list_voice_conversations)")
|
|
7656
|
+
},
|
|
7657
|
+
{
|
|
7658
|
+
title: "Get Voice Conversation",
|
|
7659
|
+
readOnlyHint: true,
|
|
7660
|
+
destructiveHint: false,
|
|
7661
|
+
idempotentHint: true,
|
|
7662
|
+
openWorldHint: false
|
|
7663
|
+
},
|
|
7664
|
+
async ({ conversationId }) => {
|
|
7665
|
+
try {
|
|
7666
|
+
const result = await api.get(`/v1/voice/conversations/${conversationId}`);
|
|
7667
|
+
return {
|
|
7668
|
+
content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }]
|
|
7669
|
+
};
|
|
7670
|
+
} catch (err) {
|
|
7671
|
+
return {
|
|
7672
|
+
content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }],
|
|
7673
|
+
isError: true
|
|
7674
|
+
};
|
|
7675
|
+
}
|
|
7676
|
+
}
|
|
7677
|
+
);
|
|
7678
|
+
registerSpeakTool(
|
|
7679
|
+
server,
|
|
7680
|
+
"create_voice_agent",
|
|
7681
|
+
"Create a voice agent. Requires the OWNER or ADMIN role. name, personality, instructions, and voice (provider + voiceId) are required; everything else can be set now or later with update_voice_agent. Call list_voice_avatars or list_voices first to get valid ids.",
|
|
7682
|
+
voiceInputSchema,
|
|
7683
|
+
{
|
|
7684
|
+
title: "Create Voice Agent",
|
|
7685
|
+
readOnlyHint: false,
|
|
7686
|
+
destructiveHint: false,
|
|
7687
|
+
idempotentHint: false,
|
|
7688
|
+
openWorldHint: false
|
|
7689
|
+
},
|
|
7690
|
+
async (body) => {
|
|
7691
|
+
try {
|
|
7692
|
+
const result = await api.post("/v1/voice/agents", body);
|
|
7693
|
+
return {
|
|
7694
|
+
content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }]
|
|
7695
|
+
};
|
|
7696
|
+
} catch (err) {
|
|
7697
|
+
return {
|
|
7698
|
+
content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }],
|
|
7699
|
+
isError: true
|
|
7700
|
+
};
|
|
7701
|
+
}
|
|
7702
|
+
}
|
|
7703
|
+
);
|
|
7704
|
+
registerSpeakTool(
|
|
7705
|
+
server,
|
|
7706
|
+
"update_voice_agent",
|
|
7707
|
+
"Update a voice agent. Requires the OWNER or ADMIN role. Send only the fields you want to change; agentId, companyId, and userId are immutable and silently dropped if sent.",
|
|
7708
|
+
{
|
|
7709
|
+
agentId: import_zod18.z.string().min(1).describe("ID of the voice agent to update (from list_voice_agents)"),
|
|
7710
|
+
...Object.fromEntries(
|
|
7711
|
+
Object.entries(voiceInputSchema).map(([key, schema]) => [key, schema.optional()])
|
|
7712
|
+
)
|
|
7713
|
+
},
|
|
7714
|
+
{
|
|
7715
|
+
title: "Update Voice Agent",
|
|
7716
|
+
readOnlyHint: false,
|
|
7717
|
+
destructiveHint: false,
|
|
7718
|
+
idempotentHint: false,
|
|
7719
|
+
openWorldHint: false
|
|
7720
|
+
},
|
|
7721
|
+
async ({ agentId, ...body }) => {
|
|
7722
|
+
try {
|
|
7723
|
+
const result = await api.put(`/v1/voice/agents/${agentId}`, body);
|
|
7724
|
+
return {
|
|
7725
|
+
content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }]
|
|
7726
|
+
};
|
|
7727
|
+
} catch (err) {
|
|
7728
|
+
return {
|
|
7729
|
+
content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }],
|
|
7730
|
+
isError: true
|
|
7731
|
+
};
|
|
7732
|
+
}
|
|
7733
|
+
}
|
|
7734
|
+
);
|
|
7735
|
+
registerSpeakTool(
|
|
7736
|
+
server,
|
|
7737
|
+
"list_voice_avatars",
|
|
7738
|
+
"List the video avatars available to attach to a voice agent (your company's own uploads plus the shared system catalog). Use the returned avatarId with create_voice_agent or update_voice_agent.",
|
|
7739
|
+
{},
|
|
7740
|
+
{
|
|
7741
|
+
title: "List Voice Avatars",
|
|
7742
|
+
readOnlyHint: true,
|
|
7743
|
+
destructiveHint: false,
|
|
7744
|
+
idempotentHint: true,
|
|
7745
|
+
openWorldHint: false
|
|
7746
|
+
},
|
|
7747
|
+
async () => {
|
|
7748
|
+
try {
|
|
7749
|
+
const result = await api.get("/v1/voice/avatars");
|
|
7750
|
+
return {
|
|
7751
|
+
content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }]
|
|
7752
|
+
};
|
|
7753
|
+
} catch (err) {
|
|
7754
|
+
return {
|
|
7755
|
+
content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }],
|
|
7756
|
+
isError: true
|
|
7757
|
+
};
|
|
7758
|
+
}
|
|
7759
|
+
}
|
|
7760
|
+
);
|
|
7761
|
+
registerSpeakTool(
|
|
7762
|
+
server,
|
|
7763
|
+
"list_voices",
|
|
7764
|
+
"List the text-to-speech voices available to a voice agent. Use the returned provider/voiceId with create_voice_agent or update_voice_agent's voice field. When an agent's llm.model is a Live (speech-to-speech) model, its usable voices are a fixed, smaller set scoped to that model instead of this full catalog.",
|
|
7765
|
+
{},
|
|
7766
|
+
{
|
|
7767
|
+
title: "List Voices",
|
|
7768
|
+
readOnlyHint: true,
|
|
7769
|
+
destructiveHint: false,
|
|
7770
|
+
idempotentHint: true,
|
|
7771
|
+
openWorldHint: false
|
|
7772
|
+
},
|
|
7773
|
+
async () => {
|
|
7774
|
+
try {
|
|
7775
|
+
const result = await api.get("/v1/voice/voices");
|
|
7776
|
+
return {
|
|
7777
|
+
content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }]
|
|
7778
|
+
};
|
|
7779
|
+
} catch (err) {
|
|
7780
|
+
return {
|
|
7781
|
+
content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }],
|
|
7782
|
+
isError: true
|
|
7783
|
+
};
|
|
7784
|
+
}
|
|
7785
|
+
}
|
|
7786
|
+
);
|
|
7787
|
+
registerSpeakTool(
|
|
7788
|
+
server,
|
|
7789
|
+
"delete_voice_agent",
|
|
7790
|
+
"Permanently delete a voice agent. Requires the OWNER or ADMIN role. Irreversible: also removes its questions, test suite, and share link; past conversations are kept for record-keeping but are no longer reachable from this agent.",
|
|
7791
|
+
{ agentId: import_zod18.z.string().min(1).describe("ID of the voice agent to delete (from list_voice_agents)") },
|
|
7792
|
+
{ title: "Delete Voice Agent", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
7793
|
+
async ({ agentId }) => {
|
|
7794
|
+
try {
|
|
7795
|
+
const result = await api.delete(`/v1/voice/agents/${agentId}`);
|
|
7796
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
7797
|
+
} catch (err) {
|
|
7798
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
7799
|
+
}
|
|
7800
|
+
}
|
|
7801
|
+
);
|
|
7802
|
+
registerSpeakTool(
|
|
7803
|
+
server,
|
|
7804
|
+
"create_voice_agent_from_prompt",
|
|
7805
|
+
"Create a new voice agent by describing it in plain English instead of filling in name/personality/instructions/voice yourself. Requires the OWNER or ADMIN role. Response always includes the new agentId, plus either the generated agent config, or needsFollowUp: true with a follow-up question if the prompt was too thin to act on \u2014 call generate_voice_agent_config again on that agentId with more detail (or manualInstructions) when that happens.",
|
|
7806
|
+
{
|
|
7807
|
+
prompt: import_zod18.z.string().min(1).describe('Plain-English description of the agent to build, e.g. "a friendly dental clinic receptionist that books appointments and answers insurance questions".'),
|
|
7808
|
+
name: import_zod18.z.string().optional().describe("Agent name. Defaults to one derived from the prompt if omitted."),
|
|
7809
|
+
manualInstructions: import_zod18.z.string().optional().describe("Skip generation and use this as the agent's instructions verbatim.")
|
|
7810
|
+
},
|
|
7811
|
+
{ title: "Create Voice Agent From Prompt", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
7812
|
+
async (body) => {
|
|
7813
|
+
try {
|
|
7814
|
+
const result = await api.post("/v1/voice/agents/generation", body);
|
|
7815
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
7816
|
+
} catch (err) {
|
|
7817
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
7818
|
+
}
|
|
7819
|
+
}
|
|
7820
|
+
);
|
|
7821
|
+
registerSpeakTool(
|
|
7822
|
+
server,
|
|
7823
|
+
"generate_voice_agent_config",
|
|
7824
|
+
"Run the same prompt-to-config generation as create_voice_agent_from_prompt, but against an existing agent instead of creating a new one. Requires the OWNER or ADMIN role. On success the generated config is persisted onto the agent immediately. If the prompt is too thin and manualInstructions was not sent, the response has needsFollowUp: true with a follow-up question instead \u2014 call this again with more detail.",
|
|
7825
|
+
{
|
|
7826
|
+
agentId: import_zod18.z.string().min(1).describe("ID of the existing voice agent to generate config for (from list_voice_agents)"),
|
|
7827
|
+
prompt: import_zod18.z.string().min(1).describe("Plain-English description of what the agent should do."),
|
|
7828
|
+
manualInstructions: import_zod18.z.string().optional().describe("Skip generation and set the agent's instructions to this verbatim.")
|
|
7829
|
+
},
|
|
7830
|
+
{ title: "Generate Voice Agent Config", readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false },
|
|
7831
|
+
async ({ agentId, ...body }) => {
|
|
7832
|
+
try {
|
|
7833
|
+
const result = await api.post(`/v1/voice/agents/${agentId}/generation/generate`, body);
|
|
7834
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
7835
|
+
} catch (err) {
|
|
7836
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
7837
|
+
}
|
|
7838
|
+
}
|
|
7839
|
+
);
|
|
7840
|
+
registerSpeakTool(
|
|
7841
|
+
server,
|
|
7842
|
+
"get_voice_agent_setup_guide",
|
|
7843
|
+
"Discovery + how-to helper for building and operating a Speak AI voice agent end to end. Returns the four configuration pieces every agent is built from, which tool covers each one, the recommended build order, and how testing/questions/knowledge-base/intelligence tools chain together after the agent exists. Call this before create_voice_agent or create_voice_agent_from_prompt if you are not already familiar with this tool surface.",
|
|
7844
|
+
{},
|
|
7845
|
+
{ title: "Get Voice Agent Setup Guide", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
7846
|
+
async () => {
|
|
7847
|
+
const data = {
|
|
7848
|
+
overview: "A voice agent is a standalone resource: create it once, then it holds live spoken conversations, asking configured questions and answering from a knowledge base. It is built from four independent pieces, plus optional testing, sharing, and self-improvement layers.",
|
|
7849
|
+
buildOrder: [
|
|
7850
|
+
{
|
|
7851
|
+
step: 1,
|
|
7852
|
+
piece: "The agent record itself",
|
|
7853
|
+
tools: ["create_voice_agent", "create_voice_agent_from_prompt"],
|
|
7854
|
+
notes: "name, personality, instructions, and voice (provider+voiceId) are the only required fields. Call list_voices and list_voice_avatars first to get valid ids."
|
|
7855
|
+
},
|
|
7856
|
+
{
|
|
7857
|
+
step: 2,
|
|
7858
|
+
piece: "Voice & avatar",
|
|
7859
|
+
tools: ["list_voices", "list_voice_avatars", "update_voice_agent"],
|
|
7860
|
+
notes: "Every agent needs a voice. It only needs an avatar if conversationMode is video_avatar."
|
|
7861
|
+
},
|
|
7862
|
+
{
|
|
7863
|
+
step: 3,
|
|
7864
|
+
piece: "Instructions & behavior",
|
|
7865
|
+
tools: ["update_voice_agent", "generate_voice_agent_config"],
|
|
7866
|
+
notes: "personality/instructions are plain fields on the agent record; generate_voice_agent_config can (re)write them from a prompt instead of hand-authoring."
|
|
7867
|
+
},
|
|
7868
|
+
{
|
|
7869
|
+
step: 4,
|
|
7870
|
+
piece: "Questions",
|
|
7871
|
+
tools: ["list_voice_question_templates", "create_voice_question", "reorder_voice_questions"],
|
|
7872
|
+
notes: "Optional. Attaches a question template to the agent so it collects structured data mid-call. See the Questions tool group."
|
|
7873
|
+
},
|
|
7874
|
+
{
|
|
7875
|
+
step: 5,
|
|
7876
|
+
piece: "Knowledge base",
|
|
7877
|
+
tools: ["Knowledge Base tool group (separate from voice agents)"],
|
|
7878
|
+
notes: "Optional. A knowledge base collection is attached to the agent from the Knowledge Base API, not a voice-agent tool -- an agent has no documents of its own until one is attached."
|
|
7879
|
+
}
|
|
7880
|
+
],
|
|
7881
|
+
afterTheAgentExists: [
|
|
7882
|
+
{
|
|
7883
|
+
area: "Testing",
|
|
7884
|
+
tools: ["get_voice_test_suite", "update_voice_test_suite", "generate_voice_test_suite", "start_voice_test_run"],
|
|
7885
|
+
notes: "Scripted scenarios and a run history. The run lifecycle is live; the engine that drives a simulated conversation is not wired up yet, so a run stays queued."
|
|
7886
|
+
},
|
|
7887
|
+
{
|
|
7888
|
+
area: "Feedback / self-improvement (Intelligence)",
|
|
7889
|
+
tools: [
|
|
7890
|
+
"list_voice_kb_gaps",
|
|
7891
|
+
"list_voice_faq_suggestions",
|
|
7892
|
+
"analyze_voice_instruction_gaps",
|
|
7893
|
+
"list_voice_agent_resources"
|
|
7894
|
+
],
|
|
7895
|
+
notes: "What the agent surfaces from real calls: knowledge it lacked, questions callers repeat, and gaps in its own instructions. Nothing is written automatically -- every suggestion needs an explicit add/apply/dismiss call."
|
|
7896
|
+
},
|
|
7897
|
+
{
|
|
7898
|
+
area: "Conversations & analytics",
|
|
7899
|
+
tools: ["list_voice_conversations", "get_voice_conversation"],
|
|
7900
|
+
notes: "Read call history and transcripts once the agent has taken calls."
|
|
7901
|
+
}
|
|
7902
|
+
],
|
|
7903
|
+
commonMistakes: [
|
|
7904
|
+
"Calling create_voice_agent with a made-up voiceId instead of one from list_voices -- the create call fails validation.",
|
|
7905
|
+
"Expecting start_voice_test_run to return real scores -- the execution engine isn't wired up yet, see the Testing tools' own descriptions.",
|
|
7906
|
+
"Looking for a knowledge-base tool in this group -- collections are managed by the separate Knowledge Base tool group and only attached here."
|
|
7907
|
+
]
|
|
7908
|
+
};
|
|
7909
|
+
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
7910
|
+
}
|
|
7911
|
+
);
|
|
7912
|
+
}
|
|
7913
|
+
var import_zod18, voiceInputSchema;
|
|
7914
|
+
var init_voice = __esm({
|
|
7915
|
+
"src/tools/voice.ts"() {
|
|
7916
|
+
"use strict";
|
|
7917
|
+
import_zod18 = require("zod");
|
|
7918
|
+
init_helpers();
|
|
7919
|
+
init_client();
|
|
7920
|
+
voiceInputSchema = {
|
|
7921
|
+
name: import_zod18.z.string().min(1).describe("Required on create. Trimmed, non-empty."),
|
|
7922
|
+
personality: import_zod18.z.string().describe("Required on create. Free text describing the agent's tone."),
|
|
7923
|
+
instructions: import_zod18.z.string().describe("Required on create. The agent's system instructions."),
|
|
7924
|
+
voice: import_zod18.z.object({
|
|
7925
|
+
provider: import_zod18.z.string().describe("TTS provider, e.g. elevenlabs or openai."),
|
|
7926
|
+
voiceId: import_zod18.z.string(),
|
|
7927
|
+
model: import_zod18.z.string().optional()
|
|
7928
|
+
}).describe("Required on create."),
|
|
7929
|
+
llm: import_zod18.z.object({
|
|
7930
|
+
provider: import_zod18.z.string().optional().describe("Must be one of the voice-agent LLM providers if sent."),
|
|
7931
|
+
model: import_zod18.z.string().optional().describe("Must be one of the voice-agent model ids if sent.")
|
|
7932
|
+
}).optional(),
|
|
7933
|
+
avatar: import_zod18.z.object({
|
|
7934
|
+
avatarId: import_zod18.z.string().describe("Must match a row in your company's avatar catalog (list_voice_avatars) or the shared system catalog.")
|
|
7935
|
+
}).optional().describe("Set to attach a video avatar; avatarUrl/provider are derived server-side from the catalog row."),
|
|
7936
|
+
conversationMode: import_zod18.z.enum(["voice_only", "video_avatar"]).optional(),
|
|
7937
|
+
folderId: import_zod18.z.string().optional().describe("Folder to file this agent's conversations under."),
|
|
7938
|
+
enableWebSearch: import_zod18.z.boolean().optional().describe("Let the agent search the web mid-call, separate from any attached knowledge base.")
|
|
7939
|
+
};
|
|
7940
|
+
}
|
|
7941
|
+
});
|
|
7942
|
+
|
|
7943
|
+
// src/tools/voice-testing.ts
|
|
7944
|
+
var voice_testing_exports = {};
|
|
7945
|
+
__export(voice_testing_exports, {
|
|
7946
|
+
register: () => register18
|
|
7947
|
+
});
|
|
7948
|
+
function register18(server, client) {
|
|
7949
|
+
const api = client ?? speakClient;
|
|
7950
|
+
registerSpeakTool(
|
|
7951
|
+
server,
|
|
7952
|
+
"get_voice_test_suite",
|
|
7953
|
+
"Get a voice agent's test suite (its scenarios and run settings). Returns null in data.suite if none has been created yet \u2014 not a 404.",
|
|
7954
|
+
{ agentId: import_zod19.z.string().min(1).describe("ID of the voice agent (from list_voice_agents)") },
|
|
7955
|
+
{ title: "Get Voice Test Suite", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
7956
|
+
async ({ agentId }) => {
|
|
7957
|
+
try {
|
|
7958
|
+
const result = await api.get(`/v1/voice/testing/${agentId}/suite`);
|
|
7959
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
7960
|
+
} catch (err) {
|
|
7961
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
7962
|
+
}
|
|
7963
|
+
}
|
|
7964
|
+
);
|
|
7965
|
+
registerSpeakTool(
|
|
7966
|
+
server,
|
|
7967
|
+
"update_voice_test_suite",
|
|
7968
|
+
"Create or update a voice agent's test suite. Requires the OWNER or ADMIN role. Upserts. Send the full scenarios array you want to keep \u2014 it replaces the stored one, it is not merged.",
|
|
7969
|
+
{
|
|
7970
|
+
agentId: import_zod19.z.string().min(1).describe("ID of the voice agent (from list_voice_agents)"),
|
|
7971
|
+
scenarios: import_zod19.z.array(scenarioSchema).optional(),
|
|
7972
|
+
maxCostPerRun: import_zod19.z.number().min(0).optional(),
|
|
7973
|
+
autoRunOnKbUpdate: import_zod19.z.boolean().optional(),
|
|
7974
|
+
autoRunOnInstructionSave: import_zod19.z.boolean().optional(),
|
|
7975
|
+
scheduledCron: import_zod19.z.string().optional().nullable()
|
|
7976
|
+
},
|
|
7977
|
+
{ title: "Update Voice Test Suite", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
7978
|
+
async ({ agentId, ...body }) => {
|
|
7979
|
+
try {
|
|
7980
|
+
const result = await api.put(`/v1/voice/testing/${agentId}/suite`, body);
|
|
7981
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
7982
|
+
} catch (err) {
|
|
7983
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
7984
|
+
}
|
|
7985
|
+
}
|
|
7986
|
+
);
|
|
7987
|
+
registerSpeakTool(
|
|
7988
|
+
server,
|
|
7989
|
+
"generate_voice_test_suite",
|
|
7990
|
+
"Auto-generate a default test suite for a voice agent from its own instructions and knowledge base, via an LLM call. Requires the OWNER or ADMIN role. Overwrites the suite's existing scenarios.",
|
|
7991
|
+
{ agentId: import_zod19.z.string().min(1).describe("ID of the voice agent (from list_voice_agents)") },
|
|
7992
|
+
{ title: "Generate Voice Test Suite", readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false },
|
|
7993
|
+
async ({ agentId }) => {
|
|
7994
|
+
try {
|
|
7995
|
+
const result = await api.post(`/v1/voice/testing/${agentId}/suite/generate`);
|
|
7996
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
7997
|
+
} catch (err) {
|
|
7998
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
7999
|
+
}
|
|
8000
|
+
}
|
|
8001
|
+
);
|
|
8002
|
+
registerSpeakTool(
|
|
8003
|
+
server,
|
|
8004
|
+
"start_voice_test_run",
|
|
8005
|
+
"Start a test run against a voice agent's suite. Requires the OWNER or ADMIN role. Rejects with 409 if the agent has no test suite." + NOT_WIRED_NOTE,
|
|
8006
|
+
{ agentId: import_zod19.z.string().min(1).describe("ID of the voice agent (from list_voice_agents)") },
|
|
8007
|
+
{ title: "Start Voice Test Run", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
8008
|
+
async ({ agentId }) => {
|
|
8009
|
+
try {
|
|
8010
|
+
const result = await api.post(`/v1/voice/testing/${agentId}/run`);
|
|
8011
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8012
|
+
} catch (err) {
|
|
8013
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8014
|
+
}
|
|
8015
|
+
}
|
|
8016
|
+
);
|
|
8017
|
+
registerSpeakTool(
|
|
8018
|
+
server,
|
|
8019
|
+
"get_active_voice_test_run",
|
|
8020
|
+
"Get a voice agent's currently active test run (queued, running, or paused). Returns null in data.run if none is active \u2014 not a 404.",
|
|
8021
|
+
{ agentId: import_zod19.z.string().min(1).describe("ID of the voice agent (from list_voice_agents)") },
|
|
8022
|
+
{ title: "Get Active Voice Test Run", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
8023
|
+
async ({ agentId }) => {
|
|
8024
|
+
try {
|
|
8025
|
+
const result = await api.get(`/v1/voice/testing/${agentId}/run/active`);
|
|
8026
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8027
|
+
} catch (err) {
|
|
8028
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8029
|
+
}
|
|
8030
|
+
}
|
|
8031
|
+
);
|
|
8032
|
+
registerSpeakTool(
|
|
8033
|
+
server,
|
|
8034
|
+
"pause_voice_test_run",
|
|
8035
|
+
"Pause a voice agent's test run. Requires the OWNER or ADMIN role. Valid only from queued or running." + NOT_WIRED_NOTE,
|
|
8036
|
+
{
|
|
8037
|
+
agentId: import_zod19.z.string().min(1).describe("ID of the voice agent (from list_voice_agents)"),
|
|
8038
|
+
runId: import_zod19.z.string().min(1).describe("ID of the run (from get_active_voice_test_run or list_voice_test_runs)")
|
|
8039
|
+
},
|
|
8040
|
+
{ title: "Pause Voice Test Run", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
8041
|
+
async ({ agentId, runId }) => {
|
|
8042
|
+
try {
|
|
8043
|
+
const result = await api.post(`/v1/voice/testing/${agentId}/run/${runId}/pause`);
|
|
8044
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8045
|
+
} catch (err) {
|
|
8046
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8047
|
+
}
|
|
8048
|
+
}
|
|
8049
|
+
);
|
|
8050
|
+
registerSpeakTool(
|
|
8051
|
+
server,
|
|
8052
|
+
"resume_voice_test_run",
|
|
8053
|
+
"Resume a paused voice agent test run, transitioning it back to running. Requires the OWNER or ADMIN role. Valid only from paused.",
|
|
8054
|
+
{
|
|
8055
|
+
agentId: import_zod19.z.string().min(1).describe("ID of the voice agent (from list_voice_agents)"),
|
|
8056
|
+
runId: import_zod19.z.string().min(1).describe("ID of the run (from get_active_voice_test_run or list_voice_test_runs)")
|
|
8057
|
+
},
|
|
8058
|
+
{ title: "Resume Voice Test Run", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
8059
|
+
async ({ agentId, runId }) => {
|
|
8060
|
+
try {
|
|
8061
|
+
const result = await api.post(`/v1/voice/testing/${agentId}/run/${runId}/resume`);
|
|
8062
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8063
|
+
} catch (err) {
|
|
8064
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8065
|
+
}
|
|
8066
|
+
}
|
|
8067
|
+
);
|
|
8068
|
+
registerSpeakTool(
|
|
8069
|
+
server,
|
|
8070
|
+
"cancel_voice_test_run",
|
|
8071
|
+
"Cancel a voice agent test run. Requires the OWNER or ADMIN role. Valid from queued, running, or paused. Terminal \u2014 a cancelled run can never be resumed.",
|
|
8072
|
+
{
|
|
8073
|
+
agentId: import_zod19.z.string().min(1).describe("ID of the voice agent (from list_voice_agents)"),
|
|
8074
|
+
runId: import_zod19.z.string().min(1).describe("ID of the run (from get_active_voice_test_run or list_voice_test_runs)")
|
|
8075
|
+
},
|
|
8076
|
+
{ title: "Cancel Voice Test Run", readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false },
|
|
8077
|
+
async ({ agentId, runId }) => {
|
|
8078
|
+
try {
|
|
8079
|
+
const result = await api.post(`/v1/voice/testing/${agentId}/run/${runId}/cancel`);
|
|
8080
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8081
|
+
} catch (err) {
|
|
8082
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8083
|
+
}
|
|
8084
|
+
}
|
|
8085
|
+
);
|
|
8086
|
+
registerSpeakTool(
|
|
8087
|
+
server,
|
|
8088
|
+
"list_voice_test_runs",
|
|
8089
|
+
"List a voice agent's test runs, most recent first. Capped at 100 regardless of limit.",
|
|
8090
|
+
{
|
|
8091
|
+
agentId: import_zod19.z.string().min(1).describe("ID of the voice agent (from list_voice_agents)"),
|
|
8092
|
+
limit: import_zod19.z.number().int().min(1).optional()
|
|
8093
|
+
},
|
|
8094
|
+
{ title: "List Voice Test Runs", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
8095
|
+
async ({ agentId, ...params }) => {
|
|
8096
|
+
try {
|
|
8097
|
+
const result = await api.get(`/v1/voice/testing/${agentId}/runs`, { params });
|
|
8098
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8099
|
+
} catch (err) {
|
|
8100
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8101
|
+
}
|
|
8102
|
+
}
|
|
8103
|
+
);
|
|
8104
|
+
registerSpeakTool(
|
|
8105
|
+
server,
|
|
8106
|
+
"get_voice_test_run",
|
|
8107
|
+
"Get a test run's full detail, including scenarioResults and recommendations. Scoped to your company; agentId is not used to filter this lookup, only runId.",
|
|
8108
|
+
{
|
|
8109
|
+
agentId: import_zod19.z.string().min(1).describe("ID of the voice agent (from list_voice_agents)"),
|
|
8110
|
+
runId: import_zod19.z.string().min(1).describe("ID of the run (from list_voice_test_runs)")
|
|
8111
|
+
},
|
|
8112
|
+
{ title: "Get Voice Test Run", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
8113
|
+
async ({ agentId, runId }) => {
|
|
8114
|
+
try {
|
|
8115
|
+
const result = await api.get(`/v1/voice/testing/${agentId}/runs/${runId}`);
|
|
8116
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8117
|
+
} catch (err) {
|
|
8118
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8119
|
+
}
|
|
8120
|
+
}
|
|
8121
|
+
);
|
|
8122
|
+
registerSpeakTool(
|
|
8123
|
+
server,
|
|
8124
|
+
"apply_voice_test_recommendation",
|
|
8125
|
+
"Apply a test run recommendation's quick action to the agent (e.g. patch_instructions appends the suggested fix to the agent's instructions). Requires the OWNER or ADMIN role.",
|
|
8126
|
+
{
|
|
8127
|
+
agentId: import_zod19.z.string().min(1).describe("ID of the voice agent (from list_voice_agents)"),
|
|
8128
|
+
runId: import_zod19.z.string().min(1).describe("ID of the run (from get_voice_test_run)"),
|
|
8129
|
+
recId: import_zod19.z.string().min(1).describe("ID of the recommendation within that run's recommendations list")
|
|
8130
|
+
},
|
|
8131
|
+
{ title: "Apply Voice Test Recommendation", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
8132
|
+
async ({ agentId, runId, recId }) => {
|
|
8133
|
+
try {
|
|
8134
|
+
const result = await api.post(`/v1/voice/testing/${agentId}/runs/${runId}/recommendations/${recId}/apply`);
|
|
8135
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8136
|
+
} catch (err) {
|
|
8137
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8138
|
+
}
|
|
8139
|
+
}
|
|
8140
|
+
);
|
|
8141
|
+
registerSpeakTool(
|
|
8142
|
+
server,
|
|
8143
|
+
"get_voice_test_baseline",
|
|
8144
|
+
"Get a voice agent's best-scoring completed test run, used to detect regressions on later runs. Returns null in data.baseline if no run has completed yet.",
|
|
8145
|
+
{ agentId: import_zod19.z.string().min(1).describe("ID of the voice agent (from list_voice_agents)") },
|
|
8146
|
+
{ title: "Get Voice Test Baseline", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
8147
|
+
async ({ agentId }) => {
|
|
8148
|
+
try {
|
|
8149
|
+
const result = await api.get(`/v1/voice/testing/${agentId}/baseline`);
|
|
8150
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8151
|
+
} catch (err) {
|
|
8152
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8153
|
+
}
|
|
8154
|
+
}
|
|
8155
|
+
);
|
|
8156
|
+
registerSpeakTool(
|
|
8157
|
+
server,
|
|
8158
|
+
"get_voice_test_score_history",
|
|
8159
|
+
"Get completed-run score points for a voice agent, most recent first, for charting. Capped at 100 regardless of limit. Only status=completed runs are included.",
|
|
8160
|
+
{
|
|
8161
|
+
agentId: import_zod19.z.string().min(1).describe("ID of the voice agent (from list_voice_agents)"),
|
|
8162
|
+
limit: import_zod19.z.number().int().min(1).optional()
|
|
8163
|
+
},
|
|
8164
|
+
{ title: "Get Voice Test Score History", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
8165
|
+
async ({ agentId, ...params }) => {
|
|
8166
|
+
try {
|
|
8167
|
+
const result = await api.get(`/v1/voice/testing/${agentId}/score-history`, { params });
|
|
8168
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8169
|
+
} catch (err) {
|
|
8170
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8171
|
+
}
|
|
8172
|
+
}
|
|
8173
|
+
);
|
|
8174
|
+
}
|
|
8175
|
+
var import_zod19, NOT_WIRED_NOTE, criterionSchema, scenarioSchema;
|
|
8176
|
+
var init_voice_testing = __esm({
|
|
8177
|
+
"src/tools/voice-testing.ts"() {
|
|
8178
|
+
"use strict";
|
|
8179
|
+
import_zod19 = require("zod");
|
|
8180
|
+
init_helpers();
|
|
8181
|
+
init_client();
|
|
8182
|
+
NOT_WIRED_NOTE = " The live execution engine is not wired up yet: a run created here stays queued, scenarioResults stays empty, and overallScore stays 0.";
|
|
8183
|
+
criterionSchema = import_zod19.z.object({
|
|
8184
|
+
criterionId: import_zod19.z.string().optional(),
|
|
8185
|
+
name: import_zod19.z.string(),
|
|
8186
|
+
evaluationPrompt: import_zod19.z.string().describe("What the LLM judge is asked to evaluate."),
|
|
8187
|
+
weight: import_zod19.z.number().min(1).max(10).optional(),
|
|
8188
|
+
isCritical: import_zod19.z.boolean().optional(),
|
|
8189
|
+
type: import_zod19.z.enum(["llm_judged", "response_length", "regex_match", "tool_called"]).optional().describe("Defaults to llm_judged. The other three route through a deterministic code check before the LLM judge runs."),
|
|
8190
|
+
maxWords: import_zod19.z.number().int().optional().describe("For type=response_length: fails if any agent response exceeds this word count."),
|
|
8191
|
+
regexPattern: import_zod19.z.string().optional().describe("For type=regex_match: JS regex source, no slashes."),
|
|
8192
|
+
mustMatch: import_zod19.z.boolean().optional().describe("For type=regex_match: true (default) requires a match, false requires none."),
|
|
8193
|
+
expectedToolName: import_zod19.z.string().optional().describe("For type=tool_called: the tool name to look for in the transcript's tool calls.")
|
|
8194
|
+
});
|
|
8195
|
+
scenarioSchema = import_zod19.z.object({
|
|
8196
|
+
scenarioId: import_zod19.z.string().optional(),
|
|
8197
|
+
name: import_zod19.z.string(),
|
|
8198
|
+
description: import_zod19.z.string().optional(),
|
|
8199
|
+
userMessages: import_zod19.z.array(import_zod19.z.string()).min(1).describe("The scripted turns sent to the agent."),
|
|
8200
|
+
criteria: import_zod19.z.array(criterionSchema).optional().describe("Defaults to an empty array."),
|
|
8201
|
+
category: import_zod19.z.enum(["greeting", "kb_retrieval", "off_topic", "edge_case", "custom"]).optional(),
|
|
8202
|
+
isEnabled: import_zod19.z.boolean().optional()
|
|
8203
|
+
});
|
|
8204
|
+
}
|
|
8205
|
+
});
|
|
8206
|
+
|
|
8207
|
+
// src/tools/voice-questions.ts
|
|
8208
|
+
var voice_questions_exports = {};
|
|
8209
|
+
__export(voice_questions_exports, {
|
|
8210
|
+
register: () => register19
|
|
8211
|
+
});
|
|
8212
|
+
function register19(server, client) {
|
|
8213
|
+
const api = client ?? speakClient;
|
|
8214
|
+
registerSpeakTool(
|
|
8215
|
+
server,
|
|
8216
|
+
"list_voice_questions",
|
|
8217
|
+
"List the questions configured on a voice agent, in the order it asks them. Each is an agent-level instance of a question template with its own required/attempts/no-response settings and optional field mapping.",
|
|
8218
|
+
{
|
|
8219
|
+
agentId: import_zod20.z.string().min(1).describe("Required. Returns 404 if the agent does not exist or does not belong to your company."),
|
|
8220
|
+
enabledOnly: import_zod20.z.boolean().optional()
|
|
8221
|
+
},
|
|
8222
|
+
{ title: "List Voice Questions", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
8223
|
+
async (params) => {
|
|
8224
|
+
try {
|
|
8225
|
+
const result = await api.get("/v1/voice/questions", { params });
|
|
8226
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8227
|
+
} catch (err) {
|
|
8228
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8229
|
+
}
|
|
8230
|
+
}
|
|
8231
|
+
);
|
|
8232
|
+
registerSpeakTool(
|
|
8233
|
+
server,
|
|
8234
|
+
"get_voice_question",
|
|
8235
|
+
"Fetch a single voice agent question by its fieldId, scoped to your company.",
|
|
8236
|
+
{ fieldId: import_zod20.z.string().min(1).describe("ID of the question (from list_voice_questions)") },
|
|
8237
|
+
{ title: "Get Voice Question", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
8238
|
+
async ({ fieldId }) => {
|
|
8239
|
+
try {
|
|
8240
|
+
const result = await api.get(`/v1/voice/questions/${fieldId}`);
|
|
8241
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8242
|
+
} catch (err) {
|
|
8243
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8244
|
+
}
|
|
8245
|
+
}
|
|
8246
|
+
);
|
|
8247
|
+
registerSpeakTool(
|
|
8248
|
+
server,
|
|
8249
|
+
"create_voice_question",
|
|
8250
|
+
"Attach a question template to a voice agent. Requires the OWNER or ADMIN role. agentId and templateId are both required and must belong to your company (or, for templateId, be a public system template) \u2014 404 if either isn't found.",
|
|
8251
|
+
{
|
|
8252
|
+
agentId: import_zod20.z.string().min(1),
|
|
8253
|
+
templateId: import_zod20.z.string().min(1).describe("From list_voice_question_templates."),
|
|
8254
|
+
customConfig: customConfigSchema.optional().describe("Agent-level override of the template's defaultConfig; only the keys you send are overridden."),
|
|
8255
|
+
required: import_zod20.z.boolean().optional(),
|
|
8256
|
+
maxPromptAttempts: import_zod20.z.number().min(1).max(3).optional(),
|
|
8257
|
+
noResponseBehavior: import_zod20.z.enum(["move_to_next_question", "end_conversation"]).optional(),
|
|
8258
|
+
triggerCondition: import_zod20.z.string().optional(),
|
|
8259
|
+
order: import_zod20.z.number().optional(),
|
|
8260
|
+
enabled: import_zod20.z.boolean().optional(),
|
|
8261
|
+
mappedFieldId: import_zod20.z.string().optional().nullable().describe("ID of an existing company Field to write this question's collected answer onto after each call.")
|
|
8262
|
+
},
|
|
8263
|
+
{ title: "Create Voice Question", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
8264
|
+
async (body) => {
|
|
8265
|
+
try {
|
|
8266
|
+
const result = await api.post("/v1/voice/questions", body);
|
|
8267
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8268
|
+
} catch (err) {
|
|
8269
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8270
|
+
}
|
|
8271
|
+
}
|
|
8272
|
+
);
|
|
8273
|
+
registerSpeakTool(
|
|
8274
|
+
server,
|
|
8275
|
+
"update_voice_question",
|
|
8276
|
+
"Partially update a voice agent question \u2014 only the fields you send are changed. Requires the OWNER or ADMIN role. agentId and templateId are fixed after create; sending them is silently dropped.",
|
|
8277
|
+
{
|
|
8278
|
+
fieldId: import_zod20.z.string().min(1).describe("ID of the question to update (from list_voice_questions)"),
|
|
8279
|
+
customConfig: customConfigSchema.optional(),
|
|
8280
|
+
required: import_zod20.z.boolean().optional(),
|
|
8281
|
+
maxPromptAttempts: import_zod20.z.number().min(1).max(3).optional(),
|
|
8282
|
+
noResponseBehavior: import_zod20.z.enum(["move_to_next_question", "end_conversation"]).optional(),
|
|
8283
|
+
triggerCondition: import_zod20.z.string().optional(),
|
|
8284
|
+
order: import_zod20.z.number().optional(),
|
|
8285
|
+
enabled: import_zod20.z.boolean().optional(),
|
|
8286
|
+
mappedFieldId: import_zod20.z.string().optional().nullable()
|
|
8287
|
+
},
|
|
8288
|
+
{ title: "Update Voice Question", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
8289
|
+
async ({ fieldId, ...body }) => {
|
|
8290
|
+
try {
|
|
8291
|
+
const result = await api.put(`/v1/voice/questions/${fieldId}`, body);
|
|
8292
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8293
|
+
} catch (err) {
|
|
8294
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8295
|
+
}
|
|
8296
|
+
}
|
|
8297
|
+
);
|
|
8298
|
+
registerSpeakTool(
|
|
8299
|
+
server,
|
|
8300
|
+
"delete_voice_question",
|
|
8301
|
+
"Permanently remove a question from a voice agent and decrement the underlying template's usageCount. Requires the OWNER or ADMIN role. The template itself is not deleted and can be attached to another agent later.",
|
|
8302
|
+
{ fieldId: import_zod20.z.string().min(1).describe("ID of the question to remove (from list_voice_questions)") },
|
|
8303
|
+
{ title: "Delete Voice Question", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
8304
|
+
async ({ fieldId }) => {
|
|
8305
|
+
try {
|
|
8306
|
+
const result = await api.delete(`/v1/voice/questions/${fieldId}`);
|
|
8307
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8308
|
+
} catch (err) {
|
|
8309
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8310
|
+
}
|
|
8311
|
+
}
|
|
8312
|
+
);
|
|
8313
|
+
registerSpeakTool(
|
|
8314
|
+
server,
|
|
8315
|
+
"reorder_voice_questions",
|
|
8316
|
+
"Set the order a voice agent asks its questions in. Requires the OWNER or ADMIN role. Bulk-writes the order value on each listed question (written directly, not resequenced), then returns the agent's full question list in its new order. Entries whose fieldId doesn't belong to agentId are silently skipped.",
|
|
8317
|
+
{
|
|
8318
|
+
agentId: import_zod20.z.string().min(1),
|
|
8319
|
+
fieldOrders: import_zod20.z.array(import_zod20.z.object({ fieldId: import_zod20.z.string().min(1), order: import_zod20.z.number() })).min(1).describe("The new order for some or all of the agent's questions.")
|
|
8320
|
+
},
|
|
8321
|
+
{ title: "Reorder Voice Questions", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
8322
|
+
async (body) => {
|
|
8323
|
+
try {
|
|
8324
|
+
const result = await api.put("/v1/voice/questions/reorder", body);
|
|
8325
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8326
|
+
} catch (err) {
|
|
8327
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8328
|
+
}
|
|
8329
|
+
}
|
|
8330
|
+
);
|
|
8331
|
+
registerSpeakTool(
|
|
8332
|
+
server,
|
|
8333
|
+
"list_voice_question_templates",
|
|
8334
|
+
"List the question templates visible to your company: Speak's shared system templates, plus your own company's templates. Use the returned templateId with create_voice_question.",
|
|
8335
|
+
{ category: import_zod20.z.enum(["contact", "booking", "qualification", "payment", "custom"]).optional() },
|
|
8336
|
+
{ title: "List Voice Question Templates", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
8337
|
+
async (params) => {
|
|
8338
|
+
try {
|
|
8339
|
+
const result = await api.get("/v1/voice/question-templates", { params });
|
|
8340
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8341
|
+
} catch (err) {
|
|
8342
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8343
|
+
}
|
|
8344
|
+
}
|
|
8345
|
+
);
|
|
8346
|
+
registerSpeakTool(
|
|
8347
|
+
server,
|
|
8348
|
+
"create_voice_question_template",
|
|
8349
|
+
`Create a company-scoped question template \u2014 the "custom question" a user names themselves rather than picking from Speak's shared library. Requires the OWNER or ADMIN role. The server stamps companyId and forces isSystemTemplate to false, so this template is only ever visible to your company.`,
|
|
8350
|
+
{
|
|
8351
|
+
name: import_zod20.z.string().min(1),
|
|
8352
|
+
description: import_zod20.z.string().min(1),
|
|
8353
|
+
category: import_zod20.z.enum(["contact", "booking", "qualification", "payment", "custom"]),
|
|
8354
|
+
fieldType: import_zod20.z.enum(["email", "phone", "date", "time", "datetime", "text", "number", "boolean", "choice", "url"]),
|
|
8355
|
+
defaultConfig: import_zod20.z.object({
|
|
8356
|
+
displayLabel: import_zod20.z.string(),
|
|
8357
|
+
question: import_zod20.z.string().describe("The prompt text the agent speaks to ask this."),
|
|
8358
|
+
confirmationText: import_zod20.z.string().optional(),
|
|
8359
|
+
validationPrompt: import_zod20.z.string().optional(),
|
|
8360
|
+
validation: validationSchema.optional()
|
|
8361
|
+
}).describe("displayLabel and question are both required within this object."),
|
|
8362
|
+
isPublic: import_zod20.z.boolean().optional(),
|
|
8363
|
+
tags: import_zod20.z.array(import_zod20.z.string()).optional()
|
|
8364
|
+
},
|
|
8365
|
+
{ title: "Create Voice Question Template", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
8366
|
+
async (body) => {
|
|
8367
|
+
try {
|
|
8368
|
+
const result = await api.post("/v1/voice/question-templates", body);
|
|
8369
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8370
|
+
} catch (err) {
|
|
8371
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8372
|
+
}
|
|
8373
|
+
}
|
|
8374
|
+
);
|
|
8375
|
+
}
|
|
8376
|
+
var import_zod20, validationSchema, customConfigSchema;
|
|
8377
|
+
var init_voice_questions = __esm({
|
|
8378
|
+
"src/tools/voice-questions.ts"() {
|
|
8379
|
+
"use strict";
|
|
8380
|
+
import_zod20 = require("zod");
|
|
8381
|
+
init_helpers();
|
|
8382
|
+
init_client();
|
|
8383
|
+
validationSchema = import_zod20.z.object({
|
|
8384
|
+
pattern: import_zod20.z.string().optional(),
|
|
8385
|
+
minLength: import_zod20.z.number().optional(),
|
|
8386
|
+
maxLength: import_zod20.z.number().optional(),
|
|
8387
|
+
min: import_zod20.z.number().optional(),
|
|
8388
|
+
max: import_zod20.z.number().optional(),
|
|
8389
|
+
allowedValues: import_zod20.z.array(import_zod20.z.string()).optional()
|
|
8390
|
+
});
|
|
8391
|
+
customConfigSchema = import_zod20.z.object({
|
|
8392
|
+
displayLabel: import_zod20.z.string().optional(),
|
|
8393
|
+
question: import_zod20.z.string().optional().describe("The prompt text the agent speaks to ask this question."),
|
|
8394
|
+
confirmationText: import_zod20.z.string().optional(),
|
|
8395
|
+
validationPrompt: import_zod20.z.string().optional(),
|
|
8396
|
+
validation: validationSchema.optional()
|
|
8397
|
+
});
|
|
8398
|
+
}
|
|
8399
|
+
});
|
|
8400
|
+
|
|
8401
|
+
// src/tools/voice-intelligence.ts
|
|
8402
|
+
var voice_intelligence_exports = {};
|
|
8403
|
+
__export(voice_intelligence_exports, {
|
|
8404
|
+
register: () => register20
|
|
8405
|
+
});
|
|
8406
|
+
function register20(server, client) {
|
|
8407
|
+
const api = client ?? speakClient;
|
|
8408
|
+
registerSpeakTool(
|
|
8409
|
+
server,
|
|
8410
|
+
"list_voice_kb_gaps",
|
|
8411
|
+
`List a voice agent's pending knowledge-base gaps \u2014 questions callers asked that the agent answered with low confidence or an explicit "I don't know," surfaced automatically after calls. Up to the 50 most recent pending gaps, newest first.`,
|
|
8412
|
+
{ agentId: import_zod21.z.string().min(1).describe("ID of the voice agent (from list_voice_agents)") },
|
|
8413
|
+
{ title: "List Voice KB Gaps", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
8414
|
+
async ({ agentId }) => {
|
|
8415
|
+
try {
|
|
8416
|
+
const result = await api.get(`/v1/voice/knowledge-base/${agentId}/gaps`);
|
|
8417
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8418
|
+
} catch (err) {
|
|
8419
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8420
|
+
}
|
|
8421
|
+
}
|
|
8422
|
+
);
|
|
8423
|
+
registerSpeakTool(
|
|
8424
|
+
server,
|
|
8425
|
+
"analyze_voice_kb_gaps",
|
|
8426
|
+
"Trigger knowledge-base gap analysis over a voice agent's recent calls. Requires the OWNER or ADMIN role. Runs in the background and returns immediately \u2014 new gaps appear in list_voice_kb_gaps once analysis finishes, not synchronously with this response.",
|
|
8427
|
+
{ agentId: import_zod21.z.string().min(1).describe("ID of the voice agent (from list_voice_agents)") },
|
|
8428
|
+
{ title: "Analyze Voice KB Gaps", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
8429
|
+
async ({ agentId }) => {
|
|
8430
|
+
try {
|
|
8431
|
+
const result = await api.post(`/v1/voice/knowledge-base/${agentId}/gaps/analyze`);
|
|
8432
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8433
|
+
} catch (err) {
|
|
8434
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8435
|
+
}
|
|
8436
|
+
}
|
|
8437
|
+
);
|
|
8438
|
+
registerSpeakTool(
|
|
8439
|
+
server,
|
|
8440
|
+
"add_voice_kb_gap",
|
|
8441
|
+
"Write a knowledge-base gap's answer into the voice agent's attached knowledge base as a new document, and mark the gap added. Requires the OWNER or ADMIN role. Fails with 409 if the gap was already added or dismissed, or if the agent has no knowledge base collection to write into.",
|
|
8442
|
+
{
|
|
8443
|
+
agentId: import_zod21.z.string().min(1).describe("ID of the voice agent (from list_voice_agents)"),
|
|
8444
|
+
gapId: import_zod21.z.string().min(1).describe("ID of the gap (from list_voice_kb_gaps)"),
|
|
8445
|
+
answer: import_zod21.z.string().optional().describe("Overrides the gap's suggested answer."),
|
|
8446
|
+
title: import_zod21.z.string().optional().describe("Overrides the gap's suggested title.")
|
|
8447
|
+
},
|
|
8448
|
+
{ title: "Add Voice KB Gap", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
8449
|
+
async ({ agentId, gapId, ...body }) => {
|
|
8450
|
+
try {
|
|
8451
|
+
const result = await api.post(`/v1/voice/knowledge-base/${agentId}/gaps/${gapId}/add`, body);
|
|
8452
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8453
|
+
} catch (err) {
|
|
8454
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8455
|
+
}
|
|
8456
|
+
}
|
|
8457
|
+
);
|
|
8458
|
+
registerSpeakTool(
|
|
8459
|
+
server,
|
|
8460
|
+
"dismiss_voice_kb_gap",
|
|
8461
|
+
"Mark a voice agent's knowledge-base gap dismissed without writing anything to the knowledge base. Requires the OWNER or ADMIN role.",
|
|
8462
|
+
{
|
|
8463
|
+
agentId: import_zod21.z.string().min(1).describe("ID of the voice agent (from list_voice_agents)"),
|
|
8464
|
+
gapId: import_zod21.z.string().min(1).describe("ID of the gap (from list_voice_kb_gaps)")
|
|
8465
|
+
},
|
|
8466
|
+
{ title: "Dismiss Voice KB Gap", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
8467
|
+
async ({ agentId, gapId }) => {
|
|
8468
|
+
try {
|
|
8469
|
+
const result = await api.delete(`/v1/voice/knowledge-base/${agentId}/gaps/${gapId}`);
|
|
8470
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8471
|
+
} catch (err) {
|
|
8472
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8473
|
+
}
|
|
8474
|
+
}
|
|
8475
|
+
);
|
|
8476
|
+
registerSpeakTool(
|
|
8477
|
+
server,
|
|
8478
|
+
"list_voice_faq_suggestions",
|
|
8479
|
+
"List a voice agent's pending FAQ suggestions \u2014 questions multiple callers asked in similar form, clustered and drafted into a reusable question/answer pair. Up to the 20 largest clusters, largest first.",
|
|
8480
|
+
{ agentId: import_zod21.z.string().min(1).describe("ID of the voice agent (from list_voice_agents)") },
|
|
8481
|
+
{ title: "List Voice FAQ Suggestions", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
8482
|
+
async ({ agentId }) => {
|
|
8483
|
+
try {
|
|
8484
|
+
const result = await api.get(`/v1/voice/knowledge-base/${agentId}/faqs`);
|
|
8485
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8486
|
+
} catch (err) {
|
|
8487
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8488
|
+
}
|
|
8489
|
+
}
|
|
8490
|
+
);
|
|
8491
|
+
registerSpeakTool(
|
|
8492
|
+
server,
|
|
8493
|
+
"generate_voice_faq_suggestions",
|
|
8494
|
+
"Trigger FAQ clustering over a voice agent's recent calls. Requires the OWNER or ADMIN role. Runs in the background and returns immediately \u2014 new suggestions appear in list_voice_faq_suggestions once generation finishes, not synchronously with this response.",
|
|
8495
|
+
{ agentId: import_zod21.z.string().min(1).describe("ID of the voice agent (from list_voice_agents)") },
|
|
8496
|
+
{ title: "Generate Voice FAQ Suggestions", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
8497
|
+
async ({ agentId }) => {
|
|
8498
|
+
try {
|
|
8499
|
+
const result = await api.post(`/v1/voice/knowledge-base/${agentId}/faqs/generate`);
|
|
8500
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8501
|
+
} catch (err) {
|
|
8502
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8503
|
+
}
|
|
8504
|
+
}
|
|
8505
|
+
);
|
|
8506
|
+
registerSpeakTool(
|
|
8507
|
+
server,
|
|
8508
|
+
"add_voice_faq_suggestion",
|
|
8509
|
+
"Write an FAQ suggestion's question/answer into the voice agent's attached knowledge base as a new document, and mark the suggestion added. Requires the OWNER or ADMIN role. Fails with 409 if the suggestion was already added or dismissed, or if the agent has no knowledge base collection to write into.",
|
|
8510
|
+
{
|
|
8511
|
+
agentId: import_zod21.z.string().min(1).describe("ID of the voice agent (from list_voice_agents)"),
|
|
8512
|
+
suggestionId: import_zod21.z.string().min(1).describe("ID of the suggestion (from list_voice_faq_suggestions)"),
|
|
8513
|
+
question: import_zod21.z.string().optional().describe("Overrides the suggested question."),
|
|
8514
|
+
answer: import_zod21.z.string().optional().describe("Overrides the suggested answer.")
|
|
8515
|
+
},
|
|
8516
|
+
{ title: "Add Voice FAQ Suggestion", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
8517
|
+
async ({ agentId, suggestionId, ...body }) => {
|
|
8518
|
+
try {
|
|
8519
|
+
const result = await api.post(`/v1/voice/knowledge-base/${agentId}/faqs/${suggestionId}/add`, body);
|
|
8520
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8521
|
+
} catch (err) {
|
|
8522
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8523
|
+
}
|
|
8524
|
+
}
|
|
8525
|
+
);
|
|
8526
|
+
registerSpeakTool(
|
|
8527
|
+
server,
|
|
8528
|
+
"update_voice_faq_suggestion",
|
|
8529
|
+
"Edit a still-pending FAQ suggestion's question and/or answer before adding it. Requires the OWNER or ADMIN role. Fails with 400 if the suggestion was already added or dismissed.",
|
|
8530
|
+
{
|
|
8531
|
+
agentId: import_zod21.z.string().min(1).describe("ID of the voice agent (from list_voice_agents)"),
|
|
8532
|
+
suggestionId: import_zod21.z.string().min(1).describe("ID of the suggestion (from list_voice_faq_suggestions)"),
|
|
8533
|
+
question: import_zod21.z.string().optional(),
|
|
8534
|
+
answer: import_zod21.z.string().optional()
|
|
8535
|
+
},
|
|
8536
|
+
{ title: "Update Voice FAQ Suggestion", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
8537
|
+
async ({ agentId, suggestionId, ...body }) => {
|
|
8538
|
+
try {
|
|
8539
|
+
const result = await api.put(`/v1/voice/knowledge-base/${agentId}/faqs/${suggestionId}`, body);
|
|
8540
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8541
|
+
} catch (err) {
|
|
8542
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8543
|
+
}
|
|
8544
|
+
}
|
|
8545
|
+
);
|
|
8546
|
+
registerSpeakTool(
|
|
8547
|
+
server,
|
|
8548
|
+
"dismiss_voice_faq_suggestion",
|
|
8549
|
+
"Mark a voice agent's FAQ suggestion dismissed without writing anything to the knowledge base. Requires the OWNER or ADMIN role.",
|
|
8550
|
+
{
|
|
8551
|
+
agentId: import_zod21.z.string().min(1).describe("ID of the voice agent (from list_voice_agents)"),
|
|
8552
|
+
suggestionId: import_zod21.z.string().min(1).describe("ID of the suggestion (from list_voice_faq_suggestions)")
|
|
8553
|
+
},
|
|
8554
|
+
{ title: "Dismiss Voice FAQ Suggestion", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
8555
|
+
async ({ agentId, suggestionId }) => {
|
|
8556
|
+
try {
|
|
8557
|
+
const result = await api.delete(`/v1/voice/knowledge-base/${agentId}/faqs/${suggestionId}`);
|
|
8558
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8559
|
+
} catch (err) {
|
|
8560
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8561
|
+
}
|
|
8562
|
+
}
|
|
8563
|
+
);
|
|
8564
|
+
registerSpeakTool(
|
|
8565
|
+
server,
|
|
8566
|
+
"list_voice_agent_resources",
|
|
8567
|
+
"List the knowledge documents/links a voice agent searches during calls \u2014 separate from KB gaps and FAQ suggestions, which are the self-improvement layer that surfaces what an agent is missing, not the content itself.",
|
|
8568
|
+
{
|
|
8569
|
+
agentId: import_zod21.z.string().optional(),
|
|
8570
|
+
page: import_zod21.z.number().int().min(1).optional(),
|
|
8571
|
+
limit: import_zod21.z.number().int().min(1).optional(),
|
|
8572
|
+
search: import_zod21.z.string().optional().describe("Search by title/description.")
|
|
8573
|
+
},
|
|
8574
|
+
{ title: "List Voice Agent Resources", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
8575
|
+
async (params) => {
|
|
8576
|
+
try {
|
|
8577
|
+
const result = await api.get("/v1/voice/agent-resources", { params });
|
|
8578
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8579
|
+
} catch (err) {
|
|
8580
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8581
|
+
}
|
|
8582
|
+
}
|
|
8583
|
+
);
|
|
8584
|
+
registerSpeakTool(
|
|
8585
|
+
server,
|
|
8586
|
+
"create_voice_agent_resource",
|
|
8587
|
+
"Add one document/link to a voice agent's knowledge base. Requires the OWNER or ADMIN role. The server fetches and embeds the content in the background (status moves from pending to completed).",
|
|
8588
|
+
{ agentId: import_zod21.z.string().min(1), ...resourceBodySchema },
|
|
8589
|
+
{ title: "Create Voice Agent Resource", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
8590
|
+
async (body) => {
|
|
8591
|
+
try {
|
|
8592
|
+
const result = await api.post("/v1/voice/agent-resources", body);
|
|
8593
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8594
|
+
} catch (err) {
|
|
8595
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8596
|
+
}
|
|
8597
|
+
}
|
|
8598
|
+
);
|
|
8599
|
+
registerSpeakTool(
|
|
8600
|
+
server,
|
|
8601
|
+
"bulk_create_voice_agent_resources",
|
|
8602
|
+
"Add up to 100 documents/links to a voice agent's knowledge base in one call. Requires the OWNER or ADMIN role. Each is fetched and embedded independently in the background. Use this instead of calling create_voice_agent_resource in a loop.",
|
|
8603
|
+
{
|
|
8604
|
+
agentId: import_zod21.z.string().min(1),
|
|
8605
|
+
resources: import_zod21.z.array(import_zod21.z.object(resourceBodySchema)).min(1).max(100).describe("1 to 100 entries, each shaped like create_voice_agent_resource's body minus agentId.")
|
|
8606
|
+
},
|
|
8607
|
+
{ title: "Bulk Create Voice Agent Resources", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
8608
|
+
async (body) => {
|
|
8609
|
+
try {
|
|
8610
|
+
const result = await api.post("/v1/voice/agent-resources/bulk", body);
|
|
8611
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8612
|
+
} catch (err) {
|
|
8613
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8614
|
+
}
|
|
8615
|
+
}
|
|
8616
|
+
);
|
|
8617
|
+
registerSpeakTool(
|
|
8618
|
+
server,
|
|
8619
|
+
"update_voice_agent_resource",
|
|
8620
|
+
"Partially update a voice agent resource \u2014 send at least one field. Requires the OWNER or ADMIN role. agentId cannot be changed. Changing url, title, or description re-triggers embedding.",
|
|
8621
|
+
{
|
|
8622
|
+
resourceId: import_zod21.z.string().min(1).describe("ID of the resource to update (from list_voice_agent_resources)"),
|
|
8623
|
+
url: import_zod21.z.string().url().optional(),
|
|
8624
|
+
title: import_zod21.z.string().max(200).optional(),
|
|
8625
|
+
description: import_zod21.z.string().max(1e3).optional(),
|
|
8626
|
+
action: import_zod21.z.enum(["link", "presentation"]).optional(),
|
|
8627
|
+
contentType: import_zod21.z.enum(["video", "pdf", "image"]).optional()
|
|
8628
|
+
},
|
|
8629
|
+
{ title: "Update Voice Agent Resource", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
8630
|
+
async ({ resourceId, ...body }) => {
|
|
8631
|
+
try {
|
|
8632
|
+
const result = await api.put(`/v1/voice/agent-resources/${resourceId}`, body);
|
|
8633
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8634
|
+
} catch (err) {
|
|
8635
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8636
|
+
}
|
|
8637
|
+
}
|
|
8638
|
+
);
|
|
8639
|
+
registerSpeakTool(
|
|
8640
|
+
server,
|
|
8641
|
+
"delete_voice_agent_resource",
|
|
8642
|
+
"Soft-delete a voice agent resource \u2014 it stops appearing in lists and the agent stops searching it, but the document is not physically removed. Requires the OWNER or ADMIN role.",
|
|
8643
|
+
{ resourceId: import_zod21.z.string().min(1).describe("ID of the resource to delete (from list_voice_agent_resources)") },
|
|
8644
|
+
{ title: "Delete Voice Agent Resource", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
8645
|
+
async ({ resourceId }) => {
|
|
8646
|
+
try {
|
|
8647
|
+
const result = await api.delete(`/v1/voice/agent-resources/${resourceId}`);
|
|
8648
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8649
|
+
} catch (err) {
|
|
8650
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8651
|
+
}
|
|
8652
|
+
}
|
|
8653
|
+
);
|
|
8654
|
+
registerSpeakTool(
|
|
8655
|
+
server,
|
|
8656
|
+
"analyze_voice_instruction_gaps",
|
|
8657
|
+
"Advisory only \u2014 compares a voice agent's current instructions against anchors/original intent/recent call summaries you supply and suggests up to 3 patches. Requires the OWNER or ADMIN role. Nothing is written; pass a suggestion's suggestedPatch to apply_voice_instruction_gap to actually apply it.",
|
|
8658
|
+
{
|
|
8659
|
+
agentId: import_zod21.z.string().min(1).describe("ID of the voice agent (from list_voice_agents)"),
|
|
8660
|
+
anchors: import_zod21.z.array(import_zod21.z.string()).optional().describe("Specific requirements the instructions must cover. Defaults to empty."),
|
|
8661
|
+
originalPrompt: import_zod21.z.string().optional().describe("The original generation prompt, for context."),
|
|
8662
|
+
conversationSummaries: import_zod21.z.array(import_zod21.z.string()).optional().describe("Recent call summaries, to ground suggestions in what actually came up. Defaults to empty.")
|
|
8663
|
+
},
|
|
8664
|
+
{ title: "Analyze Voice Instruction Gaps", readOnlyHint: true, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
8665
|
+
async ({ agentId, ...body }) => {
|
|
8666
|
+
try {
|
|
8667
|
+
const result = await api.post(`/v1/voice/agents/${agentId}/generation/gaps/analyze`, body);
|
|
8668
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8669
|
+
} catch (err) {
|
|
8670
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8671
|
+
}
|
|
8672
|
+
}
|
|
8673
|
+
);
|
|
8674
|
+
registerSpeakTool(
|
|
8675
|
+
server,
|
|
8676
|
+
"apply_voice_instruction_gap",
|
|
8677
|
+
"Insert a suggested instruction patch into a voice agent's instructions and persist the result. Requires the OWNER or ADMIN role. suggestedPatch is typically taken directly from analyze_voice_instruction_gaps.",
|
|
8678
|
+
{
|
|
8679
|
+
agentId: import_zod21.z.string().min(1).describe("ID of the voice agent (from list_voice_agents)"),
|
|
8680
|
+
suggestedPatch: import_zod21.z.string().min(1),
|
|
8681
|
+
insertAfterSection: import_zod21.z.string().optional().nullable().describe("Insert after this named section heading; omit or null to append at the end.")
|
|
8682
|
+
},
|
|
8683
|
+
{ title: "Apply Voice Instruction Gap", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
8684
|
+
async ({ agentId, ...body }) => {
|
|
8685
|
+
try {
|
|
8686
|
+
const result = await api.post(`/v1/voice/agents/${agentId}/generation/gaps/apply`, body);
|
|
8687
|
+
return { content: [{ type: "text", text: JSON.stringify(result.data, null, 2) }] };
|
|
8688
|
+
} catch (err) {
|
|
8689
|
+
return { content: [{ type: "text", text: `Error: ${formatAxiosError(err)}` }], isError: true };
|
|
8690
|
+
}
|
|
8691
|
+
}
|
|
8692
|
+
);
|
|
8693
|
+
}
|
|
8694
|
+
var import_zod21, resourceBodySchema;
|
|
8695
|
+
var init_voice_intelligence = __esm({
|
|
8696
|
+
"src/tools/voice-intelligence.ts"() {
|
|
8697
|
+
"use strict";
|
|
8698
|
+
import_zod21 = require("zod");
|
|
8699
|
+
init_helpers();
|
|
8700
|
+
init_client();
|
|
8701
|
+
resourceBodySchema = {
|
|
8702
|
+
url: import_zod21.z.string().url(),
|
|
8703
|
+
title: import_zod21.z.string().max(200),
|
|
8704
|
+
description: import_zod21.z.string().max(1e3),
|
|
8705
|
+
action: import_zod21.z.enum(["link", "presentation"]),
|
|
8706
|
+
contentType: import_zod21.z.enum(["video", "pdf", "image"]).optional()
|
|
8707
|
+
};
|
|
8708
|
+
}
|
|
8709
|
+
});
|
|
8710
|
+
|
|
7559
8711
|
// src/tools/index.ts
|
|
7560
8712
|
var tools_exports = {};
|
|
7561
8713
|
__export(tools_exports, {
|
|
@@ -7586,6 +8738,10 @@ var init_tools = __esm({
|
|
|
7586
8738
|
init_workflows();
|
|
7587
8739
|
init_users();
|
|
7588
8740
|
init_dashboards();
|
|
8741
|
+
init_voice();
|
|
8742
|
+
init_voice_testing();
|
|
8743
|
+
init_voice_questions();
|
|
8744
|
+
init_voice_intelligence();
|
|
7589
8745
|
modules = [
|
|
7590
8746
|
media_exports,
|
|
7591
8747
|
text_exports,
|
|
@@ -7602,7 +8758,11 @@ var init_tools = __esm({
|
|
|
7602
8758
|
clips_exports,
|
|
7603
8759
|
workflows_exports,
|
|
7604
8760
|
users_exports,
|
|
7605
|
-
dashboards_exports
|
|
8761
|
+
dashboards_exports,
|
|
8762
|
+
voice_exports,
|
|
8763
|
+
voice_testing_exports,
|
|
8764
|
+
voice_questions_exports,
|
|
8765
|
+
voice_intelligence_exports
|
|
7606
8766
|
];
|
|
7607
8767
|
}
|
|
7608
8768
|
});
|
|
@@ -7719,8 +8879,8 @@ function registerPrompts(server) {
|
|
|
7719
8879
|
"analyze-meeting",
|
|
7720
8880
|
"Upload a meeting recording and get a full analysis \u2014 transcript, insights, action items, and key takeaways.",
|
|
7721
8881
|
{
|
|
7722
|
-
url:
|
|
7723
|
-
name:
|
|
8882
|
+
url: import_zod22.z.string().describe(`URL of the meeting recording \u2014 a direct file link, or a shareable page link from ${SUPPORTED_URL_SOURCES} (resolved to the underlying media automatically)`),
|
|
8883
|
+
name: import_zod22.z.string().optional().describe("Meeting name (optional)")
|
|
7724
8884
|
},
|
|
7725
8885
|
async ({ url, name }) => ({
|
|
7726
8886
|
messages: [
|
|
@@ -7755,8 +8915,8 @@ function registerPrompts(server) {
|
|
|
7755
8915
|
"research-across-media",
|
|
7756
8916
|
"Search for themes, patterns, or topics across multiple recordings or your entire media library.",
|
|
7757
8917
|
{
|
|
7758
|
-
topic:
|
|
7759
|
-
folder:
|
|
8918
|
+
topic: import_zod22.z.string().describe("The topic, theme, or question to research"),
|
|
8919
|
+
folder: import_zod22.z.string().optional().describe("Folder ID to scope the research (optional)")
|
|
7760
8920
|
},
|
|
7761
8921
|
async ({ topic, folder }) => ({
|
|
7762
8922
|
messages: [
|
|
@@ -7789,8 +8949,8 @@ function registerPrompts(server) {
|
|
|
7789
8949
|
"meeting-brief",
|
|
7790
8950
|
"Prepare a brief from recent meetings \u2014 pull transcripts, extract decisions, and summarize open items.",
|
|
7791
8951
|
{
|
|
7792
|
-
days:
|
|
7793
|
-
folder:
|
|
8952
|
+
days: import_zod22.z.string().optional().describe("Number of days to look back (default: 7)"),
|
|
8953
|
+
folder: import_zod22.z.string().optional().describe("Folder ID to scope to (optional)")
|
|
7794
8954
|
},
|
|
7795
8955
|
async ({ days, folder }) => {
|
|
7796
8956
|
const lookback = parseInt(days ?? "7");
|
|
@@ -7827,11 +8987,11 @@ function registerPrompts(server) {
|
|
|
7827
8987
|
}
|
|
7828
8988
|
);
|
|
7829
8989
|
}
|
|
7830
|
-
var
|
|
8990
|
+
var import_zod22;
|
|
7831
8991
|
var init_prompts = __esm({
|
|
7832
8992
|
"src/prompts.ts"() {
|
|
7833
8993
|
"use strict";
|
|
7834
|
-
|
|
8994
|
+
import_zod22 = require("zod");
|
|
7835
8995
|
init_media_utils();
|
|
7836
8996
|
}
|
|
7837
8997
|
});
|
|
@@ -7980,7 +9140,61 @@ var init_tool_names = __esm({
|
|
|
7980
9140
|
"delete_dashboard",
|
|
7981
9141
|
"duplicate_dashboard",
|
|
7982
9142
|
"share_dashboard",
|
|
7983
|
-
"get_dashboard_speakers_insight"
|
|
9143
|
+
"get_dashboard_speakers_insight",
|
|
9144
|
+
// voice: agents + conversations
|
|
9145
|
+
"list_voice_agents",
|
|
9146
|
+
"get_voice_agent",
|
|
9147
|
+
"create_voice_agent",
|
|
9148
|
+
"update_voice_agent",
|
|
9149
|
+
"list_voice_avatars",
|
|
9150
|
+
"list_voices",
|
|
9151
|
+
"list_voice_conversations",
|
|
9152
|
+
"get_voice_conversation",
|
|
9153
|
+
// voice: testing
|
|
9154
|
+
"get_voice_test_suite",
|
|
9155
|
+
"update_voice_test_suite",
|
|
9156
|
+
"generate_voice_test_suite",
|
|
9157
|
+
"start_voice_test_run",
|
|
9158
|
+
"get_active_voice_test_run",
|
|
9159
|
+
"pause_voice_test_run",
|
|
9160
|
+
"resume_voice_test_run",
|
|
9161
|
+
"cancel_voice_test_run",
|
|
9162
|
+
"list_voice_test_runs",
|
|
9163
|
+
"get_voice_test_run",
|
|
9164
|
+
"apply_voice_test_recommendation",
|
|
9165
|
+
"get_voice_test_baseline",
|
|
9166
|
+
"get_voice_test_score_history",
|
|
9167
|
+
// voice: agents round-out + discovery
|
|
9168
|
+
"delete_voice_agent",
|
|
9169
|
+
"create_voice_agent_from_prompt",
|
|
9170
|
+
"generate_voice_agent_config",
|
|
9171
|
+
"get_voice_agent_setup_guide",
|
|
9172
|
+
// voice: questions
|
|
9173
|
+
"list_voice_questions",
|
|
9174
|
+
"get_voice_question",
|
|
9175
|
+
"create_voice_question",
|
|
9176
|
+
"update_voice_question",
|
|
9177
|
+
"delete_voice_question",
|
|
9178
|
+
"reorder_voice_questions",
|
|
9179
|
+
"list_voice_question_templates",
|
|
9180
|
+
"create_voice_question_template",
|
|
9181
|
+
// voice: intelligence (kb gaps, faq suggestions, agent resources, instruction gaps)
|
|
9182
|
+
"list_voice_kb_gaps",
|
|
9183
|
+
"analyze_voice_kb_gaps",
|
|
9184
|
+
"add_voice_kb_gap",
|
|
9185
|
+
"dismiss_voice_kb_gap",
|
|
9186
|
+
"list_voice_faq_suggestions",
|
|
9187
|
+
"generate_voice_faq_suggestions",
|
|
9188
|
+
"add_voice_faq_suggestion",
|
|
9189
|
+
"update_voice_faq_suggestion",
|
|
9190
|
+
"dismiss_voice_faq_suggestion",
|
|
9191
|
+
"list_voice_agent_resources",
|
|
9192
|
+
"create_voice_agent_resource",
|
|
9193
|
+
"bulk_create_voice_agent_resources",
|
|
9194
|
+
"update_voice_agent_resource",
|
|
9195
|
+
"delete_voice_agent_resource",
|
|
9196
|
+
"analyze_voice_instruction_gaps",
|
|
9197
|
+
"apply_voice_instruction_gap"
|
|
7984
9198
|
];
|
|
7985
9199
|
}
|
|
7986
9200
|
});
|