Skip to main content
Glama

upload_file

Upload a local file to xAI to attach it to future chats, returning a file ID for use in chat_with_files or grok_agent.

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

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYes
expires_afterNo
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It discloses behavioral traits such as automatic file deletion after a TTL and the ability to keep files indefinitely. It does not cover auth requirements or error handling, but the provided info is sufficient for basic usage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise: one introductory paragraph followed by clear bullet-style parameter descriptions. No redundant sentences; every piece of information serves a purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (2 params, no output schema), the description covers purpose, parameters, return value (Markdown block with file ID, filename, size), and integration with other tools. It lacks details on error scenarios or file size limits, but is largely complete for basic use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It does so thoroughly: file_path is described as 'Absolute or relative path to the local file,' and expires_after as 'Optional TTL in seconds. The file is deleted from xAI automatically once it expires (omit to keep the file indefinitely).' This adds essential meaning beyond the bare schema types.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Upload a local file to xAI so it can be attached to later chats.' It uses a specific verb ('upload') and resource ('local file to xAI'), and distinguishes it from sibling tools like get_file or chat_with_files.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description mentions supported file types (PDFs, text documents) and explains how the returned file ID is used with chat_with_files or grok_agent, providing context for when to use this tool. However, it doesn't explicitly state when not to use it or mention alternatives for different file handling.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/merterbak/Grok-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server