# Truncate text

Shorten long text to a maximum length, cutting from the middle, start or end and marking the cut with an ellipsis.

- Endpoint: `POST https://setget.net/v1/tools/truncate-middle` with JSON `{"input": {...}}`
- MCP: `run_tool` with `slug` = `truncate-middle`
- Page: https://setget.net/tools/truncate-middle

## Inputs

- `text` (required, string): The text to shorten.
- `max_length` (optional, integer, default `80`, range 1..1000000): Longest result allowed, in characters, including the marker.
- `where` (optional, string, one of `start`, `middle`, `end`, default `"middle"`): Which part to cut out. "middle" keeps the start and the end.
- `marker` (optional, string, default `"\u2026"`): Text that stands in for the removed part.

## Example 1

```json
{"input":{"text":"The quick brown fox jumps over the lazy dog","max_length":20}}
```

Result:

```json
{"text":"The quick … lazy dog","truncated":true,"original_length":43,"removed":24}
```

## Example 2: Keeping the end of a path

```json
{"input":{"text":"/home/sam/projects/website/assets/images/logo.png","max_length":26,"where":"start","marker":"..."}}
```

Result:

```json
{"text":".../assets/images/logo.png","truncated":true,"original_length":49,"removed":26}
```

## Example 3: Already short enough

```json
{"input":{"text":"Short text","max_length":20}}
```

Result:

```json
{"text":"Short text","truncated":false,"original_length":10,"removed":0}
```

**Is the marker counted in the length?** Yes. The result, marker included, is never longer than max_length.

**Does it cut accented letters in half?** No. A cut never separates a letter from its combining accents, so the result can be a character or two shorter than the limit.
