Skip to main content
Glama

modular_arithmetic

Perform modular arithmetic operations: calculate modular exponentiation, modular inverse, or remainder for cryptographic and number-theoretic tasks.

Instructions

Modular arithmetic operations: modpow (a^b mod m), modinverse (a^-1 mod m), or mod (a mod m).

Input Schema

NameRequiredDescriptionDefault
aYesBase value.
bNoExponent (required for modpow).
mYesModulus (positive integer).
operationYesOperation: modpow, modinverse, or mod.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.1.11

TDQS

A3.5/5.0
Behavior3/5

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

With no annotations, the description carries the full behavioral burden. It discloses the computational semantics of each operation, which is useful, but says nothing about failure modes (e.g., non-invertible a for modinverse), numeric type behavior, or that the modulus must be a positive integer. The mathematical content is solid but the operational edge cases are absent.

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?

A single sentence with the domain front-loaded and the three operations parenthetically defined. Zero filler; every clause clarifies the operation parameter.

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

Completeness3/5

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

For a pure-computation tool with no output schema or annotations, the description explains the computations adequately but omits constraints that affect correct invocation, such as coprime requirements for modinverse and the conditional nature of b. Sufficient to call, but not complete.

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 schema already documents a, b, m, and operation. The description's formulas reinforce the meaning of the operation parameter beyond the schema's plain list, but add no format or constraint detail the schema lacks, so the baseline of 3 applies.

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?

Names the tool's domain (modular arithmetic) and enumerates the three operations with explicit mathematical formulas (a^b mod m, a^-1 mod m, a mod m), so an agent immediately knows what it computes. It doesn't differentiate itself from nearby siblings like chinese_remainder or euler_totient, but the operation list is specific enough to identify the tool.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is implied through the operation definitions: an agent can infer it should pick modpow for exponentiation mod m, modinverse for inverses, or mod for plain reduction. However, there is no explicit when-to-use guidance, no mention of alternatives, and no note that modinverse requires gcd(a, m) = 1.

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

Deploy Server

Other Tools