extract-audio
Extract structured data from audio files using a custom prompt. Input audio via URL or base64, specify extraction criteria, and optionally return results in JSON format.
Instructions
Extract structured data from audio files based on a prompt.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| audio | Yes | URL or base64-encoded audio | |
| inputMethod | Yes | Input method | |
| jsonMode | No | Return in JSON format | |
| prompt | Yes | Extraction prompt |
Implementation Reference
- src/index.ts:735-756 (handler)Handler function that proxies the extract-audio tool call to the external Dumpling AI API, authenticates with API key, sends POST request with parameters, and returns the API response as formatted text.async ({ inputMethod, audio, prompt, jsonMode }) => { const apiKey = process.env.DUMPLING_API_KEY; if (!apiKey) throw new Error("DUMPLING_API_KEY not set"); const response = await fetch(`${NWS_API_BASE}/api/v1/extract-audio`, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}`, }, body: JSON.stringify({ inputMethod, audio, prompt, jsonMode, requestSource: "mcp", }), }); if (!response.ok) throw new Error(`Failed: ${response.status} ${await response.text()}`); const data = await response.json(); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; }
- src/index.ts:729-734 (schema)Zod input schema defining parameters: inputMethod (url/base64), audio (string), prompt (string), optional jsonMode (boolean).{ inputMethod: z.enum(["url", "base64"]).describe("Input method"), audio: z.string().describe("URL or base64-encoded audio"), prompt: z.string().describe("Extraction prompt"), jsonMode: z.boolean().optional().describe("Return in JSON format"), },
- src/index.ts:727-757 (registration)MCP server.tool registration for 'extract-audio' tool, including name, description, input schema, and inline handler function."extract-audio", "Extract structured data from audio files based on a prompt.", { inputMethod: z.enum(["url", "base64"]).describe("Input method"), audio: z.string().describe("URL or base64-encoded audio"), prompt: z.string().describe("Extraction prompt"), jsonMode: z.boolean().optional().describe("Return in JSON format"), }, async ({ inputMethod, audio, prompt, jsonMode }) => { const apiKey = process.env.DUMPLING_API_KEY; if (!apiKey) throw new Error("DUMPLING_API_KEY not set"); const response = await fetch(`${NWS_API_BASE}/api/v1/extract-audio`, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}`, }, body: JSON.stringify({ inputMethod, audio, prompt, jsonMode, requestSource: "mcp", }), }); if (!response.ok) throw new Error(`Failed: ${response.status} ${await response.text()}`); const data = await response.json(); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } );