sympy_image_set
Plots the set of points satisfying a mathematical expression for a given variable, visualizing symbolic solutions.
Instructions
Image set.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| expr | Yes | ||
| variable | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/mcp_sympy/tools.py:2513-2517 (handler)The actual tool handler function for 'sympy_image_set'. It converts the expression string to a SymPy expression, creates a Symbol from the variable string, and returns the string representation of an ImageSet (the set of values obtained by substituting an integer variable into the expression).
@mcp.tool() def sympy_image_set(expr: str, variable: str) -> str: """Image set.""" var = sympy.Symbol(variable) return str(sympy.ImageSet(_sympify(expr), var)) - src/mcp_sympy/tools.py:2513-2513 (registration)The @mcp.tool() decorator registers 'sympy_image_set' as an MCP tool on the FastMCP server instance.
@mcp.tool() - src/mcp_sympy/tools.py:2514-2514 (schema)The type hints define the input schema: 'expr' (string expression) and 'variable' (string symbol name), returning a string.
def sympy_image_set(expr: str, variable: str) -> str: - src/mcp_sympy/tools.py:114-116 (helper)The _sympify helper utility used to convert the input string expression into a SymPy object before passing it to ImageSet.
def _sympify(expr: str) -> sympy.Basic: """Convert string expression to SymPy object.""" return sympy.sympify(expr) - src/mcp_sympy/tools.py:119-119 (registration)The FastMCP server instance that the @mcp.tool() decorator registers tools on.
mcp = fastmcp.FastMCP("mcp-sympy")