Skip to main content
Glama

sparse_compute

Solve, multiply, transpose, and compute norms, eigenvalues, or singular values of sparse matrices, accepting triplet dicts, Matrix Market files, or dense lists.

Instructions

Compute with sparse matrices: info, solve, matmul, transpose, norm, eigsh or svds.

``a`` accepts ``{"rows", "cols", "values", "shape"}`` triplets, an
``@<path>.mtx`` Matrix Market file, or a dense two-dimensional list.
``b`` (solve/matmul) accepts a dense vector/matrix, a sparse triplet dict,
or an ``@<path>`` reference to .mtx/.npy/.csv/.tsv/.txt/.json data.

``solver`` applies to ``operation="solve"`` only: ``"direct"`` (default,
``spsolve``), ``"cg"`` (symmetric positive definite) or ``"gmres"``
(general square). Iterative solvers use a Jacobi preconditioner when every
diagonal entry is non-zero, honour ``tol`` as the relative residual
tolerance and ``maxiter`` as the iteration cap. Passing a non-direct
``solver`` with another operation returns ``err``. Solve results include
``"solver"``, ``"iterations"`` (``null`` for direct) and ``"residual"``
(``max(abs(a @ x - b))``).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aYes
bNo
kNo
tolNo
solverNodirect
maxiterNo
operationYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does so well: it discloses the Jacobi preconditioner condition, tol as relative residual tolerance, maxiter as iteration cap, the error path for invalid solver/operation combinations, and the solve return fields (solver, iterations, residual with the exact formula). It does not state whether the tool has any side effects or file-write behavior, which is the remaining gap.

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?

Front-loaded with the operation list, then organized by parameter (a formats, b formats, solver semantics) using inline code formatting. Dense but every sentence adds operational detail — no restatement of the title, no filler.

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?

With no output schema, the description must explain returns, and it does so for solve (solver/iterations/residual). It is not complete for the other operations — an agent gets no indication of what info, eigsh, svds, or norm return, and `k` is undefined — but the hardest parts (input coercion and iterative-solver behavior) are covered.

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

Parameters4/5

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

Schema description coverage is 0%, so the description must compensate and largely does: it documents the three accepted forms of `a`, the four-ish accepted forms of `b`, and gives concrete semantics for `solver`, `tol`, and `maxiter`. However `k` (default 6, surely the eigenpair/subspace count for eigsh/svds) is never mentioned anywhere, leaving one parameter entirely undocumented.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific resource (sparse matrices) and enumerates the exact operations it supports — info, solve, matmul, transpose, norm, eigsh, svds — which is far more precise than a restated name. It implicitly distinguishes itself from the dense sibling matrix_compute via the 'sparse' framing, but never names or contrasts that sibling explicitly, so it stops short of a 5.

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 real routing rules between operations: 'solver applies to operation="solve" only' and 'b (solve/matmul) accepts...', plus the consequence of misuse ('Passing a non-direct solver with another operation returns err'). What is missing is guidance on when to reach for sparse_compute versus a dense/matrix_compute sibling, so there are no alternatives or exclusions spelled out.

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