Skip to main content
Glama

check-cpi

Analyze Solana Cross-Program Invocations to detect arbitrary CPI, reentrancy, privilege escalation, and program ID validation issues in Rust/Anchor source code.

Instructions

Analyze Cross-Program Invocations for safety: arbitrary CPI, reentrancy, privilege escalation, program ID validation.

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-cpi"
  }
}

Input Schema

NameRequiredDescriptionDefault
source_codeYesRust/Anchor source code

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.0.0

TDQS

A3.5/5.0
Behavior3/5

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

No annotations are provided, so the description carries the full behavioral burden. It usefully discloses the analysis categories covered, which is real content beyond the tool name, but it does not state whether the tool only reads the code, what the findings look like, or any limits on input size.

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?

The definition is a single efficient sentence with the core action front-loaded and the checked vulnerability classes listed compactly. No wording is wasted.

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 simple one-input analysis tool this covers the purpose, but with no annotations and no output schema the description should explain what the analysis returns, such as findings or a pass/fail result. That gap leaves the agent unsure what to expect after invocation.

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?

There is a single required parameter, source_code, and the schema already documents it at 100% coverage as 'Rust/Anchor source code'. The description adds no further parameter-level detail, so the baseline score 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?

The description gives a specific verb and resource ('Analyze Cross-Program Invocations') and enumerates the exact safety classes examined: arbitrary CPI, reentrancy, privilege escalation, and program ID validation. This clearly separates it from sibling checkers such as check-accounts or check-arithmetic, though it never explicitly names an alternative.

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 by the CPI-specific scope, so an agent can infer it should be used when auditing cross-program invocation code. However, there is no explicit when-to-use framing, no prerequisites, and no statement about when another checker would be more appropriate.

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