codecalc
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
| completions | {} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| list_languagesA | List every language codecalc can execute, with extension, compile flag, and what this machine resolved.
|
| list_execution_providersA | List execution providers (execution BACKENDS — local subprocess, gVisor-strict, remote) and their machine-readable capabilities. This is about which BACKEND runs your code, not which LANGUAGE it runs —
a provider's |
| execute_codeA | Execute Returns stdout, stderr, exit_code, duration_ms, cpu_ms, peak_memory_kb, verdict (OK/TLE/MLE/OLE/RTE).
With |
| session_startA | Start a persistent session. python3/node get a stateful REPL worker (variables/imports persist across execute_code calls); other languages get a persistent workspace directory. Returns session_id. |
| session_stopA | Stop a session: kill its REPL worker (if any) and delete its workspace. Also deletes every session_snapshot saved for it, unless keep_snapshots=True. |
| session_listA | List active sessions and their languages/state. |
| session_filesA | List workspace files, optionally using a bounded cursor page. Use session_artifacts, not this, for only the files executed code produced; use session_read_file for one file's contents. |
| session_write_fileA | Write a file into a session workspace (relative path, no escapes). Use this to seed input data for executed code. |
| session_artifactsA | List files created by executed code in a session (excluding runner internals like main.py/run.out). |
| session_snapshotA | Archive or restore a session's workspace files.
Snapshots are deleted when their session is stopped (session_stop(keep_snapshots=True) to keep them). |
| install_packageA | Install a package for a language (uv pip / npm / gem / go get / cargo add...). Asks the caller to confirm before installing (a protocol-level gate, not
just the With session_id, executed code in that session can import the result. NETWORK: yes, always. The package manager fetches from its registry (PyPI, npm, rubygems, crates.io). codecalc opens no socket itself; the child process does. NOT SANDBOXED: the installer runs as a direct subprocess of the server, so install-time hooks (npm postinstall, Python build backends, Cargo build scripts) execute with the server user's filesystem access. The environment is still restricted to the allowlist, so secrets do not leak, but the filesystem is not confined. Do not point this at untrusted input. See SECURITY.md. |
| execute_code_streamA | Execute code and STREAM progress + partial output as it runs. Use this, not execute_code/run_submit/session_run, for the same run when you want output while it runs, up to a 300s cap. Reports progress notifications to the client while the program runs, so agents can see output before the process finishes. Returns the same result shape and applies the SAME ceilings as execute_code: max_memory_mb, max_output_kb and max_cpu are forwarded to the executor exactly as execute_code forwards them, including the same 240 KiB per-stream clamp.
|
| trace_executionA | Debug WHY, line by line, for the ONE input you actually ran it on: which statements fired, in what order, with what variable values at each step, and which if/elif/while/for/try branch was taken versus never taken. Want just the printed output instead? Use execute_code. Returns Also returns TRUST: the trace is produced BY the traced program at its OWN privilege
— a debugging aid, not an attestation of behaviour, exactly as
trustworthy as that program's own stdout. For a structural Big-O guess with nothing executed, use analyze_complexity. |
| branch_reachabilityA | Which if/elif/else arms and while/for loops of this python3 function can ever run, which are dead code, and what inputs reach each — decided with z3, without running the program. Use trace_execution instead to see what happened on one run. Use z3_check, not this, when you already have an SMT-LIB2 script to solve directly rather than Python source to translate. Unannotated parameters default to int. Each branch reports
|
| run_submitA | Submit code for BACKGROUND execution; returns a run_id immediately. Use this, not execute_code/execute_code_stream/session_run, when you do not want to hold the call open — poll run_inspect(run_id), and run_cancel(run_id) to stop it early. Same request shape as execute_code minus This call's own reply carries no output — a small run_id handle — so
the Admission is capped (CODECALC_MAX_ACTIVE_RUNS, default 64): past that many runs still running/cancelling at once, this returns a resource_exhausted error rather than growing without bound — call run_inspect/run_cancel to make room, or wait for one to finish. Retention: see run_inspect.
|
| run_inspectA | Poll a background run started with run_submit. While running: {"ok": True, "state": "running"|"cancelling", "run_id", "provider_id", "started_at", "deadline"}. Once terminal ( Retention: a finished run's result stays inspectable for the life of this server process — call this as many times as you like; nothing is consumed by reading it. What IS released on the first terminal read is the PROVIDER's own resources for that run (RunSupervisor.cleanup(), idempotent on repeat calls) — the in-memory record of the run itself is not evicted; there is no cap or TTL on it here, deliberately: the durable state machine, leases and TTL-based eviction are out of this residual's scope (see run_supervisor.py's own docstring). A long-lived server that calls run_submit very many times will grow this table; the on-disk crash-recovery journal underneath it is already bounded (RunSupervisor.max_completed), independent of this. |
| run_cancelA | Cancel a background run started with run_submit. Idempotent: calling this on a run that is already finished/cleaned
reports Propagation depends on the SELECTED PROVIDER (see
list_execution_providers' |
| evaluate_expressionA | Use evaluate_expression, not calc_exact, for something other than
plain arithmetic on literal values. Symbolically evaluate to a value or
closed form via sympify: 'integrate(x2, x)', 'sqrt(144) + 210'. Not
simplification — for simplified/factored/expanded forms, use
symbolic(op="simplify"). Returns |
| truth_tableA | Build the truth table for a boolean expression over and/or/not/xor/ implies/iff (plus true/false constants and variables): 'a and b or not c', 'p xor q', 'a implies b'. Use z3_check, not this, for satisfiability over inequalities or non-boolean variables; use evaluate_expression for symbolic (non-boolean) math. Returns |
| z3_checkA | Use z3_check, not symbolic(op="solve"), for satisfiability over inequalities, boolean combinations, or several variables at once: sat/ unsat/unknown plus a model. Example: '(declare-const x Int)(assert (> x 5))(check-sat)'.
|
| matrixA | Structured matrix operations: det, inverse, eigenvalues, transpose, rank, trace.
|
| analyze_complexityA | Estimate the asymptotic (Big-O) time complexity of a code snippet via structural analysis. |
| benchmarkA | Empirically measure time complexity by running code at increasing input sizes. Contract: the code must read an integer N from stdin (first line) and do work
sized by N. codecalc runs it at each size in |
| compare_executionA | Run the same code in multiple languages side by side. Returns per-language stdout/stderr/exit/duration plus which was fastest. Example: {"python3": "print(67)", "node": "console.log(67)"} This tool fans out across every language with no per-language install
plumbing behind it; use |
| runtimes_statusA | Check every language runtime for available updates (NON-MUTATING). Reports current vs latest version per language, which package manager owns it (mise/rustup/swiftly/apt/npm/uv), and the exact command that would run. Each entry also carries NETWORK: yes. Non-mutating refers to this machine's runtimes, not to traffic — each package manager is asked what the latest version is, and they answer by contacting their own remote index. |
| update_runtimesA | Update language runtimes. SAFE BY DEFAULT: with apply=False this is a dry run — it returns the update commands that WOULD run without changing anything. Pass apply=True to actually execute them (mise up, rustup update, swiftly update, apt-get upgrade of language packages, npm -g update, uv tool upgrade). apply=True asks the caller to confirm first (a protocol-level gate, not
just the PRIVILEGE: the apt manager updates system packages and its command begins
with NETWORK: yes, on both paths. apply=False still asks each manager what the latest version is, which is a remote lookup; apply=True additionally downloads and installs. "Dry run" bounds what changes on disk, not what is sent. |
| session_read_fileA | Read a file from a session workspace. Text files return content. With as_image=True (or for image files), the file is returned as an inline image the model can see. Use session_files to discover paths; session_artifacts lists what executed code produced. |
| session_runA | Run a multi-file program already written into a session workspace
(via session_write_file). Use this, not
execute_code/execute_code_stream/run_submit, when Runs as a fresh process in the session workdir (not the REPL worker), so
relative imports and data files resolve. Returns stdout/stderr/verdict
plus the entry file's path. Oversized output spills into the session
workspace the same way execute_code's does — see its docstring for
Reports This tool takes no Every run copies |
| convert_unitsA | Convert a value between units (dimensional analysis via sympy). Supports metric/imperial length, mass, time, speed, energy, power, force, pressure, temperature (°C/°F/K), volume, area, data sizes, frequency. Examples: ('60','mph','km/h'), ('100','celsius','fahrenheit'), ('1','gb','mib'). Use list_units for the full alias table. |
| physical_constantsA | Look up a physical constant (speed_of_light, planck, avogadro, gravity, electron_mass, gas_constant, ...) or list all 22 with values. |
| list_unitsA | List every supported unit alias — all aliases and spellings — for convert_units. |
| calc_exactA | Use calc_exact, not evaluate_expression, for a literal arithmetic expression with no symbols in it. EXACT arithmetic: 0.1 + 0.2 == 0.3 is True here (False in plain Python). Everything is an exact rational, integers are arbitrary precision. Supports
|
| compare_thresholdA | Exact threshold check with a verdict and the shortfall when it fails. Use calc_exact, not this, when you want the computed VALUE rather than a threshold comparison.
|
| percentageA | Exact share and percentage of PART / TOTAL. Use calc_exact for a single arithmetic expression, or compare_threshold to check the result against a threshold rather than just compute it. |
| calc_statsA | Mean, median, sample stdev, and coefficient of variation (CV) for a sample of numbers. Pairs with percentiles for distribution shape (p50/p90/p95/p99) on the same sample, and with benchmark or verify_optimization, which are common sources of the timing samples this tool summarizes. CV > 0.2 flags run-to-run noise that swamps the effect. Returns n/mean/median/stdev/cv plus a cv_note. |
| percentilesA | p50/p90/p95/p99 (the 50th/90th/95th/99th percentile cutoffs) by nearest-rank AND linear interpolation. Pairs with calc_stats, which gives mean/median/stdev/CV on the same sample instead of these distribution points. Warns when n < 100 that p99 is just the maximum wearing a label. |
| collision_probabilityA | Birthday-bound hash collision probability: 1 - exp(-n^2 / (2*2^b)). Sizes hashes: 1e6 items into 64 bits is ~2.7e-8; 1e5 into 32 bits is ~0.69 — the answer to 'can I truncate this to 8 hex chars?' (no). |
| data_sizesA | Byte counts for a plain integer, both binary and decimal — the gap
between them is where '291 MB' and '277 MiB' silently disagree by 5%.
For units other than bytes, use convert_units. For a duration, not a
byte count, use human_duration. Returns |
| human_durationA | Convert a SPAN of elapsed seconds into a humanised duration (e.g.
'2d 3h 4m 5s') plus per-day and per-30d rates. For an epoch timestamp
to a calendar date, use epoch_time instead. For byte counts, not
seconds, use data_sizes. Returns |
| epoch_timeA | Epoch seconds/millis/micros/nanos to ISO 8601 UTC (implausible readings suppressed). |
| bitsA | Programmer-mode integer facts and operations, selected by mode="analysis" (was bit_analysis) — facts about a single N: popcount,
bit length, trailing zeros, power-of-two check, next power of two. Used
by this mode: mode="op" (was bitop) — combine two integers mode="widths" (was int_widths) — which widths (i8..i64/u8..u64) hold
mode="repr" (was base_repr) — hex/oct/bin of |
| radix_convertA | Convert a value between ANY bases 2..36, fractions included; bases that
cannot represent the fraction (e.g. 0.1 in base 2) are flagged
non-terminating. |
| float_reprA | What binary64 actually stores for X: exact value, raw bits, ULP, both
neighbours, and whether the literal is representable. |
| algebraic_equivA | Are two expressions algebraically identical? 'is (ab)/c the same as a(b/c)?' answered exactly. Use symbolic(op="simplify"), not this, to see one expression's own simplified/factored/expanded forms rather than compare two; use verify_translation to compare running PROGRAMS, not expressions. Caveat: symbolic identity says nothing about float rounding, integer truncation or modular overflow. |
| symbolicA | Symbolic algebra, selected by op="solve" (was solve_expression) — the roots of one equation:
'x**2 - 4 = 0', '2*x + 1 = 7'. For a system of several equations, use
op="solve_linear". For general constraint satisfiability (inequalities,
boolean constraints, multiple solvers), use z3_check. Returns
op="solve_linear" (was solve_linear) — a system of equations sharing
variables. Example: system='x + y = 10; x - y = 2', variables='x, y'.
Used by this op: op="simplify" (was simplify_expression) — simplify, factor, and expand
an expression — algebraic forms, not solving (use op="solve") and not a
numeric value (use calc_exact). Returns op="limit" (was limit_expression) — asymptotic behaviour: limit of
|
| verify_translationA | PROVE that a port is equivalent: run both programs, compare their output. You write the translation — you are the language model. This runs your source and your port on the same inputs and reports, per input, whether they matched, diverged, or could not be compared (a runtime that is missing or a program that failed on both sides is INCONCLUSIVE, never a pass). Use it after porting anything: python3 -> go, node -> rust, a rewritten function against the original. Pair with compare_edge_cases to find the inputs worth testing. Matching tolerates only line-ending/trailing-whitespace noise; stdout_raw carries what actually ran. A pass is graded |
| compare_edge_casesA | Run the same logic in N languages on edge-case inputs and flag divergence. Default inputs cover empty, zero, negative, and float-precision cases: ['', '0', '1', '-1', '10', '100', '0.1\n0.2']. Returns a per-input matrix plus a divergences list where languages disagree on identical input. |
| verify_optimizationA | PROVE an optimisation: same outputs, measurably AND SIGNIFICANTLY faster. Two gates, in order. Correctness: runs A rejection names which gate failed and by how much, e.g. "correct, 1.3x median, but only 1/4 sizes significant." Accepted grades |
| extract_functionA | Extract a named function (with its imports + referenced helpers) into a standalone program and run it in the sandbox. python3 gets exact ast extraction; other languages best-effort block
extraction (pass |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
| verify_translation view | Interactive per-case comparison table for a verify_translation result, with first-differing-line highlighting. Ignored by hosts without MCP Apps support. |
| verify_optimization view | Interactive per-size timing chart and significance table for a verify_optimization result. Ignored by hosts without MCP Apps support. |
TDQS
Scored across 49 tools
Many tools are clearly distinct (e.g., session_*, run_*, symbolic vs calc_exact), but there is notable overlap among execution tools: execute_code, execute_code_stream, run_submit, session_run, and compare_execution all run code with different modes, and several math tools (calc_exact, evaluate_expression, symbolic, calc_stats, percentiles) have adjacent purposes. The descriptions are detailed enough to disambiguate with careful reading, but the sheer number of similar execution/math tools creates real selection risk.
Most tools follow a clear verb_noun pattern (execute_code, session_start, run_inspect, convert_units, verify_optimization). There are minor deviations: 'bits' and 'symbolic' are noun/adjective-only names, and 'matrix' is a single noun, but these are documented as mode-based consolidated tools. Overall the pattern is consistent and predictable.
49 tools is a very large surface for a code calculation/execution server. While the server covers many domains (execution, sessions, math, units, verification, runtimes), the count is heavy and includes several consolidated mode-based tools that could reduce the count further. It exceeds the typical well-scoped range and will burden agent tool selection.
The server covers its apparent domains thoroughly: code execution (sync, stream, background, session), file/session management, math/units/constants, verification (optimization, translation, edge cases), and runtime management. Minor gaps exist (e.g., no explicit session_run cancellation, no direct file deletion tool), but the core workflows are well covered and there are no obvious dead ends.