Skip to main content
Glama

calculate

Run Diablo II odds, expected values, rune math, breakpoints, frame counts, and small Monte Carlo simulations from a sandboxed Python subset instead of estimating them.

Instructions

Run numbers instead of estimating them: drop odds over N runs, expected values, rune maths, breakpoints, frame counts, small Monte Carlo sims. code is a tiny Python subset: numbers, strings, lists, dicts, arithmetic, assignments, if/for/while, comprehensions, print(), list/dict/set/string methods, and these functions: abs min max sum round len range int float str sorted enumerate zip any all divmod pow format, sqrt exp log log10 log2 floor ceil comb perm factorial gcd prod fsum pi e inf, mean median stdev, random randint uniform choice choices shuffle sample seed. No imports or files. It ends after 5 s of CPU or 256 MB. The value of the last line is shown, plus anything printed. Example: 'p = 1/2950\nruns = 500\nprint(f"{1-(1-p)**runs:.1%} for at least one")'. Show the result, not the code, unless someone asks how you worked it out; for a sim, say it's a simulation and how many trials.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "code": "<code>"
    },
    "name": "calculate"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYes

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.2/5.0
Behavior3/5

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

With no annotations supplied, the description carries the full behavioral burden and does so well: it discloses sandbox limits (no imports or files, 5 s CPU, 256 MB), the exact language subset and available functions, and what is returned (last line value plus printed output). Deficits: nothing about error behavior when code fails or exceeds limits, no rate-limit or side-effect statement. Solid but not complete.

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?

Front-loaded with the purpose, then progressively narrower detail: use cases, language subset, resource limits, return behavior, worked example, output etiquette. The long function enumeration is dense but earns its place by defining what will actually run; a few items could be grouped without loss.

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?

For a single-parameter code-execution tool with an output schema, the definition covers everything an agent needs to call it correctly and interpret the response: syntax surface, resource ceilings, return semantics, and a concrete example. Nothing material is left to inference.

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?

One parameter at 0% schema description coverage, so the description must compensate, and it largely does — it defines exactly what may appear in `code` (arithmetic, assignments, control flow, comprehensions, print, the whitelisted functions and modules). What is missing is the actual param name being tied to that content and any note on quoting or escaping in the JSON string.

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?

States a concrete verb and resource — evaluate numeric expressions with a small Python subset instead of estimating — and the example makes the capability unambiguous. An agent can tell this apart from the sibling lookup tools (drop_chances, hit_chance, frame_breakpoints) that return precomputed data rather than execute code.

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?

"Run numbers instead of estimating them" plus the enumerated use cases (drop odds over N runs, expected values, breakpoints, Monte Carlo) give clear triggering contexts, and the closing line prescribes how to present results. It stops short of naming when NOT to use it or pointing at a sibling like drop_chances when a precomputed value would suffice, so it is clear but not exhaustive.

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