Skip to main content
Glama

write_contract

Initiate state-changing smart contract functions on Ethereum-compatible blockchains. Specify contract details, ABI, function, and arguments, then sign and send transactions securely.

Instructions

Write data to a smart contract by calling a state-changing function. This modifies blockchain state and requires gas payment and transaction signing.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
abiYesThe ABI (Application Binary Interface) of the smart contract function, as a JSON array
argsYesThe arguments to pass to the function, as an array (e.g., ['0x1234...', '1000000000000000000'])
contractAddressYesThe address of the smart contract to interact with
functionNameYesThe name of the function to call on the contract (e.g., 'transfer')
networkNoNetwork name (e.g., 'ethereum', 'optimism', 'arbitrum', 'base', 'polygon') or chain ID. Defaults to Ethereum mainnet.
privateKeyYesPrivate key of the sending account in hex format (with or without 0x prefix). SECURITY: This is used only for transaction signing and is not stored.
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by disclosing critical behavioral traits: it modifies blockchain state, requires gas payment, and needs transaction signing. It also mentions the private key is used only for signing and not stored, addressing security concerns. However, it doesn't cover potential failure modes, transaction confirmation times, or gas estimation details.

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 description is perfectly concise with two sentences that each earn their place: the first states the core purpose, and the second covers critical behavioral requirements. It's front-loaded with the main action and wastes no words.

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?

For a complex state-changing tool with no annotations and no output schema, the description does well by covering the mutation nature, gas requirements, and signing needs. However, it doesn't describe what the tool returns (e.g., transaction hash, receipt) or error conditions, which would be helpful given the absence of an output schema.

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?

Schema description coverage is 100%, so the schema already documents all 6 parameters thoroughly. The description doesn't add any parameter-specific information beyond what's in the schema, so it meets the baseline of 3. It doesn't compensate for any gaps because there are none in the schema.

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?

The description clearly states the specific action ('Write data to a smart contract by calling a state-changing function') and resource ('smart contract'), distinguishing it from sibling tools like 'read_contract' (read-only) and 'estimate_gas' (estimation only). It explicitly mentions blockchain state modification, which is a key differentiator.

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?

The description provides clear context for when to use this tool: for state-changing functions that modify blockchain state, require gas payment, and need transaction signing. It implicitly distinguishes from 'read_contract' (no state changes) but doesn't explicitly name alternatives or specify when NOT to use it.

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

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mcpdotdirect/evm-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server