Skip to main content
Glama

generate_sound_effect

Create custom sound effects from text descriptions using AI audio generation. Specify duration and receive audio files for multimedia projects.

Instructions

Generate sound effects from a text description

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYesDescription of the sound effect to generate
durationNoDuration of the sound effect in seconds
webhook_urlNoURL for callback upon completion

Implementation Reference

  • The handler function that executes the generate_sound_effect tool. It validates the prompt, sends a POST request to the /soundgenerator endpoint with prompt, optional duration and webhook_url, and returns a status 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:646-649 (registration)
    The request handler for listing tools, which returns the TOOLS array containing the generate_sound_effect tool definition.
    ListToolsRequestSchema,
    async () => ({
      tools: TOOLS,
    })
  • The tool definition in the TOOLS constant, including name, description, and input schema specifying required 'prompt' and optional 'duration' and 'webhook_url'.
      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)
    The switch case in the CallToolRequestSchema handler that routes calls to generate_sound_effect to its handler function.
    case "generate_sound_effect":
      return await this.handleGenerateSoundEffect(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