generate_sound_effect
Create custom sound effects from text descriptions for use in music production, videos, or multimedia projects.
Instructions
Generate sound effects from a text description
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes | Description of the sound effect to generate | |
| duration | No | Duration of the sound effect in seconds | |
| webhook_url | No | URL for callback upon completion |
Implementation Reference
- src/index.ts:875-894 (handler)The main handler function that executes the generate_sound_effect tool by making a POST request to the MusicGPT API's /soundgenerator endpoint with the provided prompt, duration, and webhook_url. Returns a response message with task details.private async handleGenerateSoundEffect(args: any) { if (!args.prompt) { throw new McpError(ErrorCode.InvalidParams, "prompt is required"); } const response = await this.axiosInstance.post("/soundgenerator", { prompt: args.prompt, duration: args.duration, webhook_url: args.webhook_url, }); return { content: [ { type: "text", text: `Sound effect generation started!\n\n${JSON.stringify(response.data, null, 2)}\n\nUse get_conversion_by_id with the task_id to check the status.`, }, ], }; }
- src/index.ts:183-204 (schema)Tool schema definition including name, description, and input schema for generate_sound_effect, used for tool listing and validation.{ name: "generate_sound_effect", description: "Generate sound effects from a text description", inputSchema: { type: "object" as const, properties: { prompt: { type: "string", description: "Description of the sound effect to generate", }, duration: { type: "number", description: "Duration of the sound effect in seconds", }, webhook_url: { type: "string", description: "URL for callback upon completion", }, }, required: ["prompt"], }, },
- src/index.ts:673-674 (registration)Switch case registration that dispatches calls to the generate_sound_effect tool to its handler function.case "generate_sound_effect": return await this.handleGenerateSoundEffect(args);
- src/index.ts:648-649 (registration)Registration of all tools including generate_sound_effect via the TOOLS array returned in ListToolsRequestSchema handler.tools: TOOLS, })