UNPKG

@sinch/mcp

Version:

Sinch MCP server

29 lines 1.51 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getCallInformationHandler = exports.registerGetCallInformation = void 0; const zod_1 = require("zod"); const voice_tools_helper_1 = require("./utils/voice-tools-helper"); const types_1 = require("../../types"); const voice_service_helper_1 = require("./utils/voice-service-helper"); const utils_1 = require("../../utils"); const TOOL_KEY = 'getCallInformation'; const TOOL_NAME = (0, voice_tools_helper_1.getToolName)(TOOL_KEY); const registerGetCallInformation = (server, tags) => { if (!(0, voice_tools_helper_1.shouldRegisterTool)(TOOL_KEY, tags)) return; server.tool(TOOL_NAME, 'Get information about a call using its ID', { callId: zod_1.z.string().describe('The call ID to get information about') }, exports.getCallInformationHandler); }; exports.registerGetCallInformation = registerGetCallInformation; const getCallInformationHandler = async ({ callId }) => { const maybeClient = (0, voice_service_helper_1.getVoiceClient)(TOOL_NAME); if ((0, utils_1.isPromptResponse)(maybeClient)) { return maybeClient.promptResponse; } const voiceService = maybeClient.voice; const response = await voiceService.calls.get({ callId }); return new types_1.PromptResponse(`Call information for call ID ${callId}: ${JSON.stringify(response)}`).promptResponse; }; exports.getCallInformationHandler = getCallInformationHandler; //# sourceMappingURL=get-call-information.js.map