audio_transcribe
Convert audio files from URLs to text transcripts using AI transcription. Specify language for accurate results.
Instructions
Transcribe audio from a URL using Whisper AI ($0.003/min)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | URL of audio file (mp3/mp4/wav/ogg/webm) | |
| language | No | Language code (e.g. en, pt) | en |
Implementation Reference
- index.js:26-26 (registration)Registration of the audio_transcribe tool within the TOOLS array.
{ name: 'audio_transcribe', description: 'Transcribe audio from a URL using Whisper AI', inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'URL of audio file (mp3/mp4/wav/ogg/webm)' }, language: { type: 'string', description: 'Language code (e.g. en, pt)', default: 'en' } }, required: ['url'] }, endpoint: '/audio/transcribe', price: '$0.003/min' }, - index.js:94-115 (handler)The main handler that dispatches calls to the appropriate tool endpoint using the callTool helper.
server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; if (!API_KEY) { return { content: [{ type: 'text', text: 'Error: ITERATOOLS_API_KEY environment variable not set. Get a key at https://iteratools.com' }], isError: true, }; } const tool = TOOLS.find(t => t.name === name); if (!tool) { return { content: [{ type: 'text', text: `Unknown tool: ${name}` }], isError: true }; } try { const result = await callTool(tool.endpoint, args); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; } catch (err) { return { content: [{ type: 'text', text: `Error: ${err.message}` }], isError: true }; } }); - index.js:50-79 (helper)The callTool helper function that performs the actual network request to the IteraTools API based on the tool's defined endpoint.
async function callTool(endpoint, params) { const fetch = (await import('node-fetch')).default; const isGet = ['GET'].includes((TOOLS.find(t => t.endpoint === endpoint) || {}).method); const url = isGet ? `${BASE_URL}${endpoint}?${new URLSearchParams(params)}` : `${BASE_URL}${endpoint}`; const res = await fetch(url, { method: isGet ? 'GET' : 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${API_KEY}`, }, body: isGet ? undefined : JSON.stringify(params), }); const text = await res.text(); let data; try { data = JSON.parse(text); } catch { data = { raw: text }; } if (!res.ok) { if (res.status === 402) { throw new Error(`Insufficient credits. Add credits at https://iteratools.com. Cost: ${TOOLS.find(t=>t.endpoint===endpoint)?.price || 'see docs'}`); } throw new Error(`API error ${res.status}: ${text.substring(0, 200)}`); } return data; }