Skip to main content
Glama

matrix_operation

Idempotent

Compute determinant, inverse, eigenvalues, rank, RREF, or transpose on one matrix. Use this for direct linear algebra instead of running general SageMath evaluation.

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/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=false, idempotentHint=true, destructiveHint=false, and openWorldHint=false, so the agent knows the safety and idempotency profile. The description adds no behavioral context beyond that—it doesn't explain why the tool is not read-only (e.g., whether it writes to the session workspace) or any side effects. With annotations covering the profile, this is adequate but adds nothing.

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 tight sentences: the core operation list is front-loaded, and the routing preference follows immediately. No filler or repetition of schema details.

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

Completeness4/5

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

Given that an output schema exists and schema coverage is complete, the description needn't explain return values or parameter formats. It covers purpose and routing well, but does not address the non-read-only nature flagged by annotations or explain any interaction with the session workspace, which is a minor gap.

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%, and both the matrix and session parameters are fully documented in the schema with important details about exact integers, string representations for large numbers, and workspace credential semantics. The description adds no parameter meaning beyond what the schema already provides, so the baseline of 3 applies.

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 states a specific operation class ('Linear algebra on one matrix') and enumerates the six supported operations, which lets an agent distinguish it from matrix_multiply and other siblings. It also explicitly names evaluate_sage as the alternative, making the tool's scope unambiguous.

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 gives a clear preference rule: 'Prefer this over evaluate_sage.' This names the primary alternative, though it does not state when evaluate_sage would be the better choice or any other exclusion conditions.

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