Skip to main content
Glama

Mod Inverse

mod_inverse
Read-onlyIdempotent

The inverse of a modulo m, the residue from 0 to m-1 with a*inverse = 1 mod m. The inverse of 3 mod 7 is 5, and the inverse of -1 mod 7 is 6. There is no inverse when a and m share a factor. m runs from 2 to 1000000000000. Price: $0.001 USDC per successful call (x402, Solana). Same tool over HTTPS: POST https://scorptech.it.com/api/x402/v1/mod-inverse

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": {
      "a": "<a>",
      "m": "<m>"
    },
    "name": "mod_inverse"
  }
}

Input Schema

NameRequiredDescriptionDefault
aYes
mYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.1/5.0
Behavior5/5

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

Goes well beyond the read-only/idempotent annotations: it discloses the failure mode (shared factor → no inverse), the exact output range, the cost ($0.001 USDC per successful call, x402 on Solana) and an alternative HTTPS endpoint. Payment and error semantics are exactly the context annotations cannot carry.

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 definition, then examples, edge case, constraints, and finally commercial/transport info — a sensible order with little waste. The m-range sentence partly duplicates the schema's min/max, a minor redundancy.

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?

With no output schema, the description still specifies the return value (residue 0..m-1) and the error condition, and it adds pricing/auth and an alternate endpoint. An agent can call this correctly and interpret the result without further context.

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 coverage is 0%, so the description must carry the load, and it largely does: it explains the relation between a and m, restates m's domain, and the '-1 mod 7 is 6' example implicitly documents that a may be negative (schema allows -1e12). It does not address a=0 or the full range of a explicitly.

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?

Specific verb and resource: it defines the operation mathematically ('the residue from 0 to m-1 with a*inverse = 1 mod m') and backs it with two worked examples. The only gap is sibling differentiation — a near-identical sibling 'mod_inv' exists and is never mentioned, so the agent cannot tell the two apart from this text.

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 examples and the domain constraint (m from 2 to 1000000000000) plus the failure condition ('no inverse when a and m share a factor'). It never says when to pick this over mod_inv, power_mod, or egcd, so alternatives are left to inference.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources