convert_url
Download a remote file and convert it with TweekIT in one step.
This helper first fetches url, infers the input extension when possible,
and then forwards the bytes to convert. Supply fetchHeaders when the
remote resource needs authentication or custom headers.
Args:
url: Direct download URL for the source document or image.
outfmt: Desired output format (Fmt).
apiKey: TweekIT API key (ApiKey header). Falls back to TWEEKIT_API_KEY env var.
apiSecret: TweekIT API secret (ApiSecret header). Falls back to TWEEKIT_API_SECRET env var.
inext: Optional override for the source extension if it cannot be
detected from the URL or response headers.
noRasterize: Forwarded to TweekIT to skip rasterization when possible.
width: Optional pixel width to request in the output.
height: Optional pixel height to request in the output.
x1: Left crop coordinate in source pixels.
y1: Top crop coordinate in source pixels.
x2: Right crop coordinate in source pixels.
y2: Bottom crop coordinate in source pixels.
page: Page number to extract for multipage inputs.
alpha: Whether the output should preserve alpha transparency.
bgColor: Background color to composite behind transparent pixels.
fetchHeaders: Optional mapping of HTTP headers to include when fetching.
Returns:
A FastMCP Image or File payload, or an error description.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x1 | No | Left crop coordinate in source pixels. | |
| x2 | No | Right crop coordinate in source pixels. | |
| y1 | No | Top crop coordinate in source pixels. | |
| y2 | No | Bottom crop coordinate in source pixels. | |
| url | Yes | Direct download URL for the source document or image. | |
| page | No | Page number to convert for multi-page inputs. | |
| alpha | No | Preserve alpha transparency when producing raster formats. | |
| inext | No | Override for the detected input extension (e.g., pdf). | |
| width | No | Optional pixel width for the converted output. | |
| apiKey | No | TweekIT API key passed via the ApiKey header. Defaults to the TWEEKIT_API_KEY environment variable when omitted. | |
| height | No | Optional pixel height for the converted output. | |
| outfmt | Yes | Requested output format to send as Fmt. | |
| bgColor | No | Background color (hex RGB) to composite behind transparent pixels. | |
| apiSecret | No | TweekIT API secret paired with the apiKey. Defaults to the TWEEKIT_API_SECRET environment variable when omitted. | |
| noRasterize | No | Forward to TweekIT to disable rasterization when supported. | |
| fetchHeaders | No | Optional HTTP headers to include when downloading the URL. |