audio-to-markdown
Transform audio files into Markdown format, including transcription, for easy readability and sharing. Automate the conversion process with this tool on the Markdownify MCP Server.
Instructions
Convert an audio file to markdown, including transcription if possible
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filepath | Yes | Absolute path of the audio file to convert |
Implementation Reference
- src/server.ts:72-86 (handler)Handler logic in the CallToolRequest that matches audio-to-markdown and invokes Markdownify.toMarkdown to convert the audio file to markdown.case tools.PDFToMarkdownTool.name: case tools.ImageToMarkdownTool.name: case tools.AudioToMarkdownTool.name: case tools.DocxToMarkdownTool.name: case tools.XlsxToMarkdownTool.name: case tools.PptxToMarkdownTool.name: if (!validatedArgs.filepath) { throw new Error("File path is required for this tool"); } result = await Markdownify.toMarkdown({ filePath: validatedArgs.filepath, projectRoot: validatedArgs.projectRoot, uvPath: validatedArgs.uvPath || process.env.UV_PATH, }); break;
- src/tools.ts:80-94 (schema)ToolSchema definition for the audio-to-markdown tool, including input schema requiring filepath.export const AudioToMarkdownTool = ToolSchema.parse({ name: "audio-to-markdown", description: "Convert an audio file to markdown, including transcription if possible", inputSchema: { type: "object", properties: { filepath: { type: "string", description: "Absolute path of the audio file to convert", }, }, required: ["filepath"], }, });
- src/server.ts:33-37 (registration)Registration of all tools from tools.ts (including audio-to-markdown) via ListToolsRequest handler.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: Object.values(tools), }; });
- src/Markdownify.ts:74-124 (helper)Core helper method Markdownify.toMarkdown that processes the file (audio) using _markitdown via uv run markitdown, producing markdown output.static async toMarkdown({ filePath, url, projectRoot = path.resolve(__dirname, ".."), uvPath = "~/.local/bin/uv", }: { filePath?: string; url?: string; projectRoot?: string; uvPath?: string; }): Promise<MarkdownResult> { try { let inputPath: string; let isTemporary = false; if (url) { const response = await fetch(url); let extension = null; if (url.endsWith(".pdf")) { extension = "pdf"; } const arrayBuffer = await response.arrayBuffer(); const content = Buffer.from(arrayBuffer); inputPath = await this.saveToTempFile(content, extension); isTemporary = true; } else if (filePath) { inputPath = filePath; } else { throw new Error("Either filePath or url must be provided"); } const text = await this._markitdown(inputPath, projectRoot, uvPath); const outputPath = await this.saveToTempFile(text); if (isTemporary) { fs.unlinkSync(inputPath); } return { path: outputPath, text }; } catch (e: unknown) { if (e instanceof Error) { throw new Error(`Error processing to Markdown: ${e.message}`); } else { throw new Error("Error processing to Markdown: Unknown error occurred"); } } }