Skip to main content
Glama

Read any contract function on Base and get the decoded result

contract_call
Read-only

Call any read-only (view/pure) function on a Base contract and get the decoded answer. Give the function as a signature like balanceOf(address) returns (uint256) plus args, or raw 0x calldata. Supports address, bool, uint/int, bytesN, string, bytes and arrays, an optional historical block, and plain revert reasons. Raw return data is always included. Not charged for invalid input, reverted calls, or when Base can't be reached. Paid via x402; see list_prices.

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": {
      "contract": "<contract>"
    },
    "name": "contract_call"
  }
}

Input Schema

NameRequiredDescriptionDefault
argsNoArguments in order (big numbers as strings; arrays as lists).
dataNoOptional instead of function: raw 0x calldata.
blockNoOptional: "latest" (default) or a block number.
returnsNoOptional: return types if not in the signature, e.g. "uint112,uint112,uint32".
contractYesContract 0x address on Base.
functionNoFunction signature, e.g. "balanceOf(address) returns (uint256)".

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / args / items / anyOf
      Previous value: -[
      -  {
      -    "maxLength": 512,
      -    "type": "string"
      -  },
      -  {
      -    "type": "number"
      -  },
      -  {
      -    "type": "boolean"
      -  },
      -  {
      -    "items": {
      -      "anyOf": [
      -        {
      -          "maxLength": 512,
      -          "type": "string"
      -        },
      -        {
      -          "type": "number"
      -        },
      -        {
      -          "type": "boolean"
      -        }
      -      ]
      -    },
      -    "maxItems": 200,
      -    "type": "array"
      -  }
      -]New value: +[
      +  {
      +    "maxLength": 512,
      +    "type": "string"
      +  },
      +  {
      +    "type": "number"
      +  },
      +  {
      +    "type": "boolean"
      +  },
      +  {
      +    "items": {
      +      "anyOf": [
      +        {
      +          "maxLength": 512,
      +          "type": "string"
      +        },
      +        {
      +          "type": "number"
      +        },
      +        {
      +          "type": "boolean"
      +        }
      +      ]
      +    },
      +    "maxItems": 200,
      +    "type": "array"
      +  },
      +  {
      +    "additionalProperties": {},
      +    "type": "object"
      +  }
      +]
  2. Added

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already cover readOnlyHint and openWorldHint, yet the description adds genuinely new behavior: raw return data always included, plain revert reasons, and billing rules (no charge on invalid input, revert, or unreachable Base, paid via x402). This is meaningful context beyond structured fields, though rate/limit details 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.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core action, then progressively adds invocation formats and billing. Dense but every sentence carries information; slightly long but not padded.

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?

No output schema exists, and the description compensates by stating raw return data is always included and revert reasons are surfaced. For a 6-param tool this is nearly complete, missing only error-shape or example return detail.

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 100%, so baseline is 3, but the description adds supported-type semantics (address, bool, uint/int, bytesN, string, bytes, arrays) and the signature-vs-calldata relationship that clarifies how function/data interact. It stops short of describing individual param constraints like arg ordering beyond the schema note.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb ('Call'), resource ('read-only function on a Base contract'), and outcome ('get the decoded answer'). The read-only/decoded framing distinguishes it from raw-call or event-reading siblings like chain_contract and contract_events.

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

Usage Guidelines4/5

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

Clearly lays out the two invocation modes ('signature ... plus args, or raw 0x calldata') and notes the optional historical block. It gives context for use but doesn't explicitly say when to prefer this over a sibling such as chain_contract.

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