delete_file
Remove files from the Grok MCP server to manage storage and maintain organization by specifying the file identifier.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_id | Yes |
Implementation Reference
- src/server.py:500-506 (handler)The delete_file tool handler that deletes a file from the XAI SDK by file_id. It creates a client, calls client.files.delete(), and returns a confirmation message with the deleted file ID.@mcp.tool() async def delete_file(file_id: str): client = Client(api_key=XAI_API_KEY) delete_response = client.files.delete(file_id) client.close() return f"Deleted file `{delete_response.id}`"
- src/server.py:500-500 (registration)The @mcp.tool() decorator that registers the delete_file function as an MCP tool, making it available to the protocol.@mcp.tool()