@sinch/mcp
Version:
Sinch MCP server
34 lines • 1.77 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.startSmsVerificationHandler = exports.registerStartVerificationWithSms = void 0;
const zod_1 = require("zod");
const verification_service_helper_1 = require("./utils/verification-service-helper");
const utils_1 = require("../../utils");
const types_1 = require("../../types");
const registerStartVerificationWithSms = (server, tags) => {
if (!(0, utils_1.hasMatchingTag)(['all', 'verification'], tags)) {
return;
}
server.tool('start-sms-verification', 'Start new phone number verification requests. If the request is successful, you should ask the user to enter the OTP they received on the phone number we are verifying.', {
phoneNumber: zod_1.z.string().describe('Phone number in E.164 format to send the SMS to')
}, exports.startSmsVerificationHandler);
};
exports.registerStartVerificationWithSms = registerStartVerificationWithSms;
const startSmsVerificationHandler = async ({ phoneNumber }) => {
const maybeClient = (0, verification_service_helper_1.getVerificationService)();
if ((0, utils_1.isPromptResponse)(maybeClient)) {
return maybeClient.promptResponse;
}
const verificationService = maybeClient.verification;
const response = await verificationService.verifications.startSms({
startVerificationWithSmsRequestBody: {
identity: {
type: 'number',
endpoint: phoneNumber
}
}
});
return new types_1.PromptResponse(`Started verification for ${phoneNumber}. The verification ID is ${response.id}`).promptResponse;
};
exports.startSmsVerificationHandler = startSmsVerificationHandler;
//# sourceMappingURL=start-sms-verification.js.map