Convert file
convert_fileConvert and process PDFs and images by running FlexFiles actions on local files or HTTPS links, then save results locally without changing originals.
Instructions
Run a FlexFiles tool on local files or https links and save the result locally. Originals are never changed. Actions:
merge-pdf: Combine PDFs into one file, in the order given.
add-page-to-pdf: Insert the pages of a second PDF into the first one.
protect-pdf: Add a password to a PDF.
unlock-pdf: Remove the password from a PDF you know the password for.
search-and-replace: Find text in a PDF and replace it.
split-pdf: Split a PDF into several files with a fixed number of pages each.
remove-pdf-pages: Delete pages from a PDF.
add-header-footer: Add header and/or footer text to PDF pages.
add-link-to-pdf: Make URLs and email addresses in a PDF clickable, or link chosen text.
pdf-to-jpg: Turn PDF pages into JPG images.
pdf-to-word: Convert a PDF to an editable Word document (.docx).
html-to-pdf: Convert an HTML file to PDF.
pdf-to-html: Convert a PDF to an HTML page.
pdf-to-pptx: Convert a PDF to a PowerPoint presentation (.pptx).
pdf-to-txt: Extract the text of a PDF into a .txt file.
extract-pdf-images: Save the images inside a PDF as separate files.
pdf-to-excel: Extract tables from a PDF into an Excel workbook (.xlsx).
compress-pdf: Make a PDF file smaller.
convert-image: Convert images to another format (PNG, JPEG, WebP and more).
enhance-image: Upscale and sharpen images.
remove-background: Remove the background from images, or replace it with a colour or another image.
tiny-image: Make images smaller.
ocr-pdf: Make a scanned PDF's text searchable and selectable.
deskew-pdf: Straighten tilted scanned pages.
word-to-pdf: Convert a Word document (.doc or .docx) to PDF.
repair-pdf: Recover a damaged or corrupted PDF.
jpg-to-pdf: Combine images into one PDF, one image per page.
flatten-pdf: Bake form fields and annotations into the page so they can't be edited.
remove-annotations: Remove highlights, comments, drawings, form fields or links from a PDF. Settings go in options (call list_tools with the action to see them).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"action": "<action>",
"files": "<files>"
},
"name": "convert_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| files | Yes | Local file paths (absolute, or relative to the working directory) or https links, in order | |
| action | Yes | The FlexFiles tool to run | |
| options | No | The tool's settings, e.g. {"compressionPreset": "maximum"} or {"password": "..."} | |
| save_to | No | Folder to save the result in (default: the first input file's folder) | |
| download | No | Save the result locally (default true); false returns download links only | |
| wait_seconds | No | How long to wait for the result before handing back a conversion_id (default 50) | |
| background_image | No | remove-background only: local image to use as the new background |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| done | Yes | true once completed or failed | |
| next | No | What to do next when the job isn't finished or failed | |
| error | No | ||
| action | No | ||
| status | Yes | pending, queued, processing, completed or failed | |
| zipUrl | No | Signed download link for all outputs as one ZIP | |
| resultUrl | No | Signed download link for the (first) output | |
| inputFiles | Yes | ||
| savedFiles | No | Local paths the result was saved to | |
| outputCount | No | ||
| zipFileName | No | ||
| conversionId | Yes | ||
| resultNotice | No | Present when the result is partial or the input was damaged | |
| queuePosition | No | ||
| resultFileName | No | ||
| estimatedSeconds | No | ||
| expiresInSeconds | No |