get_file
Retrieve files from the Grok MCP server using file IDs to access stored documents and media for processing.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_id | Yes |
Implementation Reference
- src/server.py:474-480 (handler)The get_file tool handler function registered with @mcp.tool() decorator. It takes a file_id parameter, retrieves file metadata from the XAI API, and returns formatted information including file ID, filename, size, and creation date.@mcp.tool() async def get_file(file_id: str): client = Client(api_key=XAI_API_KEY) file_info = client.files.get(file_id) client.close() return f"**File ID:** `{file_info.id}`\n**Filename:** {file_info.filename}\n**Size:** {file_info.size} bytes\n**Created:** {file_info.created_at}"
- src/server.py:474-474 (registration)The get_file tool is registered with the MCP framework using the @mcp.tool() decorator, which automatically exposes it as an available tool.@mcp.tool()