Skip to main content
Glama

Matrix Operation

matrix_operation
Idempotent

Performs linear algebra on a single matrix: determinant, inverse, eigenvalues, rank, rref, or transpose. Input a nested list to obtain exact results.

Instructions

Linear algebra on one matrix: determinant, inverse, eigenvalues, rank, reduced row echelon form, transpose. Prefer this over evaluate_sage.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
matrixYesMatrix as nested list of numbers. Integers stay exact; pass values from 2^53 up as decimal strings.
sessionNoWorkspace to use, as a name or a portable handle. Workspaces have independent variables. A name is scoped to this MCP session; a handle returned by start_sage_session (workspace_token) reaches the same workspace across reconnects and is a bearer credential -- keep it secret. Omit for 'default'.default
operationYesOne of: determinant, inverse, eigenvalues, rank, rref, transpose

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.7.0
    • changedInput schema / properties / session / description
      Previous value: -"Named workspace to use. Workspaces have independent variables; omit for 'default'."New value: +"Workspace to use, as a name or a portable handle. Workspaces have independent variables. A name is scoped to this MCP session; a handle returned by start_sage_session (workspace_token) reaches the same workspace across reconnects and is a bearer credential -- keep it secret. Omit for 'default'."
  2. Changed4 schema fields changedv0.5.0
    • changedInput schema / properties / matrix / description
      Previous value: -"Matrix as nested list of numbers"New value: +"Matrix as nested list of numbers. Integers stay exact; pass values from 2^53 up as decimal strings."
    • addedInput schema / properties / matrix / items / items / anyOf
      Added value: +[
      +  {
      +    "type": "number"
      +  },
      +  {
      +    "type": "integer"
      +  },
      +  {
      +    "type": "string"
      +  }
      +]
    • removedInput schema / properties / matrix / items / items / type
      Removed value: -"number"
    • addedInput schema / properties / session
      Added value: +{
      +  "default": "default",
      +  "description": "Named workspace to use. Workspaces have independent variables; omit for 'default'.",
      +  "type": "string"
      +}
  3. First observedv0.3.1

TDQS

A4.1/5.0
Behavior3/5

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

Annotations already supply idempotentHint=true and destructiveHint=false, so the description's burden is lower; it doesn't repeat or contradict them. The description adds only the single-matrix scope and the supported operation set, but says nothing about possible failure modes (e.g., inverse/eigenvalues require square matrices) or whether session state is mutated. With no annotation contradiction, 3 is the right mid-point.

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 short sentences, front-loaded with the operation list and ending with a routing preference. There is no filler, and every word contributes either to scope or to sibling differentiation.

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

Completeness5/5

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

With a rich schema (matrix exactness, session/bearer semantics), an output schema present, and annotations covering idempotency/destructiveness, the description has all it needs for selecting and invoking the tool. It names the one relevant generic sibling and clearly scopes to a single matrix. Operation-specific mathematical constraints are standard domain knowledge and don't block correct invocation.

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 description coverage is 100%, so the baseline is 3; the schema itself documents matrix exactness (decimal strings for large values) and session/workspace semantics in detail. The description's operation list merely repeats values already described in the operation parameter. It adds no semantic information beyond the schema.

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 names the resource ('one matrix') and enumerates the exact supported operations (determinant, inverse, eigenvalues, rank, rref, transpose), so an agent knows precisely what the tool does. It also distinguishes it from siblings by noting 'one matrix' (vs matrix_multiply) and explicitly preferring it over evaluate_sage. The generic title is resolved by the specific operation list.

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 gives a clear routing instruction: 'Prefer this over evaluate_sage,' which tells an agent to use this specialized tool before falling back to the generic Sage evaluator. The 'one matrix' phrase also implicitly excludes matrix_multiply. It stops short of a 5 because it doesn't explicitly name matrix_multiply or state the conditions under which evaluate_sage should be used instead.

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