# Fuzzy match

Find the candidates that are most similar to a query, ranked with a score from 0 to 1.

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

## Inputs

- `query` (required, string): The text to look for.
- `candidates` (required, array): The strings to search, as a list.
- `limit` (optional, integer, default `5`, range 1..100): How many matches to return at most.
- `min_score` (optional, number, default `0.3`, range 0..1): Leave out candidates that score below this (0 to 1).
- `case_sensitive` (optional, boolean, default `false`): Treat upper and lower case as different.

## Example 1

```json
{"input":{"query":"aple","candidates":["apple","maple","grape","banana"]}}
```

Result:

```json
{"matches":[{"candidate":"apple","score":0.8889,"index":0},{"candidate":"maple","score":0.8889,"index":1},{"candidate":"grape","score":0.6667,"index":2}],"best":"apple","count":3}
```

## Example 2: Only the best match

```json
{"input":{"query":"instal","candidates":["uninstall","install","init"],"limit":1}}
```

Result:

```json
{"matches":[{"candidate":"install","score":0.9231,"index":1}],"best":"install","count":1}
```

**How is the score calculated?** It is twice the number of matching characters divided by the total length of both strings. 1 is an exact match.

**Which candidate wins a tie?** The one that comes first in your list. "index" is its position in the list, counting from 0.
