Skip to main content
Glama

generate_music

Create custom music from text prompts using AI. Generate songs with or without lyrics, instrumental tracks, or vocal-only versions based on specified styles and parameters.

Instructions

Generate custom music from a text prompt using AI. Can create songs with or without lyrics, instrumental tracks, or vocal-only versions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYesNatural language prompt for music generation (keep under 280 characters for best results)
music_styleNoStyle of music to generate (e.g., Rock, Pop, Jazz, Hip-Hop)
lyricsNoCustom lyrics for the generated music
make_instrumentalNoWhether to make the music instrumental (no vocals)
vocal_onlyNoWhether to generate only vocals of output audio
voice_idNoVoice model ID to use for vocals (use get_all_voices to find IDs)
webhook_urlNoURL for callback upon completion

Implementation Reference

  • The handler function that executes the generate_music tool. It validates the prompt, makes a POST request to the MusicGPT API /MusicAI endpoint with the provided arguments, and returns a response message with task details.
    private async handleGenerateMusic(args: any) { if (!args.prompt) { throw new McpError(ErrorCode.InvalidParams, "prompt is required"); } const response = await this.axiosInstance.post("/MusicAI", { prompt: args.prompt, music_style: args.music_style, lyrics: args.lyrics, make_instrumental: args.make_instrumental || false, vocal_only: args.vocal_only || false, voice_id: args.voice_id, webhook_url: args.webhook_url, }); return { content: [ { type: "text", text: `Music generation started!\n\n${JSON.stringify(response.data, null, 2)}\n\nUse get_conversion_by_id with the task_id or conversion_id to check the status.`, }, ], }; }
  • Input schema defining the parameters for the generate_music tool, including prompt (required), music_style, lyrics, make_instrumental, vocal_only, voice_id, and webhook_url.
    inputSchema: { type: "object" as const, properties: { prompt: { type: "string", description: "Natural language prompt for music generation (keep under 280 characters for best results)", }, music_style: { type: "string", description: "Style of music to generate (e.g., Rock, Pop, Jazz, Hip-Hop)", }, lyrics: { type: "string", description: "Custom lyrics for the generated music", }, make_instrumental: { type: "boolean", description: "Whether to make the music instrumental (no vocals)", default: false, }, vocal_only: { type: "boolean", description: "Whether to generate only vocals of output audio", default: false, }, voice_id: { type: "string", description: "Voice model ID to use for vocals (use get_all_voices to find IDs)", }, webhook_url: { type: "string", description: "URL for callback upon completion", }, }, required: ["prompt"], },
  • src/index.ts:121-160 (registration)
    Tool registration in the TOOLS array, which is returned by the listTools handler. Includes name, description, and inputSchema.
    { name: "generate_music", description: "Generate custom music from a text prompt using AI. Can create songs with or without lyrics, instrumental tracks, or vocal-only versions.", inputSchema: { type: "object" as const, properties: { prompt: { type: "string", description: "Natural language prompt for music generation (keep under 280 characters for best results)", }, music_style: { type: "string", description: "Style of music to generate (e.g., Rock, Pop, Jazz, Hip-Hop)", }, lyrics: { type: "string", description: "Custom lyrics for the generated music", }, make_instrumental: { type: "boolean", description: "Whether to make the music instrumental (no vocals)", default: false, }, vocal_only: { type: "boolean", description: "Whether to generate only vocals of output audio", default: false, }, voice_id: { type: "string", description: "Voice model ID to use for vocals (use get_all_voices to find IDs)", }, webhook_url: { type: "string", description: "URL for callback upon completion", }, }, required: ["prompt"], }, },
  • src/index.ts:669-670 (registration)
    Dispatch registration in the callToolRequest switch statement that routes execution to the handleGenerateMusic method.
    case "generate_music": return await this.handleGenerateMusic(args);

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/pasie15/mcp-server-musicgpt'

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