Export Mathematica graphics or data to a file
mathematica_exportEvaluate Wolfram Language code and export the result to PNG, SVG, PDF, CSV, JSON, TXT, or LaTeX files, returning the absolute path and byte size.
Instructions
Evaluate Wolfram Language code and export its result to a file on the local machine. Returns the absolute path and byte size of the created file. Useful for plots (png/svg/pdf), tables/data (csv/json/txt) and LaTeX (tex).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Wolfram Language expression to export, e.g. "Plot[Sin[x], {x, 0, 2 Pi}]" or "Table[{i, i^2}, {i, 10}]". Variables defined by earlier mathematica_evaluate calls can be used. | |
| width | No | For png/svg/pdf: image width in pixels, passed to Mathematica as ImageSize. | |
| format | Yes | Output format. | |
| height | No | For png/svg/pdf: image height in pixels, passed to Mathematica as ImageSize. | |
| file_path | No | Absolute path of the output file. When omitted, a timestamped file is created under the OS temp directory (mathematica-mcp artifacts folder). | |
| timeout_seconds | No | Maximum time for the export in seconds (default 180). The first raster export can take several seconds. |