Skip to main content
Glama
J-Gal02

ClickSend MCP Server

make_tts_call

Convert text to speech and deliver phone calls programmatically using ClickSend's API. Specify recipient number, message content, and voice type to initiate automated voice calls.

Instructions

Make Text-to-Speech calls via ClickSend

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toYesPhone number in E.164 format
messageYesText content to convert to speech
voiceNoVoice type for TTSfemale

Implementation Reference

  • MCP tool handler for 'make_tts_call': extracts arguments, validates parameters using validateTTSParams, calls ClickSendClient.makeTTSCall, and returns a text content response with the API result.
    case 'make_tts_call': {
      const { to, message, voice } = request.params.arguments as { 
        to: string; 
        message: string; 
        voice?: 'male' | 'female' 
      };
      validateTTSParams(to, message, voice);
      const result = await this.client.makeTTSCall({ to, message, voice });
      return {
        content: [
          {
            type: 'text',
            text: `TTS call initiated successfully: ${JSON.stringify(result)}`
          }
        ]
      };
    }
  • Input schema definition for the 'make_tts_call' tool, specifying properties for 'to', 'message', and optional 'voice' with types and requirements.
    inputSchema: {
      type: 'object',
      properties: {
        to: {
          type: 'string',
          description: 'Phone number in E.164 format'
        },
        message: {
          type: 'string',
          description: 'Text content to convert to speech'
        },
        voice: {
          type: 'string',
          enum: ['female', 'male'],
          default: 'female',
          description: 'Voice type for TTS'
        }
      },
      required: ['to', 'message'],
      additionalProperties: false
    }
  • src/index.ts:83-107 (registration)
    Registration of the 'make_tts_call' tool in the ListTools response, including name, description, and full input schema.
    {
      name: 'make_tts_call',
      description: 'Make Text-to-Speech calls via ClickSend',
      inputSchema: {
        type: 'object',
        properties: {
          to: {
            type: 'string',
            description: 'Phone number in E.164 format'
          },
          message: {
            type: 'string',
            description: 'Text content to convert to speech'
          },
          voice: {
            type: 'string',
            enum: ['female', 'male'],
            default: 'female',
            description: 'Voice type for TTS'
          }
        },
        required: ['to', 'message'],
        additionalProperties: false
      }
    }
  • Core implementation of makeTTSCall in ClickSendClient: constructs TTS payload and sends POST request to ClickSend /voice/send endpoint, handles errors.
    async makeTTSCall(params: TTSMessage) {
      const payload = {
        messages: [
          {
            to: params.to,
            body: params.message,
            voice: params.voice || 'female',
            require_input: 0,
            machine_detection: 0
          }
        ]
      };
    
      try {
        const response = await this.client.post('/voice/send', payload);
        return response.data;
      } catch (error) {
        if (axios.isAxiosError(error)) {
          throw new Error(`ClickSend API Error: ${error.response?.data?.message || error.message}`);
        }
        throw error;
      }
    }
  • Validation helper validateTTSParams: checks E.164 phone format, message length (1-1600 chars), and valid voice option ('male' or 'female').
    export function validateTTSParams(to: string, message: string, voice?: string): void {
      if (!validatePhoneNumber(to)) {
        throw new ValidationError('Invalid phone number format. Must be in E.164 format (e.g., +61423456789)');
      }
      if (!validateMessage(message)) {
        throw new ValidationError('Invalid message. Must be between 1 and 1600 characters');
      }
      if (voice && !['male', 'female'].includes(voice)) {
        throw new ValidationError('Invalid voice option. Must be either "male" or "female"');
      }
    }
Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/J-Gal02/clicksend-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server