Skip to main content
Glama

check-arithmetic

Detect integer overflow, underflow, precision loss, and unsafe type casting in Rust/Anchor source code to prevent arithmetic vulnerabilities in Solana programs.

Instructions

Detect integer overflow/underflow, precision loss, and unsafe type casting.

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": {
      "source_code": "<source_code>"
    },
    "name": "check-arithmetic"
  }
}

Input Schema

NameRequiredDescriptionDefault
source_codeYesRust/Anchor source code

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.0.0

TDQS

B3.2/5.0
Behavior2/5

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

No annotations exist, so the description carries the full burden. It states what categories of issue are found but says nothing about what is returned (findings list? severity? line numbers?), whether it is read-only or static, or any limits on the analysis — all of which an agent needs before invoking.

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?

A single front-loaded sentence with zero filler; the detected defect classes come immediately. It is efficient, though the terseness leaves the definition thin rather than genuinely optimized.

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 one-parameter static check this is minimally adequate: the input is well covered by the schema. However, with no output schema and no annotations, the agent is left guessing the response shape and the scope of the analysis, which the description should have supplied.

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?

Only one parameter exists and the schema documents it at 100% coverage ('Rust/Anchor source code'). The description adds no further constraint on the input, such as whether whole files, snippets, or project roots are accepted, so baseline 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?

Specific verb 'Detect' paired with a concrete list of defect classes (integer overflow/underflow, precision loss, unsafe type casting). It clearly reads as an arithmetic-safety checker, which implicitly separates it from siblings like check-accounts or check-cpi, though it never states that distinction explicitly.

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 only implied: the check-* naming and the defect list suggest running it on source code during an audit. There is no explicit when-to-use statement, no note that it applies to Rust/Anchor specifically (only the schema says so), and no routing to or away from the other check-* siblings.

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