@chinchillaenterprises/mcp-ai-assistant
Version:
MCP server for AI assistant with ElevenLabs text-to-speech integration
59 lines • 2.37 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.listVoicesTool = void 0;
const zod_1 = require("zod");
const account_state_js_1 = require("../../services/account-state.js");
const elevenlabs_client_js_1 = require("../../services/elevenlabs-client.js");
const inputSchema = zod_1.z.object({
category: zod_1.z.string().optional().describe('Filter voices by category'),
includeSettings: zod_1.z.boolean().optional().describe('Include voice settings in response')
});
exports.listVoicesTool = {
name: 'elevenlabs_list_voices',
description: 'List all available voices from ElevenLabs',
inputSchema,
handler: async (args) => {
const accountState = new account_state_js_1.AccountState();
const client = new elevenlabs_client_js_1.ElevenLabsClient(accountState);
try {
const voices = await client.getVoices();
let filteredVoices = voices;
if (args.category) {
filteredVoices = voices.filter(voice => voice.category === args.category);
}
const voiceList = filteredVoices.map(voice => ({
voice_id: voice.voice_id,
name: voice.name,
category: voice.category,
description: voice.description,
labels: voice.labels,
preview_url: voice.preview_url,
is_public: voice.is_public,
is_owner: voice.is_owner,
settings: args.includeSettings ? voice.settings : undefined
}));
return {
content: [{
type: 'text',
text: JSON.stringify({
success: true,
count: voiceList.length,
voices: voiceList
}, null, 2)
}]
};
}
catch (error) {
return {
content: [{
type: 'text',
text: JSON.stringify({
success: false,
error: error instanceof Error ? error.message : 'Unknown error occurred'
}, null, 2)
}]
};
}
}
};
//# sourceMappingURL=list-voices.js.map