convert_audio_format
Convert audio files between formats like MP3, WAV, FLAC, OGG, and M4A. Specify input URL and desired output format for transformation.
Instructions
Convert audio file to a different format
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| audio_url | Yes | URL of the audio file to convert | |
| output_format | Yes | Desired output format | |
| webhook_url | No | URL for callback upon completion |
Implementation Reference
- src/index.ts:1035-1054 (handler)Executes the convert_audio_format tool by validating inputs, POSTing to MusicGPT API /fileconvert endpoint with audio_url, output_format, and optional webhook_url, then returns formatted response with task status polling instructions.private async handleConvertAudioFormat(args: any) { if (!args.audio_url || !args.output_format) { throw new McpError(ErrorCode.InvalidParams, "audio_url and output_format are required"); } const response = await this.axiosInstance.post("/fileconvert", { audio_url: args.audio_url, output_format: args.output_format, webhook_url: args.webhook_url, }); return { content: [ { type: "text", text: `Audio format conversion 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:337-355 (schema)Input schema validation for the tool parameters: required audio_url (string), output_format (string enum: mp3/wav/flac/ogg/m4a), optional webhook_url (string).inputSchema: { type: "object" as const, properties: { audio_url: { type: "string", description: "URL of the audio file to convert", }, output_format: { type: "string", description: "Desired output format", enum: ["mp3", "wav", "flac", "ogg", "m4a"], }, webhook_url: { type: "string", description: "URL for callback upon completion", }, }, required: ["audio_url", "output_format"], },
- src/index.ts:334-356 (registration)Tool registration in the TOOLS array: defines name, description, and input schema. This array is served in response to ListToolsRequestSchema.{ name: "convert_audio_format", description: "Convert audio file to a different format", inputSchema: { type: "object" as const, properties: { audio_url: { type: "string", description: "URL of the audio file to convert", }, output_format: { type: "string", description: "Desired output format", enum: ["mp3", "wav", "flac", "ogg", "m4a"], }, webhook_url: { type: "string", description: "URL for callback upon completion", }, }, required: ["audio_url", "output_format"], }, },
- src/index.ts:695-696 (registration)Dispatch registration in the CallToolRequestSchema switch statement, routing tool calls to the handleConvertAudioFormat handler.case "convert_audio_format": return await this.handleConvertAudioFormat(args);