# Levenshtein distance

Count the single-character edits needed to turn one string into another, with a similarity ratio.

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

## Inputs

- `a` (required, string): The first string.
- `b` (required, string): The second string.
- `case_sensitive` (optional, boolean, default `true`): Treat upper and lower case as different.

## Example 1

```json
{"input":{"a":"kitten","b":"sitting"}}
```

Result:

```json
{"distance":3,"similarity":0.5714,"length_a":6,"length_b":7}
```

## Example 2: Ignoring case

```json
{"input":{"a":"Color","b":"colour","case_sensitive":false}}
```

Result:

```json
{"distance":1,"similarity":0.8333,"length_a":5,"length_b":6}
```

**How is similarity calculated?** It is 1 minus the distance divided by the length of the longer string, so 1 means identical and 0 means nothing in common.

**What counts as one edit?** Inserting, deleting or replacing a single character. Swapping two neighbouring characters counts as two edits.
