Skip to main content
Glama

generate_lyrics

Create song lyrics for any theme or genre. Provide a prompt to generate customized lyrics for music projects.

Instructions

Generate song lyrics based on a theme or prompt

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYesTheme or prompt for lyrics generation
genreNoMusic genre for the lyrics

Implementation Reference

  • The handler function that implements the core logic for the 'generate_lyrics' tool. It validates the prompt input, makes a GET request to the MusicGPT API's /lyrics_generator endpoint, and returns the generated lyrics as a formatted JSON response.
    private async handleGenerateLyrics(args: any) {
      if (!args.prompt) {
        throw new McpError(ErrorCode.InvalidParams, "prompt is required");
      }
    
      const response = await this.axiosInstance.get("/lyrics_generator", {
        params: {
          prompt: args.prompt,
          genre: args.genre,
        },
      });
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(response.data, null, 2),
          },
        ],
      };
    }
  • The tool schema definition for 'generate_lyrics', including name, description, and inputSchema used for MCP tool listing (via ListToolsRequestHandler) and input validation.
    {
      name: "generate_lyrics",
      description: "Generate song lyrics based on a theme or prompt",
      inputSchema: {
        type: "object" as const,
        properties: {
          prompt: {
            type: "string",
            description: "Theme or prompt for lyrics generation",
          },
          genre: {
            type: "string",
            description: "Music genre for the lyrics",
          },
        },
        required: ["prompt"],
      },
    },
  • src/index.ts:719-720 (registration)
    The switch case registration that maps incoming tool calls for 'generate_lyrics' to the handleGenerateLyrics handler function in the CallToolRequestHandler.
    case "generate_lyrics":
      return await this.handleGenerateLyrics(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