Text Manipulation and Converter - Instructions
Overview
A comprehensive text processing tool for manipulating, converting, and analyzing text. Supports whitespace management, case conversion across 11 formats, line operations, and character/word/line counting.
Actions
Text Manipulation
remove-line-breaks
Converts multi-line text into a single line by replacing line breaks with spaces.
- Required:
text(string) - The input text - Optional: None
Example:
{ "action": "remove-line-breaks", "text": "Hello\nWorld\nFoo" }
Returns: "Hello World Foo"
remove-extra-spaces
Collapses multiple consecutive spaces into a single space.
- Required:
text(string) - Optional: None
Example:
{ "action": "remove-extra-spaces", "text": "Hello world foo" }
Returns: "Hello world foo"
sort-lines
Sorts lines alphabetically in ascending or descending order.
- Required:
text(string) - Optional:
order(string) -"asc"(default) or"desc"
Example:
{ "action": "sort-lines", "text": "banana\napple\ncherry", "order": "asc" }
Returns: "apple\nbanana\ncherry"
remove-duplicate-lines
Removes duplicate lines while preserving the original order of first occurrences.
- Required:
text(string) - Optional: None
Example:
{ "action": "remove-duplicate-lines", "text": "apple\nbanana\napple\ncherry\nbanana" }
Returns: "apple\nbanana\ncherry"
add-quotes
Wraps each line in quotes of the specified type.
- Required:
text(string) - Optional:
quote_type(string) -"single","double"(default), or"backtick"
Example:
{ "action": "add-quotes", "text": "apple\nbanana", "quote_type": "single" }
Returns: "'apple'\n'banana'"
tabs-to-spaces
Converts tab characters to spaces.
- Required:
text(string) - Optional:
tab_width(integer, 1-16, default: 4) - Number of spaces per tab
Example:
{ "action": "tabs-to-spaces", "text": "\tHello\n\t\tWorld", "tab_width": 2 }
spaces-to-tabs
Converts leading spaces to tab characters.
- Required:
text(string) - Optional:
tab_width(integer, 1-16, default: 4) - Number of spaces per tab
Example:
{ "action": "spaces-to-tabs", "text": " Hello\n World", "tab_width": 4 }
trim-whitespace
Removes leading and trailing whitespace from each line and the overall text.
- Required:
text(string) - Optional: None
Example:
{ "action": "trim-whitespace", "text": " Hello \n World " }
Returns: "Hello\nWorld"
remove-empty-lines
Removes all blank/empty lines from the text.
- Required:
text(string) - Optional: None
Example:
{ "action": "remove-empty-lines", "text": "Hello\n\n\nWorld\n\nFoo" }
Returns: "Hello\nWorld\nFoo"
normalize-whitespace
Comprehensive cleanup: trims each line, removes empty lines, and collapses multiple spaces within lines.
- Required:
text(string) - Optional: None
Example:
{ "action": "normalize-whitespace", "text": " Hello world \n\n Foo bar " }
Returns: "Hello world\nFoo bar"
indent-text
Adds consistent indentation to every line of text.
- Required:
text(string) - Optional:
indent_char(string) -"space"(default) or"tab"indent_count(integer, 1-16, default: 4) - Number of indent characters per level
Example:
{ "action": "indent-text", "text": "Hello\nWorld", "indent_char": "space", "indent_count": 2 }
Returns: " Hello\n World"
dedent-text
Removes common leading whitespace from all lines (the minimum shared indentation).
- Required:
text(string) - Optional: None
Example:
{ "action": "dedent-text", "text": " Hello\n World\n Nested" }
Returns: "Hello\nWorld\n Nested"
wrap-text
Wraps text to fit within a specified column width.
- Required:
text(string) - Optional:
width(integer, 10-200, default: 80) - Maximum line width
Example:
{ "action": "wrap-text", "text": "This is a long sentence that should be wrapped at a shorter width.", "width": 30 }
unwrap-text
Joins all lines into a single line, removing line breaks.
- Required:
text(string) - Optional: None
Example:
{ "action": "unwrap-text", "text": "This is\na wrapped\nparagraph." }
Returns: "This is a wrapped paragraph."
reverse-lines
Reverses the order of lines (last line becomes first).
- Required:
text(string) - Optional: None
Example:
{ "action": "reverse-lines", "text": "first\nsecond\nthird" }
Returns: "third\nsecond\nfirst"
Case Conversion
change-case
Converts text to a target case format. Supports 11 case types.
- Required:
text(string)case_type(string) - One of:camel,snake,pascal,kebab,screaming-snake,upper,lower,title,sentence,dot,path
Case type reference:
| case_type | Output |
|---|---|
camel | helloWorld |
snake | hello_world |
pascal | HelloWorld |
kebab | hello-world |
screaming-snake | HELLO_WORLD |
upper | HELLO WORLD |
lower | hello world |
title | Hello World |
sentence | Hello world |
dot | hello.world |
path | hello/world |
Example:
{ "action": "change-case", "text": "hello world example", "case_type": "camel" }
Returns: "helloWorldExample"
Special Text Operations
reverse-text
Reverses the entire text character by character.
- Required:
text(string) - Optional: None
Example:
{ "action": "reverse-text", "text": "Hello" }
Returns: "olleH"
remove-accents
Strips accents and diacritical marks from characters.
- Required:
text(string) - Optional: None
Example:
{ "action": "remove-accents", "text": "café résumé naïve" }
Returns: "cafe resume naive"
alternate-case
Alternates between uppercase and lowercase for each character position.
- Required:
text(string) - Optional: None
Example:
{ "action": "alternate-case", "text": "hello world" }
Returns: "HeLlO wOrLd"
smart-case-detect
Detects the case style of the input text. Returns one of: upper, lower, title, snake, kebab, dot, path, camel, pascal, mixed, or empty.
- Required:
text(string) - Optional: None
Example:
{ "action": "smart-case-detect", "text": "helloWorld" }
Returns: "camel"
Counting
count-lines
Counts the number of lines in the text.
- Required:
text(string) - Optional: None
Example:
{ "action": "count-lines", "text": "Line 1\nLine 2\nLine 3" }
Returns: 3
count-words
Counts the number of words in the text.
- Required:
text(string) - Optional: None
Example:
{ "action": "count-words", "text": "Hello world this is a test" }
Returns: 6
count-characters
Returns detailed character statistics including total characters, characters without spaces, letters, digits, spaces, and line count.
- Required:
text(string) - Optional: None
Example:
{ "action": "count-characters", "text": "Hello World 123" }
Returns:
{ "total": 15, "without_spaces": 13, "letters": 10, "digits": 3, "spaces": 2, "lines": 1 }
Common Workflows
- Clean messy text: Use
normalize-whitespacefor a one-step cleanup of irregular spacing and blank lines. - Prepare CSV values: Use
add-quoteswithquote_type: "double"to wrap each line in quotes. - Convert variable names: Use
change-caseto convert between naming conventions (e.g., camelCase to snake_case). - Analyze text: Combine
count-words,count-characters, andcount-linesfor a full text analysis. - Deduplicate lists: Use
sort-linesfollowed byremove-duplicate-linesto get a clean sorted unique list.
Important Notes
- The
textparameter is required for all actions. - The
change-caseaction requires thecase_typeparameter. - All responses include metadata with original text length and (for string results) result length.
spaces-to-tabsonly converts leading spaces on each line, not spaces within text.smart-case-detectreturns"mixed"when text does not match any recognized case pattern.







