Text cleanup and destination formatting
clean_textClean supplied text deterministically without rewriting its meaning. Use for copied PDF text, Markdown/HTML artifacts, citations, spacing, or destination formatting; not OCR, file uploads, grammar correction, or AI-authorship detection. Preserves supported document structure unless a selected cleanup removes it. Returns cleanedText, destination-rendered text, optional html, a changes list, and usage counters as structured JSON and matching JSON text. No API key required. 20 calls per UTC day per network address; shared networks share this allowance. Service-wide load protection can return HTTP 429; honor Retry-After. Maximum 20000 UTF-16 code units per call. Accepted processing attempts consume quota, including repeats. Input and results are processed remotely in memory, not stored or logged; only quota metadata is retained. Validation and quota failures return errors. Example: {"text":"A split para-\ngraph.","preset":"pdf","destination":"email"}.
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": {
"text": "<text>"
},
"name": "clean_text"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | Required nonblank source text, not a URL or file path. Length is measured in UTF-16 code units. Send only text you intend this remote service to process. | |
| preset | No | Cleaning preset, default default: trim, collapse repeated spaces/blank lines, NFC Unicode. pdf also repairs hard wraps/hyphens and removes detected page numbers/edges. ai strips Markdown artifacts, not AI authorship. html removes HTML tags/scripts/styles and decodes entities. list removes blank/duplicate lines and sorts lines. Explicit flags override preset settings. | |
| destination | No | Output rendering, default preserve. preserve retains heading/quote markers and inline Markdown in text; other modes remove those markers, with bullet/numbered lists retained. email wraps HTML in a div; blog in an article; message and document return unwrapped semantic HTML; plain omits HTML. Does not change cleaning options. | |
| stripMarkdown | No | Override Markdown artifact removal, including headings/list markers, emphasis, link markup, and code fences. Omit to use the preset: true for ai, false otherwise. May remove structure; false does not disable destination rendering of Markdown. | |
| removeCitations | No | Remove recognized numbered brackets, footnote markers, and compact author-year citations. Default false for every preset. May remove meaningful references; enable only when requested. | |
| replaceLongDashes | No | Replace em/en dashes with the selected punctuation or space. Default preserve. Replacement normalizes surrounding whitespace and may join adjacent line breaks. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| html | No | Rendered semantic HTML. Omitted for plain destination. | |
| text | Yes | Destination-rendered text suitable for copying. | |
| usage | Yes | Aggregate quota counters only; contains no API key or network address. | |
| changes | Yes | Applied transformations; empty when no cleanup changed the source. | |
| cleanedText | Yes | Text after selected cleanup, before destination rendering. | |
| destination | Yes | Selected rendering destination. |