Skip to main content
Glama

Export Mathematica graphics or data to a file

mathematica_export

Evaluate 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

TableJSON Schema
NameRequiredDescriptionDefault
codeYesWolfram 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.
widthNoFor png/svg/pdf: image width in pixels, passed to Mathematica as ImageSize.
formatYesOutput format.
heightNoFor png/svg/pdf: image height in pixels, passed to Mathematica as ImageSize.
file_pathNoAbsolute path of the output file. When omitted, a timestamped file is created under the OS temp directory (mathematica-mcp artifacts folder).
timeout_secondsNoMaximum time for the export in seconds (default 180). The first raster export can take several seconds.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full behavioral burden. It does disclose the key trait: this writes a file to the local machine and returns the absolute path and byte size. It does not say whether an existing file_path is overwritten, whether directories are created, or what permissions or sandbox limits apply.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three short sentences with zero waste: the action comes first, the return value second, and the format guidance last. Nothing repeats the schema or the title.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has no output schema, but the description covers the return shape, giving the absolute path and byte size of the created file. With six parameters at full schema coverage, the remaining gap is file-overwrite or file-collision semantics, which matter for a tool that writes to disk.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so every parameter is already documented, and the baseline is 3. The description adds only the format-to-use-case mapping, while behaviors like ImageSize, timestamped temp paths, and the 180s default live in the schema rather than the description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: evaluate Wolfram Language code and export the result to a file on the local machine. That distinguishes it from mathematica_evaluate, which returns results rather than writing files. It never explicitly names the sibling or says what happens to the evaluated expression itself, so the differentiation is implicit rather than stated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives concrete use cases mapped to formats: plots (png/svg/pdf), tables/data (csv/json/txt), and LaTeX (tex). That is clear context for choosing this tool. It stops short of exclusions, e.g., when to prefer mathematica_evaluate over exporting, or what to do when the expression is non-exportable.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.