Text lines chunk
text-lines-chunk · version 1.0.0 · Text · free, no key needed
Split parsed lines into consecutive chunks of size lines each.
Use when you need to: text lines chunk · chunk lines · split lines by size.
Decide before calling
Read the versioned contract and the supported scope below. Reuse text-lines-chunk@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-lines-chunk@1.0.0 for text lines chunk. 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
- text lines chunk
- chunk lines
- split lines by size
Not supported
- overlap chunks
- bytes chunk
- stream
Behavior
- Split on CR LF, LF, or CR. Do not treat other Unicode separators as line breaks.
- A trailing terminator does not create an extra empty line.
- Empty document -> zero lines, trailing_terminator false.
- A document that is only a terminator -> one empty line, trailing_terminator true.
- A document with no terminator -> last line kept, trailing_terminator false.
- Preserve empty lines in the middle.
- Output reconstruction uses LF. If the result has at least one line, append a trailing LF iff the selected window includes the original trailing terminator or includes a line that was followed by a separator in the source.
- No trimming, case folding, Unicode normalization, or locale rules.
- size is a JSON integer, 1 <= size <= max_lines.
- Chunks are consecutive, last chunk may be shorter.
- Empty input -> chunks [].
- If the number of chunks would exceed 512, reject.
- Each chunk string uses LF reconstruction; a non-final chunk always has a trailing LF if it is non-empty; the final chunk follows original trailing-terminator rules.
Input
text(string, required): max length 256000size(integer, required): min 1; max 10000
Output
chunks(array of string, required): max items 512lines_in(integer, required)chunk_count(integer, required)
Limits
- max input bytes: 256000
- max lines: 10000
- max chunks: 512
Example
Request input:
{
"text": "a\nb\nc\n",
"size": 2
}
Response:
{
"result": {
"chunks": [
"a\nb\n",
"c\n"
],
"lines_in": 3,
"chunk_count": 2
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "text-lines-chunk",
"version": "1.0.0",
"input": {
"text": "a\nb\nc\n",
"size": 2
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/text-lines-chunk/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"text":"a\nb\nc\n","size":2}'
The machine-readable contract is at /v1/tools/text-lines-chunk/versions/1.0.0.
CLI
node cli.mjs run text-lines-chunk 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Text paragraphs split: Split text into paragraphs separated by blank lines (CommonMark line rules) with code point spans and line numbers.
- Text sentences chunk: Pack whole UAX #29 sentences into chunks of at most max_size code points, UTF-16 units or UTF-8 bytes.
- Markdown sections chunk: Chunk a CommonMark document into sections at its top-level ATX and setext headings, with levels, paths and spans.
- Text wrap width: Hard-wrap text by Unicode code-point width and return the resulting lines.
- Natural sort strings: Sort strings by natural order (file2 before file10); returns the ordered strings and standard version.
- Text delimiter chunk: Split text on an explicit literal delimiter (Python str.split rules, optional max_splits) with spans and line numbers.