Skip to main content
Glama

scan_contract_selectors

Read-onlyIdempotent

Inspect EVM contract bytecode to extract 4-byte function selectors and flag high-risk privileged functions such as transferOwnership, upgradeTo, mint, and selfdestruct.

Instructions

Stage 1 Free ($0.00) deterministic EVM bytecode inspector that extracts 4-byte function selectors and flags privileged backdoors (transferOwnership, upgradeTo, mint, selfdestruct). Queries live RPC for chain_id (8453 Base, 84532 Base Sepolia, 42161 Arbitrum) unless bytecode_override (0x hex) is supplied for offline analysis; falls back to empty bytecode on RPC error. Returns JSON with is_contract, bytecode_size_bytes, selectors_found, high_risk_selectors, risk_level (HIGH, LOW, EOA), and recommendation.

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": {
      "target_address": "<target_address>"
    },
    "name": "scan_contract_selectors"
  }
}

Input Schema

NameRequiredDescriptionDefault
chain_idNoEVM Chain ID (8453 for Base Mainnet, 84532 for Base Sepolia, 42161 for Arbitrum One)
target_addressYesHex EVM address of smart contract to inspect (e.g. '0x4200000000000000000000000000000000000006')
bytecode_overrideNoOptional raw contract runtime bytecode hex string (0x...) for offline analysis without RPC calls

Output Schema

NameRequiredDescriptionDefault
toolNo
stageNo
chain_idNo
cost_usdNo
risk_levelYes
is_contractYes
recommendationNo
target_addressYes
selectors_foundYes
bytecode_size_bytesNo
high_risk_selectorsYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.1.1
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "bytecode_size_bytes": {
      +      "type": "integer"
      +    },
      +    "chain_id": {
      +      "type": "integer"
      +    },
      +    "cost_usd": {
      +      "type": "number"
      +    },
      +    "high_risk_selectors": {
      +      "items": {
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "is_contract": {
      +      "type": "boolean"
      +    },
      +    "recommendation": {
      +      "type": "string"
      +    },
      +    "risk_level": {
      +      "enum": [
      +        "HIGH",
      +        "LOW",
      +        "EOA"
      +      ],
      +      "type": "string"
      +    },
      +    "selectors_found": {
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    "stage": {
      +      "type": "integer"
      +    },
      +    "target_address": {
      +      "type": "string"
      +    },
      +    "tool": {
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "target_address",
      +    "is_contract",
      +    "selectors_found",
      +    "high_risk_selectors",
      +    "risk_level"
      +  ],
      +  "type": "object"
      +}
  2. First observedv0.1.0

TDQS

A3.8/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, openWorldHint and destructiveHint=false, so the safety profile is covered structurally. The description earns credit for disclosing what the schema cannot: that RPC failures silently fall back to empty bytecode (a failure mode an agent must interpret), the supported chain set, and that the inspection is deterministic. It stops short of describing latency or rate-limit behavior.

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?

Structure is front-loaded: purpose, then behavior/fallback, then outputs. Three dense sentences with little filler. The main waste is the closing enumeration of return fields, which duplicates the existing output schema.

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

Completeness4/5

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

Given an output schema exists, the return-value recap is unnecessary but harmless; everything an agent needs to call the tool correctly — required address, chain options, the offline escape hatch, and the error fallback — is present. It is slightly short on what an agent should conclude from risk_level EOA versus LOW and when to escalate to a deeper audit.

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 description coverage is 100%, so the baseline is 3. The description goes beyond it by explaining the interaction between parameters: bytecode_override bypasses the live RPC lookup entirely for offline analysis, which is a conditional relationship the per-field schema text does not state. It also repeats the chain_id enumerations, which is mild redundancy rather than added meaning.

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 names a specific verb+resource combination ('deterministic EVM bytecode inspector that extracts 4-byte function selectors') and enumerates the exact signals it flags (transferOwnership, upgradeTo, mint, selfdestruct). The 'Stage 1 Free' framing hints at an escalation path toward a deeper analyzer but never names a sibling explicitly, so differentiation is implied rather than stated.

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 context is implied through the pricing/staging language ('Stage 1 Free ($0.00)') and the offline-vs-live RPC branch, which tells an agent this is a cheap first-pass screen. However, there is no explicit statement of when to prefer this over deeper analysis or honeypot checks, and no exclusions are given.

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