detect_ai_music
Analyze audio files to determine if music was AI-generated or human-made. Provides a confidence score and classification for uploaded audio URLs.
Instructions
Detect whether an audio file was generated by AI or created by humans. Accepts a public URL to an audio file (MP3, WAV, FLAC, OGG, M4A). Returns a confidence score (0-100) and classification (ai_generated, human_made, or uncertain).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| audio_url | Yes | Public URL to the audio file to analyze |
Implementation Reference
- src/tools/detect-ai-music.ts:42-65 (handler)The handler function that executes the detect_ai_music tool: validates the audio URL, calls the IRCAM AI Detector API via httpPost, handles errors, and returns the transformed detection result.export async function handleDetectAiMusic( args: Record<string, unknown> ): Promise<AIDetectionResult> { const audioUrl = args.audio_url as string; // Validate input const validation = validateAudioUrl(audioUrl); if (!validation.valid) { throw validation.error; } // Call IRCAM AI Detector API const url = buildApiUrl(IRCAM_API_CONFIG.ENDPOINTS.AI_DETECTOR); const response = await httpPost<IrcamAIDetectorResponse>(url, { url: audioUrl, }); if (!response.ok || !response.data) { throw response.error || formatError('UNKNOWN_ERROR', 'Failed to detect AI music'); } // Transform and return result return transformAIDetectorResponse(response.data); }
- src/tools/detect-ai-music.ts:21-37 (schema)The Tool object defining the detect_ai_music tool's metadata, description, and input schema for MCP registration.export const detectAiMusicTool: Tool = { name: 'detect_ai_music', description: 'Detect whether an audio file was generated by AI or created by humans. ' + 'Accepts a public URL to an audio file (MP3, WAV, FLAC, OGG, M4A). ' + 'Returns a confidence score (0-100) and classification (ai_generated, human_made, or uncertain).', inputSchema: { type: 'object', properties: { audio_url: { type: 'string', description: 'Public URL to the audio file to analyze', }, }, required: ['audio_url'], }, };
- src/index.ts:37-43 (registration)Registration of detectAiMusicTool in the TOOLS array returned by listTools MCP request.const TOOLS = [ analyzeMusicTool, separateStemsTool, detectAiMusicTool, analyzeLoudnessTool, checkJobStatusTool, ];
- src/index.ts:48-54 (registration)Registration of 'detect_ai_music' handler in the TOOL_HANDLERS map used for callTool MCP request.const TOOL_HANDLERS: Record<string, (args: Record<string, unknown>) => Promise<unknown>> = { analyze_music: handleAnalyzeMusic, separate_stems: handleSeparateStems, detect_ai_music: handleDetectAiMusic, analyze_loudness: handleAnalyzeLoudness, check_job_status: handleCheckJobStatus, };
- src/types/mcp-tools.ts:127-137 (schema)Type definitions for the output of detect_ai_music: AIClassification and AIDetectionResult.export type AIClassification = 'ai_generated' | 'human_made' | 'uncertain'; /** * Résultat de la détection IA */ export interface AIDetectionResult { /** Score de confiance 0-100 */ confidence: number; /** Classification finale */ classification: AIClassification; }