Text indentation detect
text-indentation-detect · version 1.0.0 · Text · free, no key needed
Detect whether a text uses tabs or spaces for indentation by counting lines.
Use when you need to: text indentation detect · detect indentation · check if text uses tabs or spaces.
Supported
- text indentation detect
- detect indentation
- check if text uses tabs or spaces
Not supported
- detect indentation size
- fix indentation
- parse code structure
Behavior
- Analyzes each line to determine its leading whitespace.
- A line is "tab_indented" if it starts with one or more tabs and no spaces before the first non-whitespace character.
- A line is "space_indented" if it starts with one or more spaces and no tabs before the first non-whitespace character.
- A line is "mixed_indented" if it starts with a combination of tabs and spaces.
- Empty lines and lines with no leading whitespace are ignored.
- predominant is "tabs" if tab_indented_lines > space_indented_lines, "spaces" if space_indented_lines > tab_indented_lines, and "none" otherwise.
Input
text(string, required): max length 1048576
Output
tab_indented_lines(integer, required): min 0space_indented_lines(integer, required): min 0mixed_indented_lines(integer, required): min 0predominant(one of "tabs", "spaces", "none", required)
Limits
- max text bytes: 1048576
- max output bytes: 1024
Example
Request input:
{
"text": "function foo() {\n\treturn 1;\n}"
}
Response:
{
"result": {
"tab_indented_lines": 1,
"space_indented_lines": 0,
"mixed_indented_lines": 0,
"predominant": "tabs"
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "text-indentation-detect",
"version": "1.0.0",
"input": {
"text": "function foo() {\n\treturn 1;\n}"
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/text-indentation-detect/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"text":"function foo() {\n\treturn 1;\n}"}'
The machine-readable contract is at /v1/tools/text-indentation-detect/versions/1.0.0.
CLI
node cli.mjs run text-indentation-detect 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Text tabs to spaces: Convert tab characters to spaces.
- Text conflict render: Render text and conflict parts as merge or diff3 conflict-marker text.
- Text control characters find: Find non-whitespace control characters in a text string.
- Text prefix suffix check: Exact prefix and/or suffix boolean checks using JS string startsWith/endsWith.
- Text unicode normalization check: Check if a text string is in various Unicode normalization forms (NFC, NFD, NFKC, NFKD).
- Text apply unified patch: Apply a one-file unified patch to text at original line addresses with exact hunk matches.