Package com.tnsai.tools.file
Class MarkdownTools
java.lang.Object
com.tnsai.tools.file.MarkdownTools
Function-shape Markdown conversion tool — the LangChain-style replacement
for the legacy
MarkItDownTool (see issue #188 — RFC).
Wraps the Microsoft MarkItDown Python CLI as an external subprocess. The CLI converts a wide range of file formats (PDF, Word, Excel, PowerPoint, HTML, images, audio, EPUB, CSV, JSON, XML, ZIP, …) plus URLs to a single markdown string.
Requires
pip install markitdown
The tool reports a clear "markitdown CLI not found" error when the binary is absent on PATH, so tool registration succeeds at startup (markitdown is loaded reflectively per #186) and only the actual call fails when invoked.
- Since:
- 0.5.7 (Phase 2 batch 3 — built-in tool migration to function shape, see #188)
-
Field Summary
FieldsModifier and TypeFieldDescriptionDefault whitelist mirrors the formats markitdown advertises support for. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
DEFAULT_EXTENSIONS
Default whitelist mirrors the formats markitdown advertises support for. URLs are admitted separately byisUrl(String).
-
-
Constructor Details
-
MarkdownTools
public MarkdownTools() -
MarkdownTools
-
-
Method Details
-
markitdown
@Tool(name="markitdown", description="Convert a file or URL to Markdown using the MarkItDown Python CLI. Supported sources: PDF, Word (.docx), Excel (.xlsx), PowerPoint (.pptx), HTML, images (with OCR), audio (with transcription), EPUB, CSV, JSON, XML, ZIP archives, and HTTP(S) URLs. Returns the converted markdown as a single string.", keywords={"markdown","convert","markitdown","pdf","docx","xlsx","pptx","html","ocr"}, idempotent=true) public String markitdown(@ToolParam(description="Absolute file path or HTTP(S) URL of the source to convert") String source) throws IOException, InterruptedException - Throws:
IOExceptionInterruptedException
-