Skip to main content
Glama

chat_with_files

Ask Grok questions about previously uploaded files by attaching their file IDs as context, so it can read and quote contents; optionally save chat history per session.

Instructions

Chat with Grok using one or more previously uploaded files as context.

Attaches the given `file_ids` to the user turn so Grok can read/quote their
contents. Optional `session` persists local chat history across calls.

Args:
    prompt: Question or instruction about the attached files.
    file_ids: IDs of files previously returned by `upload_file`.
    session: Optional session name for persistent history in `chats/{session}.json`.
    model: Grok model id (default `grok-4.6`).
    system_prompt: Optional system instruction prepended to the conversation.
    show_usage: Append a token usage and cost footer to the reply (default False).

Returns:
    Assistant reply, followed by a `**Sources:**` list when the model cites URLs.

Input Schema

NameRequiredDescriptionDefault
modelNogrok-4.6
promptYes
sessionNo
file_idsYes
show_usageNo
system_promptNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.0.4
    • changedInput schema / properties / model / default
      Previous value: -"grok-4.3"New value: +"grok-4.6"
  2. Changed1 schema field changedv1.0.1
    • addedInput schema / properties / show_usage
      Added value: +{
      +  "default": false,
      +  "title": "Show Usage",
      +  "type": "boolean"
      +}
  3. Added
  4. Removed
  5. Added
  6. Removed
  7. Changed2 schema fields changed
    • removedInput schema / properties / file_ids / default
      Removed value: -null
    • changedInput schema / required
      Previous value: -[
      -  "prompt"
      -]New value: +[
      +  "prompt",
      +  "file_ids"
      +]
  8. Added
  9. Removed
  10. Changed1 schema field changed
    • changedInput schema / properties / model / default
      Previous value: -"grok-4-1-fast"New value: +"grok-4-1-fast-reasoning"
  11. Changed1 schema field changed
    • addedInput schema / properties / session
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Session"
      +}
  12. Changed2 schema fields changed
    • addedInput schema / properties / file_ids / default
      Added value: +null
    • changedInput schema / required
      Previous value: -[
      -  "prompt",
      -  "file_ids"
      -]New value: +[
      +  "prompt"
      +]
  13. Added

TDQS

A3.8/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it discloses that file_ids are attached to the user turn, that `session` persists local history to chats/{session}.json, and that show_usage appends a token/cost footer. It omits auth/permission requirements and any indication that session persistence is a local write side effect.

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

Conciseness4/5

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

Front-loads the purpose sentence, then uses a compact Args/Returns layout where each line adds information beyond the bare parameter names. The Args block is slightly redundant with the schema titles but still earns its place by adding semantics.

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?

No output schema exists, and the description compensates with a Returns section covering the reply and the optional `**Sources:**` list. Combined with full parameter coverage and session-persistence behavior, an agent has nearly everything needed, with only auth and side-effect details missing.

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

Parameters4/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, and it documents all six parameters with meaning beyond the schema: file_ids origin, session file path, model default, system_prompt behavior, and the show_usage footer. It stops short of format/limit details such as how many file_ids are accepted or how session names are validated.

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

Purpose4/5

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

States a specific verb and resource: chat with Grok using previously uploaded files as context. It names the sibling that produces the required input (upload_file) but does not differentiate itself from close siblings like `chat`, `chat_with_vision`, or `stateful_chat`, which an agent would need to pick between.

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

Usage Guidelines3/5

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

Implied usage is clear from the prerequisite that file_ids come from upload_file, but there is no explicit when-to-use guidance or statement of when to prefer this over the plain `chat` or `chat_with_vision` tools. The agent must infer routing from the tool name alone.

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