sympy_matrix_rank
Compute the rank of a symbolic matrix to determine its linear independence and dimensionality.
Instructions
Matrix rank.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| matrix | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/mcp_sympy/tools.py:2420-2423 (handler)The handler function for the sympy_matrix_rank tool. Parses a string matrix expression via _sympify() and calls .rank() on the resulting SymPy matrix, returning the result as a string.
@mcp.tool() def sympy_matrix_rank(matrix: str) -> str: """Matrix rank.""" return str(_sympify(matrix).rank()) - src/mcp_sympy/tools.py:114-116 (helper)Helper function that converts string input to SymPy objects, used by the handler to parse the matrix argument.
def _sympify(expr: str) -> sympy.Basic: """Convert string expression to SymPy object.""" return sympy.sympify(expr) - src/mcp_sympy/tools.py:2420-2420 (registration)Registration via the @mcp.tool() decorator on the FastMCP instance 'mcp' (defined at line 119).
@mcp.tool() - src/mcp_sympy/tools.py:119-119 (registration)The FastMCP instance 'mcp' that registers all tools including sympy_matrix_rank via the @mcp.tool() decorator.
mcp = fastmcp.FastMCP("mcp-sympy")