Skip to main content
Glama

matrix

Compute matrix operations—determinant, inverse, eigenvalues, transpose, rank, trace—by supplying rows as JSON and selecting an operation.

Instructions

Structured matrix operations: det, inverse, eigenvalues, transpose, rank, trace.

evaluate_expression refuses Matrix([[1,2],[3,4]]) on purpose — [/] are denied there to block subscript-based RCE escapes, and a matrix literal is collateral from that (correctly aimed) screen. This tool is the structured replacement: rows is a JSON array of arrays (row-major), never a string to parse. Each entry is either a JSON number, used directly, or a scalar expression string ('1/2', 'sqrt(2)', 'x+1'), screened per-entry the same way evaluate_expression screens its input before anything reaches SymPy. op is one of det/inverse/eigenvalues/ transpose/rank/trace. Example: rows=[[1,2],[3,4]], op='det' -> -2.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
opYes
rowsYes
Behavior3/5

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

With no annotations provided, the description must convey all behavioral traits. It mentions that each entry is screened per-entry to avoid RCE, similar to evaluate_expression, and that operations are computed. However, it does not specify error handling for invalid matrices (e.g., singular matrix for inverse), return type variations across operations, or any side effects. This leaves some ambiguity.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and flows logically: introduction, comparison to evaluate_expression, then parameter details and example. It is somewhat verbose with repeated emphasis on 'screening' and 'structured replacement,' but each sentence contributes to the overall clarity without excessive redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description lacks completeness regarding output formats. It only illustrates the result for 'det' (a scalar -2) but does not specify the return types for inverse (matrix), eigenvalues (list), etc. It also does not address error cases (e.g., invalid dimensions, singular matrix, unsupported expressions) or the exact behavior when an entry cannot be screened. Given the non-trivial nature of matrix operations, this is a significant gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Despite zero schema description coverage, the tool description fully explains both parameters: 'rows' is a JSON array of arrays (row-major) with entries that can be numbers or scalar expression strings (with examples), and 'op' is one of the enumerated matrix operations. This provides complete semantic understanding, exceeding what the schema alone offers.

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 clearly states the tool's purpose: performing structured matrix operations (det, inverse, eigenvalues, etc.). It explicitly contrasts this tool with evaluate_expression, explaining that it provides a safe structured alternative for matrix inputs, which distinguishes it from siblings. The example further clarifies intended usage.

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?

The description explicitly states that this tool is the 'structured replacement' for evaluate_expression in the context of matrices, giving clear guidance on when to use it. It provides an example (det -> -2). However, it does not explicitly mention when not to use it (e.g., for non-matrix numerical expression evaluation), but the context implies it.

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

Install Server

Other Tools

Latest Blog Posts

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/The-40-Thieves/codecalc'

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