# URL normaliser

Clean a URL into a standard form: lowercase host, no default port, resolved dots, optional tracking removal.

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

## Inputs

- `url` (required, string): The URL to normalise.
- `strip_tracking` (optional, boolean, default `false`): Remove tracking parameters such as utm_source, fbclid and gclid.
- `sort_query` (optional, boolean, default `false`): Sort query parameters by name.
- `drop_fragment` (optional, boolean, default `false`): Remove the #fragment at the end.
- `remove_trailing_slash` (optional, boolean, default `false`): Remove a slash at the end of the path (the root "/" is kept).

## Example 1

```json
{"input":{"url":"HTTPS://Example.COM:443/a/./b/../c?b=2&a=1#top","sort_query":true,"drop_fragment":true}}
```

Result:

```json
{"url":"https://example.com/a/c?a=1&b=2","changed":true,"changes":["Lowercased the scheme.","Lowercased the host.","Removed the default port 443.","Resolved the dot segments in the path.","Sorted the query parameters.","Removed the fragment."]}
```

## Example 2: Strip tracking parameters

```json
{"input":{"url":"https://example.com/page/?utm_source=news&id=7&fbclid=abc","strip_tracking":true,"remove_trailing_slash":true}}
```

Result:

```json
{"url":"https://example.com/page?id=7","changed":true,"changes":["Removed tracking parameters: utm_source, fbclid.","Removed the trailing slash."]}
```

**Which parameters count as tracking?** Anything starting with utm_, plus well-known click identifiers such as fbclid, gclid, msclkid, mc_eid and igshid.

**Could two normalised URLs still be the same page?** Yes. Only changes that are safe by the URL standard are made. A site may still serve the same page at several addresses.
