text_extract_urls
Extract every URL from a block of text, with per-match details, filtering by scheme, deduplication, and sorting. Returns matched URLs and statistics.
Instructions
Extract URLs From Text. Scan a block of text and return every URL it contains, with per-match scheme, byte position, line number, and optional surrounding context. Filter by extraction mode (all, http, https, ftp, or a custom scheme list), deduplicate case-insensitively, and sort alphabetically. Use this for hyperlinks and protocol URIs; use text_extract_emails instead when you only want email addresses. Pure regex extraction — read-only, non-destructive, performs no network requests against the found URLs, runs locally with no auth. Rate limited to 30 requests/min per IP (text category). Returns the matched urls array plus stats (original text metrics + extraction counts and per-scheme tally) and the resolved options.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | Source text to scan for URLs. Required and non-empty. | |
| extractionMode | No | Which schemes to match. all = http/https/ftp plus many app schemes and bare www. links; http = http or https; https = https only; ftp = ftp or ftps; custom = use customSchemes. | all |
| customSchemes | No | Comma-separated scheme list (e.g. "myapp,custom") used only when extractionMode is custom. Required and non-empty in that mode. | |
| removeDuplicates | No | Drop case-insensitive duplicate URLs from the results. | |
| sortResults | No | Sort results alphabetically by URL. | |
| includeContext | No | Include surrounding text around each match. | |
| contextLength | No | Characters of context on each side when includeContext is true. Clamped to 10-200. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| success | No | True when extraction succeeded. | |
| urls | No | Matched URLs, after dedupe/sort. | |
| stats | No | Original-text metrics and extraction summary. | |
| options | No | Resolved options actually applied. | |
| error | No | Error message when success is false. |