@callzero/mcp
Version:
MCP server for CallZero AI phone call automation
47 lines (46 loc) • 1.46 kB
JavaScript
import { GetCallTranscriptInputSchema } from "../schemas.js";
export function createGetCallTranscriptTool(client) {
return {
name: "get_call_transcript",
description: "Get the full transcript and detailed information of a completed phone call by its ID.",
inputSchema: {
type: "object",
properties: {
callId: {
type: "string",
description: "ID of the call to get transcript for",
},
},
required: ["callId"],
},
};
}
export async function handleGetCallTranscript(client, args) {
try {
// Validate input
const validatedInput = GetCallTranscriptInputSchema.parse(args);
// Call HTTP API
const result = await client.getCallTranscript(validatedInput);
return {
content: [
{
type: "text",
text: JSON.stringify(result, null, 2),
},
],
};
}
catch (error) {
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
return {
content: [
{
type: "text",
text: JSON.stringify({
error: `Failed to get call transcript: ${errorMessage}`,
}, null, 2),
},
],
};
}
}