Text paragraphs split
text-paragraphs-split · version 1.0.0 · Text · free, no key needed
Split text into paragraphs separated by blank lines (CommonMark line rules) with code point spans and line numbers.
Use when you need to: split text into paragraphs · chunk a document by blank lines · paragraph boundaries with character offsets.
Decide before calling
Read the versioned contract and the supported scope below. Reuse text-paragraphs-split@1.0.0 when your input, required output and limits match it. Choose another approach for an unsupported operation.
Explain the choice
"I can use text-paragraphs-split@1.0.0 for split text into paragraphs. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."
Supported
- split text into paragraphs
- chunk a document by blank lines
- paragraph boundaries with character offsets
- which lines belong to each paragraph
- break plain text into paragraph chunks for embedding
- count paragraphs separated by empty lines
Not supported
- Markdown block parsing (headings, lists, code blocks are not recognized here; see markdown-sections-chunk)
- sentence or token-size chunking, overlap windows, or merging short paragraphs
- treating lines of non-breaking or other Unicode spaces as blank (only spaces and tabs count)
Behavior
- Lines follow CommonMark 0.31.2 section 2.1: a line ending is LF, CR not followed by LF, or CRLF; a final line ending does not start another line. A blank line contains nothing or only spaces (U+0020) and tabs (U+0009).
- A paragraph is a maximal run of consecutive non-blank lines. Its span runs from the first character of its first line to the end of its last line's content: inner line endings and indentation are kept verbatim; the last line ending and the surrounding blank lines are excluded.
- Offsets start and end are Unicode code point indices into text (end exclusive). Line numbers are 1-based: line(pos) = 1 + number of line endings that end at or before pos; start_line = line(start), end_line = line(end - 1). line_count = end_line - start_line + 1.
- Paragraphs are listed in document order with index 0..n-1. Empty text or text with only blank lines gives no paragraphs. line_count_total counts every CommonMark line of the input, blank or not.
- No Markdown interpretation: an indented line, a "#" line or a "---" line is ordinary paragraph text. Lone surrogates in text throw invalid_input.
Input
text(string, required): The text to split (UTF-8, at most max_input_bytes).
Output
paragraph_count(integer, required): min 0line_count_total(integer, required): min 0paragraphs(array of object, required): max items 10000
Limits
- max input bytes: 262144
- max paragraphs: 10000
- max output bytes: 1048576
Example
Request input:
{
"text": "aaa\nbbb\n\nccc\nddd\n"
}
Response:
{
"result": {
"paragraph_count": 2,
"line_count_total": 5,
"paragraphs": [
{
"index": 0,
"start": 0,
"end": 7,
"start_line": 1,
"end_line": 2,
"line_count": 2,
"text": "aaa\nbbb"
},
{
"index": 1,
"start": 9,
"end": 16,
"start_line": 4,
"end_line": 5,
"line_count": 2,
"text": "ccc\nddd"
}
]
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "text-paragraphs-split",
"version": "1.0.0",
"input": {
"text": "aaa\nbbb\n\nccc\nddd\n"
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/text-paragraphs-split/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"text":"aaa\nbbb\n\nccc\nddd\n"}'
The machine-readable contract is at /v1/tools/text-paragraphs-split/versions/1.0.0.
CLI
node cli.mjs run text-paragraphs-split 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Markdown sections chunk: Chunk a CommonMark document into sections at its top-level ATX and setext headings, with levels, paths and spans.
- Text sentences chunk: Pack whole UAX #29 sentences into chunks of at most max_size code points, UTF-16 units or UTF-8 bytes.
- Text delimiter chunk: Split text on an explicit literal delimiter (Python str.split rules, optional max_splits) with spans and line numbers.
- Text sentences split: Split text into sentences using the default Unicode UAX #29 sentence boundary rules (Unicode 17.0.0).
- Text sentence offsets: Return UAX #29 sentence spans as start/end offsets in code points, UTF-16 units or UTF-8 bytes, with the ending rule.
- Citation passage check: Check that a cited start/end span of a supplied source version reads exactly as the quoted passage.