Skip to main content
Glama

voice_design

Generate custom voices using description prompts and preview text with MiniMax MCP JS. Save outputs to specified directories for text-to-speech applications.

Instructions

Generate a voice based on description prompts.

Note: This tool calls MiniMax API and may incur costs. Use only when explicitly requested by the user.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
outputDirectoryNoThe directory to save the output file. `outputDirectory` is relative to `MINIMAX_MCP_BASE_PATH` (or `basePath` in config). The final save path is `${basePath}/${outputDirectory}`. For example, if `MINIMAX_MCP_BASE_PATH=~/Desktop` and `outputDirectory=workspace`, the output will be saved to `~/Desktop/workspace/`
previewTextYesThe text to preview the voice
promptYesThe prompt to generate the voice from
voiceIdNoThe id of the voice to use. For example, "male-qn-qingse"/"audiobook_female_1"/"cute_boy"/"Charming_Lady"...

Implementation Reference

  • Core handler implementing the voice_design tool logic: validates inputs, calls MiniMax /v1/voice_design API, decodes hex audio response, saves MP3 preview file, returns voiceId and outputFile.
    async voiceDesign(request: VoiceDesignRequest): Promise<any> {
      // Validate required parameters
      if (!request.prompt || request.prompt.trim() === '') {
        throw new MinimaxRequestError(ERROR_PROMPT_REQUIRED);
      }
      if (!request.previewText || request.previewText.trim() === '') {
        throw new MinimaxRequestError(ERROR_PREVIEW_TEXT_REQUIRED);
      }
    
      // Process output file
      const textPrefix = request.prompt.substring(0, 20).replace(/[^\w]/g, '_');
      const fileName = `voice_design_${textPrefix}_${Date.now()}`;
      const outputFile = buildOutputFile(fileName, request.outputDirectory, 'mp3');
    
      // Prepare request data
      const requestData: Record<string, any> = {
        prompt: request.prompt,
        preview_text: request.previewText,
        voice_id: request.voiceId,
      };
    
      try {
        // Send request
        const response = await this.api.post<any>('/v1/voice_design', requestData);
    
        // Process response
        const trialAudioData = response?.trial_audio;
        const voiceId = response?.voice_id;
    
        if (!trialAudioData) {
          throw new MinimaxRequestError('Could not get audio data from response');
        }
    
        // decode and save file
        try {
          // Convert hex string to binary
          const audioBuffer = Buffer.from(trialAudioData, 'hex');
    
          // Ensure output directory exists
          const outputDir = path.dirname(outputFile);
          if (!fs.existsSync(outputDir)) {
            fs.mkdirSync(outputDir, { recursive: true });
          }
    
          // Write to file
          fs.writeFileSync(outputFile, audioBuffer);
    
          return {
            voiceId,
            outputFile,
          };
        } catch (error) {
          throw new MinimaxRequestError(`Failed to save audio file: ${String(error)}`);
        }
      } catch (err) {
        throw err;
      }
    }
  • Registers the 'voice_design' MCP tool with name, description, Zod input schema (prompt, previewText, voiceId?, outputDirectory?), and async handler that calls VoiceDesignAPI and formats response.
    private registerVoiceDesignTool(): void {
      this.server.tool(
        'voice_design',
        'Generate a voice based on description prompts.\n\nNote: This tool calls MiniMax API and may incur costs. Use only when explicitly requested by the user.',
        {
          prompt: z
            .string()
            .describe('The prompt to generate the voice from'),
          previewText: z
            .string()
            .describe('The text to preview the voice'),
          voiceId: z
            .string()
            .optional()
            .describe('The id of the voice to use. For example, "male-qn-qingse"/"audiobook_female_1"/"cute_boy"/"Charming_Lady"...'),
          outputDirectory: COMMON_PARAMETERS_SCHEMA.outputDirectory,
        },
        async (params) => {
          try {
            // No need to update configuration from request parameters in stdio mode
            const { voiceId, outputFile } = await this.voiceDesignApi.voiceDesign(params);
    
            // Handle different output formats
            if (this.config.resourceMode === RESOURCE_MODE_URL) {
              return {
                content: [
                  {
                    type: 'text',
                    text: `Success. Voice ID: ${voiceId}. Voice URL: ${outputFile}`,
                  },
                ],
              };
            } else {
              return {
                content: [
                  {
                    type: 'text',
                    text: `Success. Voice ID: ${voiceId}. Voice saved as: ${outputFile}`,
                  },
                ],
              };
            }
          } catch (error) {
            return {  
              content: [
                {
                  type: 'text',
                  text: `Failed to design voice: ${error instanceof Error ? error.message : String(error)}`,
                },
              ],
            };
          }
        },
      );
    }
  • TypeScript interface defining the structure of VoiceDesignRequest: prompt (required), previewText (required), voiceId (optional), inherits outputDirectory from BaseToolRequest.
    export interface VoiceDesignRequest extends BaseToolRequest {
      prompt: string;
      previewText: string;
      voiceId?: string;
    }
  • Thin wrapper in MediaService that initializes and delegates to VoiceDesignAPI.voiceDesign, used by REST server handler.
    public async designVoice(params: any): Promise<any> {
      this.checkInitialized();
      try {
        return await this.voiceDesignApi.voiceDesign(params);
      } catch (error) {
        throw this.wrapError('Failed to design voice', error);
      }
    } 
  • Tool definition/schema for 'voice_design' in REST server's listTools handler, including arguments and inputSchema for protocol compliance.
      name: 'voice_design',
      description: 'Generate a voice based on description prompts',
      arguments: [
        { name: 'prompt', description: 'The prompt to generate the voice from', required: true },
        { name: 'previewText', description: 'The text to preview the voice', required: true },
        { name: 'voiceId', description: 'The id of the voice to use', required: false },
        { name: 'outputDirectory', description: OUTPUT_DIRECTORY_DESCRIPTION, required: false }
      ],
      inputSchema: {
        type: 'object',
        properties: {
          prompt: { type: 'string' },
          previewText: { type: 'string' },
          voiceId: { type: 'string' },
          outputDirectory: { type: 'string' }
        },
        required: ['prompt', 'previewText']
      }
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It adds valuable context: it discloses that the tool calls an external API (MiniMax) and may incur costs, which are critical behavioral traits not inferable from the schema alone. It doesn't detail rate limits or error handling, but this is sufficient for a high score given the lack of annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded: the first sentence states the core purpose, and the note adds essential context without redundancy. Every sentence earns its place, making it efficient and easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (voice generation with external API calls) and lack of output schema, the description is somewhat complete but has gaps. It covers purpose, usage constraints, and cost implications, but doesn't explain return values or potential errors. With no annotations and no output schema, more detail would improve completeness, but it's adequate for a minimum viable score.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, meaning the schema already documents all parameters thoroughly. The description adds no specific parameter information beyond the general 'description prompts' hint. According to the rules, with high schema coverage (>80%), the baseline is 3 even with no param info in the description, which applies here.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Generate a voice based on description prompts.' This specifies the verb ('Generate') and resource ('voice'), making it immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'voice_clone' or 'text_to_audio,' which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The note provides clear usage guidance: 'Use only when explicitly requested by the user.' This establishes a specific context for when to invoke the tool. However, it doesn't mention when NOT to use it or name alternatives among sibling tools, such as 'voice_clone' for different voice generation methods.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related 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/MiniMax-AI/MiniMax-MCP-JS'

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