Skip to main content
Glama

Mathematica MCP Server

by aac6fef

execute_mathematica_code

Execute Wolfram Language code within a secure session using a provided session ID. Perform calculations, symbolic computations, and data visualizations by submitting valid code strings to the Mathematica kernel.

Instructions

Executes a string of Wolfram Language code within a specific, active session.

To use this tool, you must provide a valid 'session_id' obtained from a previous call to 'create_session'. The code will be executed in the context of that session, meaning it can access variables and functions defined in previous calls within the same session.

Args: session_id: The unique identifier for an active session, provided by 'create_session'. Example: 'bee-sloth-auk-mole'. code: A string containing the Wolfram Language code to be executed. The code should be syntactically correct. Example 1 (simple calculation): 'Total[Range[100]]' Example 2 (symbolic computation): 'Solve[x^2 - 5x + 6 == 0, x]' Example 3 (data visualization): 'Plot[Sin[x], {x, 0, 2 Pi}]'

Returns: The direct result of the code execution from the Wolfram Engine. The data type can vary (e.g., integer, list, string, or a complex expression). For plots, it may return a representation of the graphics object.

Input Schema

NameRequiredDescriptionDefault
codeYes
session_idYes

Input Schema (JSON Schema)

{ "properties": { "code": { "title": "Code", "type": "string" }, "session_id": { "title": "Session Id", "type": "string" } }, "required": [ "session_id", "code" ], "title": "execute_mathematica_codeArguments", "type": "object" }
Install Server

Other Tools from Mathematica MCP Server

Related Tools

    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/aac6fef/mathematica_mcp'

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