Skip to main content
Glama

list_files

Retrieve and organize files from the Grok MCP server by specifying sort order, criteria, and quantity limits for efficient file management.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
orderNodesc
sort_byNocreated_at

Implementation Reference

  • The logic that lists files from the client.
    async def list_files(
        limit: int = 100,
        order: str = "desc",
        sort_by: str = "created_at"
    ):
        client = Client(api_key=XAI_API_KEY)
        response = client.files.list(limit=limit, order=order, sort_by=sort_by)
        client.close()
        
        if not response.data:
            return "No files found."
        result = ["**Files:**\n"]
        for f in response.data:
            result.append(f"- `{f.id}` — {f.filename} ({f.size} bytes)")
        return "\n".join(result)
  • src/server.py:540-540 (registration)
    MCP tool registration decorator for list_files.
    @mcp.tool(annotations=READONLY)

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