speak
Convert text to speech on macOS using customizable voice options, rate control, and background mode for uninterrupted MCP server interactions.
Instructions
Use macOS text-to-speech to speak text aloud
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| background | No | Run speech in background to unblock further MCP interaction | |
| rate | No | Speaking rate (words per minute) | |
| text | Yes | Text to speak | |
| voice | No | Voice to use (e.g., "Alex", "Victoria", "Daniel") | Alex |
Input Schema (JSON Schema)
{
"properties": {
"background": {
"default": false,
"description": "Run speech in background to unblock further MCP interaction",
"type": "boolean"
},
"rate": {
"default": 175,
"description": "Speaking rate (words per minute)",
"maximum": 500,
"minimum": 1,
"type": "number"
},
"text": {
"description": "Text to speak",
"type": "string"
},
"voice": {
"default": "Alex",
"description": "Voice to use (e.g., \"Alex\", \"Victoria\", \"Daniel\")",
"type": "string"
}
},
"required": [
"text"
],
"type": "object"
}
Implementation Reference
- src/index.ts:88-112 (handler)Handler for the 'speak' tool: destructures arguments, executes macOS 'say' command asynchronously, returns success message or throws error.case 'speak': { const { text, voice = 'Alex', rate = 175, background = false } = request.params.arguments as { text: string; voice?: string; rate?: number; background?: boolean; }; try { await execAsync(`say -v "${voice}" -r ${rate} "${text.replace(/"/g, '\"')}"${background ? ' &' : ''}`); return { content: [ { type: 'text', text: `Successfully spoke text using voice "${voice}" at ${rate} words per minute${background ? ' (in background)' : ''}`, }, ], }; } catch (error: any) { throw new McpError( ErrorCode.InternalError, `Failed to speak text: ${error.message}` ); } }
- src/index.ts:45-74 (registration)Tool registration in ListToolsRequestHandler response: defines name, description, and detailed input schema with properties, defaults, and requirements.name: 'speak', description: 'Use macOS text-to-speech to speak text aloud', inputSchema: { type: 'object', properties: { text: { type: 'string', description: 'Text to speak', }, voice: { type: 'string', description: 'Voice to use (e.g., "Alex", "Victoria", "Daniel")', default: 'Alex', }, rate: { type: 'number', description: 'Speaking rate (words per minute)', minimum: 1, maximum: 500, default: 175, }, background: { type: 'boolean', description: 'Run speech in background to unblock further MCP interaction', default: false, }, }, required: ['text'], }, },