Skip to main content
Glama

mathematica_compute

Executes Wolfram Language code in a real kernel and returns the final expression’s value and messages, with optional PNG export for graphics. Use it for quick, unverified calculations.

Instructions

在真实 Wolfram 内核里执行一段代码,返回最后一个表达式的值和消息;图形结果可导出 PNG。快速计算,不做 checks、Notebook 和复算,因此永远 verified=false;可交付成果请用 mathematica_run。

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "mathematica_compute"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeNoWolfram Language 代码,最后一个表达式的值即结果
out_dirNo内部工作目录根路径
timeoutNo
code_pathNo代码文件路径,与 code 二选一
figure_pathNo结果是图形时复制出 PNG 的目标路径(.png)
working_dirNoImport 相对路径时的基准目录
allow_externalNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it says no checks, no notebook, no re-computation, and that results are always verified=false, which prevents an agent from treating output as validated. It also states the default timeout/allow_external indirectly and the PNG export behavior. What is left undisclosed is kernel state isolation (whether prior calls persist) and side effects, which matter for a compute tool.

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?

Two sentences, each carrying distinct information: sentence one states the action and output, sentence two states the constraints and the alternative. The most decision-relevant fact (verified=false) is placed before the routing hint, and nothing is repeated from the schema.

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?

For a 7-parameter, no-annotation, no-output-schema tool, the description covers purpose, output shape, validation status, and the sibling alternative. It falls short on kernel/session state and error behavior, but nothing critical for a correct first invocation is missing.

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 coverage is 71%, so the schema already documents most of the 7 parameters, including the `code`/`code_path` pairing and `figure_path`. The description's only parameter-level value is confirming that a figure result can be written to PNG; it says nothing extra about `timeout`, `allow_external`, `working_dir`, or `out_dir`. 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 ("在真实 Wolfram 内核里执行一段代码"), the return semantics ("返回最后一个表达式的值和消息"), and the side-output capability ("图形结果可导出 PNG"). It also names the sibling `mathematica_run` as the alternative for deliverables, so an agent can tell the two apart without opening the schema.

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?

It explicitly gives the condition that selects the alternative: "可交付成果请用 mathematica_run", which covers the main routing decision. It does not address the other plausible alternatives (`mathematica_evaluate_notebook`, `mathematica_export`), so the exclusion is not fully complete.

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