Skip to main content

MCP tool to format subtitle file (SRT/VTT) text at phrase boundaries with line wrapping using BudouX.

Project description

clipwright-wrap

MCP tool to format subtitle file text (SRT/VTT) at phrase boundaries using BudouX with line wrapping.

Overview

clipwright-wrap takes SRT/VTT subtitle files as input, splits each cue text into phrase units by BudouX, inserts line breaks to fit within specified character count and line count, and outputs the subtitle file in the same format. A pure text formatting tool with no FFmpeg / Whisper dependencies.

Input/Output

  • Input: SRT file (.srt) or VTT file (.vtt)
  • Output: Subtitle file in same format as input (with phrase boundary line breaks inserted)
  • Timecodes: Unchanged (no retiming)

MCP Tool

clipwright_wrap_captions

Parameters

Name Type Default Description
input string required Input subtitle file path (.srt / .vtt)
output string required Output subtitle file path (same extension as input)
language string "ja" Phrase splitting language (ja / zh-hans / zh-hant / th)
max_chars int 16 Max characters per line (full-width and half-width both count as 1 character). Positive integer.
max_lines int 2 Max lines per cue. Over-limit cues recorded in warnings (not truncated). Positive integer.

Character Count Specification

max_chars is counted uniformly as 1 character each (both full-width and half-width as one len() character). Full-width normalization is a future extension (requirement §8).

Phrase Wrapping Mechanism

  1. Each cue text (if multiple lines, remove line breaks and concatenate) is split into phrases by BudouX
  2. Phrase token sequence is greedily packed into one line within max_chars
  3. Formatted text (multiple lines separated by \n) is written back to cue

If a single phrase exceeds max_chars alone, place that phrase on one line (no splitting mid-phrase).

Supported Languages

Supports the following languages for which BudouX provides phrase splitting:

language Value Language
ja Japanese
zh-hans Chinese (Simplified)
zh-hant Chinese (Traditional)
th Thai

Dependencies

Package Purpose
budoux Phrase boundary splitting (standard dependency, lightweight model bundled)
clipwright Shared types, envelope, errors
mcp[cli] MCP server
pydantic Parameter validation

No FFmpeg / Whisper dependencies (pure text formatting). budoux is a standard dependency bundled with the package, so e2e tests can run continuously without environment variable gating.

Installation and Startup

uv add clipwright-wrap
clipwright-wrap

Or within a uv workspace:

uv run --package clipwright-wrap clipwright-wrap

Prerequisites

  • Python 3.11 or later
  • FFmpeg not required (text formatting only)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

clipwright_wrap-0.1.1.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

clipwright_wrap-0.1.1-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file clipwright_wrap-0.1.1.tar.gz.

File metadata

  • Download URL: clipwright_wrap-0.1.1.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for clipwright_wrap-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1e65a11b2fd0b1226a96edec393119fc797353bc0d10f3708278ef21fb2e9317
MD5 d99d6f86e9bdbf7aeb30cbf78cdae10f
BLAKE2b-256 a2288c311f90b2982cbf4e22d840a88c2e6aa1bdbeee8343b4bf9d78748de94e

See more details on using hashes here.

File details

Details for the file clipwright_wrap-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: clipwright_wrap-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for clipwright_wrap-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a83cc80d1aae6996b5e53be18fdf20a800c013b63aae20029a5591c706d37c1e
MD5 23d0bf5403aea57eb10754cb58a51673
BLAKE2b-256 f8da7d1918acfe29dab41642205afd14b752497fa978f69f92a0f1651a9cc3b0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page