Skip to main content
Glama

get_file

Retrieve files from the Grok MCP server using file IDs to access stored documents and media for processing.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_idYes

Implementation Reference

  • 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()

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