Start a file upload
create_upload_urlStart an upload for a file this server does not hold, and get back a URL to send the bytes to. Two steps are needed: PUT the bytes to the returned URL with exactly the headers it gives you, then call complete_upload with the id it returns. The link does not work until both have happened. The upload URL is valid for five minutes. If it lapses before the bytes land, call this again for a fresh one rather than reusing the id. size_bytes has to be the exact number of bytes you are about to upload, because it is signed into the URL and storage refuses a body of any other length. Use share_text instead when you already hold the text and want it published in a single call.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"filename": "<filename>",
"content_type": "<content_type>",
"size_bytes": "<size_bytes>"
},
"name": "create_upload_url"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filename | Yes | The name to store the file under, including its extension. Up to 200 characters. | |
| size_bytes | Yes | The exact number of bytes you are about to upload, as a whole number. This is signed into the upload URL, so a PUT whose body is even one byte longer or shorter is refused by storage. Measure the file rather than estimating. | |
| content_type | Yes | The MIME type of the bytes you are about to upload, such as application/pdf or image/png. Send this exact value as the Content-Type header on the PUT. Storage does not check it, so nothing will refuse a PUT that sends a different one. The type the link serves under is decided when the upload completes, from the first bytes of the file weighed against this value and the filename. A recognised file signature, such as a PDF or PNG header, wins over this value. HTML is kept as HTML only when this value is text/html. An image, PDF, HTML or ZIP type with no matching signature is stored as application/octet-stream. Otherwise this value stands, so send the true type. | |
| desired_slug | No | Optional. A preferred short name for the public link. It is cleaned up and checked on the server, and one that is taken or unusable is replaced with a random one rather than failing the call. The reply always names the slug that was actually assigned. |