kb_add_file
Create a knowledge base document from an uploaded file or public HTTPS link, then extract, chunk, and embed its text. Add PDFs, Office files, CSV, TXT, or MD to a collection.
Instructions
Create a KB document from a file: either one already uploaded (signed_id) or one at a public https link (url). Exactly one of the two.
signed_id: step 2 of a two-step upload, for a file already PUT to the upload_url from
kb_create_direct_upload; `name` is required with it.
url: Unilytics downloads the file from the link (a PDF, DOCX, PPTX, XLSX, XLS, CSV, TXT or MD file
up to 100 MB, redirects followed, public https addresses only) and stores the original, as an
upload would. The type comes from the response (its name, its Content-Type and the file's own
bytes), never from the link alone: a web page, a login page or a file of another type is refused
(kb_add_urls adds a web page). `name` defaults to the file's own name; document_type, when given,
is the type the file must be. request_id (a UUID, optional) makes the call repeatable: a repeat
with the same request_id and arguments within 24 hours returns the first call's document (free)
instead of adding the file again, and a request_id used for different arguments is refused.
Without it, each call adds a new copy. The result's `file` holds the stored name, file_type and
bytes.
The file's full text is extracted, chunked and embedded in the background. Returns {document_id,
status}; kb_get_status reports progress. A file that can't be read, or holds more text than one
document can (about 5 million characters), ends as status 'failed' with `error` saying why; it
keeps its document_id, and kb_retry_document re-runs it in place.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": {
"project_id": "<project_id>",
"collection_id": "<collection_id>"
},
"name": "kb_add_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | ||
| name | No | ||
| metadata | No | ||
| signed_id | No | ||
| project_id | Yes | ||
| request_id | No | ||
| collection_id | Yes | ||
| document_type | No |