Skip to main content
Glama

bluente_translate_document_workflow

Translate documents while preserving formatting. Upload files, specify languages, and receive translated versions in PDF, DOCX, or XLSX formats.

Instructions

Run end-to-end translation: upload, start, poll until READY, and optionally download.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYes
fromYes
toYes
to_typeNodocx
engineNoLLM
glossaryNo
custom_glossaryNo
bilingualNoline
vertical_bilingualNo
scannedNo
namespaceNo
metadataNo
poll_interval_msNo
max_poll_attemptsNo
auto_downloadNo
status_entryNopdf
output_pathNo

Implementation Reference

  • The service method `runDocumentWorkflow` implements the core logic for the translation document workflow.
    async runDocumentWorkflow({
      filePath,
      from,
      to,
      toType,
      engine,
      glossary,
      customGlossary,
      bilingual,
      verticalBilingual,
      scanned,
      namespace,
      metadata,
      pollIntervalMs,
      maxPollAttempts,
      autoDownload,
      statusEntry = "pdf",
      outputPath
    }) {
      const uploadResult = await this.client.uploadFile({ filePath, engine, glossary });
      const id = uploadResult?.data?.id;
    
      if (!id) {
        throw new BluenteApiError("Upload completed but no task id was returned.", {
          uploadResult
        });
      }
    
      await this.client.translateFile({
        id,
        action: "start",
        from,
        to,
        engine,
        glossary,
        customGlossary,
        bilingual,
        verticalBilingual,
        scanned,
        namespace,
        metadata
      });
    
      let finalStatusPayload = null;
    
      for (let i = 0; i < maxPollAttempts; i += 1) {
        const statusPayload = await this.client.getTranslationStatus({ id, entry: statusEntry });
        finalStatusPayload = statusPayload;
        const status = statusPayload?.data?.status;
    
        if (TERMINAL_TRANSLATION_STATUSES.has(status)) {
          break;
        }
    
        await sleep(pollIntervalMs);
      }
    
      const finalStatus = finalStatusPayload?.data?.status;
      if (finalStatus !== "READY") {
        throw new BluenteApiError("Translation job did not reach READY state.", {
          id,
          finalStatus,
          finalStatusPayload
        });
      }
    
      const download = autoDownload
        ? await this.client.downloadFile({ id, toType, outputPath })
        : null;
    
      return {
        id,
        finalStatus,
        status: finalStatusPayload,
        download
      };
    }
  • Tool registration for 'bluente_translate_document_workflow', which calls the workflow service.
    export function registerTranslateDocumentWorkflowTool(server, { workflowService }) {
      server.tool(
        TOOL_NAME,
        "Run end-to-end translation: upload, start, poll until READY, and optionally download.",
        documentWorkflowSchema,
        async (args) =>
          executeTool(TOOL_NAME, async () =>
            workflowService.runDocumentWorkflow({
              filePath: args.file_path,
              from: args.from,
              to: args.to,
              toType: args.to_type,
              engine: args.engine,
              glossary: args.glossary,
              customGlossary: args.custom_glossary,
              bilingual: args.bilingual,
              verticalBilingual: args.vertical_bilingual,
              scanned: args.scanned,
              namespace: args.namespace,
              metadata: args.metadata,
              pollIntervalMs: args.poll_interval_ms,
              maxPollAttempts: args.max_poll_attempts,
              autoDownload: args.auto_download,
              statusEntry: args.status_entry,
              outputPath: args.output_path
            })
          )
      );
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Bluente/bluente-translate'

If you have feedback or need assistance with the MCP directory API, please join our Discord server