Skip to main content
Glama

Evaluate Wolfram Language code

mathematica_evaluate

Evaluate Wolfram Language (Mathematica) code in a persistent local kernel that preserves variables and returns InputForm results, capturing printed output and messages.

Instructions

Evaluate Wolfram Language (Mathematica) code in a persistent local kernel and return the result in InputForm. Variables and function definitions persist between calls. Printed output is captured in "output", and printed messages are listed in "messages". Requires a locally licensed Mathematica or the free Wolfram Engine.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesWolfram Language source code to evaluate, e.g. "2+2", "Plot[Sin[x], {x, 0, 2 Pi}]", or a multi-line program. It is parsed with ToExpression, so newline-separated statements are evaluated in order.
timeout_secondsNoMaximum evaluation time in seconds (default 60). On timeout the evaluation is aborted and the kernel stays usable.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4/5.0
Behavior4/5

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

With no annotations provided, the description carries the behavioral burden and does well: it discloses the persistent kernel, that variables and function definitions persist between calls, that printed output goes to 'output', and that messages go to 'messages'. It also states the licensing requirement. It omits some deeper side-effect details (e.g., that arbitrary code execution can mutate kernel state), but covers the key traits beyond schema.

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?

The purpose is front-loaded in the first sentence, followed by concise, high-value details about persistence, output capture, and licensing. Every sentence earns its place with no filler.

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?

There is no output schema, so the description compensates by explaining that results are returned in InputForm and that printed output and messages are captured in named fields. It also states the licensing requirement. Minor gaps remain around timeout abort behavior and error handling, but the core context an agent needs is present.

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 both parameters ('code' and 'timeout_seconds') are already fully documented in the schema. The description adds no parameter-specific syntax or behavioral detail beyond what the schema provides, so baseline 3 is appropriate.

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 states a specific verb and resource: 'Evaluate Wolfram Language (Mathematica) code' and specifies the execution context ('persistent local kernel') and return format ('InputForm'). This is concrete enough to distinguish it from sibling tools like export, kernel status, or information.

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

Usage Guidelines3/5

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

It provides a prerequisite ('Requires a locally licensed Mathematica or the free Wolfram Engine') but does not explicitly say when to use this tool versus alternatives such as mathematica_information or mathematica_export. Usage is implied by the general-purpose evaluation task, leaving the agent to infer boundaries.

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