send_sms
Send SMS messages to phone numbers using ClickSend's API. This tool enables programmatic SMS delivery with built-in rate limiting and input validation for reliable communication.
Instructions
Send SMS messages via ClickSend
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | Phone number in E.164 format (e.g. +61423456789) | |
| message | Yes | Message content to send |
Implementation Reference
- src/client.ts:30-50 (handler)The core handler function in ClickSendClient that executes the SMS sending logic via the ClickSend API, including payload construction and error handling.async sendSMS(params: SMSMessage) { const payload = { messages: [ { source: 'mcp', body: params.message, to: params.to } ] }; try { const response = await this.client.post('/sms/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; } }
- src/index.ts:65-82 (registration)Registration of the 'send_sms' tool in the ListTools handler, including name, description, and input schema.name: 'send_sms', description: 'Send SMS messages via ClickSend', inputSchema: { type: 'object', properties: { to: { type: 'string', description: 'Phone number in E.164 format (e.g. +61423456789)' }, message: { type: 'string', description: 'Message content to send' } }, required: ['to', 'message'], additionalProperties: false } },
- src/index.ts:116-128 (handler)Server-side dispatch handler for 'send_sms' tool calls, including validation and delegation to client.sendSMS.case 'send_sms': { const { to, message } = request.params.arguments as { to: string; message: string }; validateSMSParams(to, message); const result = await this.client.sendSMS({ to, message }); return { content: [ { type: 'text', text: `SMS sent successfully: ${JSON.stringify(result)}` } ] }; }
- src/client.ts:3-6 (schema)TypeScript interface defining the input parameters for sendSMS.export interface SMSMessage { to: string; message: string; }
- src/utils/validation.ts:19-26 (helper)Validation helper function for SMS parameters used in the tool handler.export function validateSMSParams(to: string, message: 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'); } }