upload_file
Upload a local file (PDF or text) to xAI and receive a file ID for attaching to future chats.
Instructions
Upload a local file to xAI so it can be attached to later chats.
Supported types include PDFs and text documents (see xAI file docs). The
returned file ID can be passed to `chat_with_files` or `grok_agent`.
Args:
file_path: Absolute or relative path to the local file.
expires_after: Optional TTL in seconds. The file is deleted from xAI
automatically once it expires (omit to keep the file indefinitely).
Returns:
Markdown block with the assigned file ID, filename, and size.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | ||
| expires_after | No |