Skip to main content
Glama

execute_code

Execute Wolfram Language code for computation and plotting, with support for compute, notebook, and interactive output styles.

Instructions

[PRIMARY] Execute Wolfram Language code. Prefer this for nearly all computation and plotting.

Choose a style:

  • style="compute" — fast kernel evaluation, result in chat

  • style="notebook" — evaluate in kernel, show in notebook cell

  • style="interactive" — front-end evaluation (required for Manipulate/Dynamic)

style is a high-level preset for output_target + mode. Individual params still work and override style. When style and output_target are both omitted, output_target defaults to the profile's default (notebook) and mode defaults to kernel.

response_detail accepts the canonical levels compact, standard, verbose, and diagnostic, plus the aliases short, medium, and long.

Prefer this over write_cell + evaluate_cell for running code. With output_target="notebook", it reuses the active notebook (or creates one if none exists), writes the code, and evaluates it in one call. If notebook transport fails, the request returns a notebook-targeted error instead of silently rerunning through CLI fallback. NOTE: if the user asks for a NEW notebook, call create_notebook first.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes
formatNotext
output_targetNo
modeNo
styleNo
response_detailNostandard
render_graphicsNo
deterministic_seedNo
session_idNo
isolate_contextNo
timeoutNo
max_waitNo
syncNonone
sync_waitNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

No annotations provided, so description covers behavior thoroughly. It explains style presets, default behavior when style/output_target omitted, response_detail aliases, notebook reuse, error handling, and failure mode.

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

Conciseness4/5

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

Well-organized with primary purpose first, then style options, defaults, aliases, and sibling relationships. Somewhat verbose but each sentence adds value; could be slightly more concise.

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

Completeness5/5

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

Given the tool's complexity (14 params, output schema exists), description provides comprehensive guidance on usage, behavior, error scenarios, and alternatives, making it complete for an AI agent.

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

Parameters4/5

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

Schema coverage is 0%, so description adds critical meaning for key parameters: style, output_target, mode, response_detail, and their interactions. However, it does not cover all 14 parameters (e.g., code, format, render_graphics, etc.) in detail.

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

Purpose5/5

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

The description clearly states 'Execute Wolfram Language code' and positions it as the primary tool for computation and plotting. It distinguishes itself from sibling tools like write_cell + evaluate_cell.

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

Usage Guidelines5/5

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

Explicitly says 'Prefer this for nearly all computation and plotting' and 'Prefer this over write_cell + evaluate_cell for running code'. Also specifies when not to use: 'if the user asks for a NEW notebook, call create_notebook first'.

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

Install Server

Other Tools

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/AbhiRawat4841/mathematica-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server