{
  "id": "pdf.translate",
  "object": "tool",
  "name": "Translate PDF",
  "summary": "Translate a PDF, keep the layout.",
  "description": "Translates a PDF into another language and keeps its layout as closely as practical: the PDF is rebuilt as a Word document (pdf2docx), each paragraph is translated with M2M-100 (about 100 languages) and written back in place with its formatting, then LibreOffice renders it to PDF again. Returns the PDF, or the docx. Text without letters (page numbers, prices) is left alone. Up to 150,000 characters per run; scanned PDFs need doc.ocr first.",
  "category": "documents",
  "hosted_by": "Opentools",
  "runtime": "container",
  "side_effects": false,
  "status": "live",
  "credits": 5,
  "price": "$0.0050",
  "providers": [
    {
      "id": "opentools",
      "name": "Opentools",
      "price": "$0.0050"
    }
  ],
  "mcp_name": "pdf_translate",
  "input_schema": {
    "type": "object",
    "properties": {
      "file": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "url": {
                "type": "string",
                "format": "uri",
                "description": "Public http(s) URL of the file"
              }
            },
            "required": [
              "url"
            ]
          },
          {
            "type": "object",
            "properties": {
              "file_id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
                "description": "An id returned by POST /v1/files"
              }
            },
            "required": [
              "file_id"
            ]
          },
          {
            "type": "object",
            "properties": {
              "base64": {
                "type": "string",
                "description": "Base64-encoded file bytes (up to 10 MB)"
              },
              "name": {
                "type": "string",
                "description": "File name, e.g. invoice.pdf"
              },
              "content_type": {
                "type": "string"
              }
            },
            "required": [
              "base64",
              "name"
            ]
          },
          {
            "type": "object",
            "properties": {
              "connection": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "A storage connection id or name (see storage.connections)"
              },
              "path": {
                "type": "string",
                "minLength": 1,
                "maxLength": 1024,
                "description": "Path of the file in that connection, e.g. reports/q3.pdf"
              }
            },
            "required": [
              "connection",
              "path"
            ]
          }
        ],
        "x-file": true,
        "description": "The PDF"
      },
      "target": {
        "type": "string",
        "pattern": "^[a-z]{2,3}$",
        "description": "Language to translate into, as an ISO 639-1 code, e.g. \"de\", \"fr\", \"ja\""
      },
      "source": {
        "default": "auto",
        "description": "Source language code, or \"auto\" to detect it",
        "type": "string",
        "pattern": "^(auto|[a-z]{2,3})$"
      },
      "to": {
        "default": "pdf",
        "description": "Output: PDF, or the editable Word document",
        "type": "string",
        "enum": [
          "pdf",
          "docx"
        ]
      },
      "pages": {
        "description": "Pages like \"1-3,5,8-\". All pages if omitted.",
        "type": "string",
        "maxLength": 500,
        "pattern": "^[\\d,\\s-]+$"
      }
    },
    "required": [
      "file",
      "target"
    ]
  },
  "kind": "tool"
}