MetaMask MCP

write-contract

Execute write functions on smart contracts via MetaMask MCP by specifying ABI, address, function name, and arguments. Securely manage transactions and blockchain operations.

Instructions

Execute a write function on a contract.

Input Schema

NameRequiredDescriptionDefault
abiYesThe contract's ABI.
addressYesThe contract's address.
argsNoArguments to pass when calling the contract.
chainIdNoChain ID to validate against before sending transaction.
functionNameYesFunction to call on the contract.
maxFeePerGasNoTotal fee per gas in wei, inclusive of maxPriorityFeePerGas.
maxPriorityFeePerGasNoMax priority fee per gas in wei.
valueNoValue in wei sent with this transaction.

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "abi": { "description": "The contract's ABI.", "items": { "anyOf": [ { "additionalProperties": false, "properties": { "inputs": { "items": { "allOf": [ { "properties": { "internalType": { "type": "string" }, "name": { "anyOf": [ { "anyOf": [ { "not": {} }, { "pattern": "[a-zA-Z$_][a-zA-Z0-9$_]*", "type": "string" } ] }, { "const": "", "type": "string" } ] } }, "type": "object" }, { "anyOf": [ { "additionalProperties": false, "properties": { "type": { "anyOf": [ { "const": "address", "type": "string" }, { "const": "bool", "type": "string" }, { "pattern": "^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$", "type": "string" }, { "const": "function", "type": "string" }, { "const": "string", "type": "string" }, { "pattern": "^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$", "type": "string" }, { "pattern": "^(address|bool|function|string|bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?|u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?)(\\[[0-9]{0,}\\])+$", "type": "string" } ] } }, "required": [ "type" ], "type": "object" }, { "additionalProperties": false, "properties": { "components": { "items": { "$ref": "#/properties/abi/items/anyOf/0/properties/inputs/items" }, "type": "array" }, "type": { "anyOf": [ { "const": "tuple", "type": "string" }, { "pattern": "^tuple(\\[[0-9]{0,}\\])+$", "type": "string" } ] } }, "required": [ "type", "components" ], "type": "object" } ] } ] }, "type": "array" }, "name": { "type": "string" }, "type": { "const": "error", "type": "string" } }, "required": [ "type", "inputs", "name" ], "type": "object" }, { "additionalProperties": false, "properties": { "anonymous": { "type": "boolean" }, "inputs": { "items": { "allOf": [ { "$ref": "#/properties/abi/items/anyOf/0/properties/inputs/items" }, { "properties": { "indexed": { "type": "boolean" } }, "type": "object" } ] }, "type": "array" }, "name": { "$ref": "#/properties/abi/items/anyOf/0/properties/inputs/items/allOf/0/properties/name/anyOf/0/anyOf/1" }, "type": { "const": "event", "type": "string" } }, "required": [ "type", "inputs", "name" ], "type": "object" }, { "allOf": [ { "properties": { "constant": { "type": "boolean" }, "gas": { "type": "number" }, "payable": { "type": "boolean" } }, "type": "object" }, { "anyOf": [ { "additionalProperties": false, "properties": { "inputs": { "items": { "$ref": "#/properties/abi/items/anyOf/0/properties/inputs/items" }, "type": "array" }, "name": { "pattern": "[a-zA-Z$_][a-zA-Z0-9$_]*", "type": "string" }, "outputs": { "items": { "$ref": "#/properties/abi/items/anyOf/0/properties/inputs/items" }, "type": "array" }, "stateMutability": { "enum": [ "pure", "view", "nonpayable", "payable" ], "type": "string" }, "type": { "const": "function", "type": "string" } }, "required": [ "type", "inputs", "name", "outputs", "stateMutability" ], "type": "object" }, { "additionalProperties": false, "properties": { "inputs": { "items": { "$ref": "#/properties/abi/items/anyOf/0/properties/inputs/items" }, "type": "array" }, "stateMutability": { "enum": [ "payable", "nonpayable" ], "type": "string" }, "type": { "const": "constructor", "type": "string" } }, "required": [ "type", "inputs", "stateMutability" ], "type": "object" }, { "additionalProperties": false, "properties": { "inputs": { "items": [], "maxItems": 0, "minItems": 0, "type": "array" }, "stateMutability": { "enum": [ "payable", "nonpayable" ], "type": "string" }, "type": { "const": "fallback", "type": "string" } }, "required": [ "type", "stateMutability" ], "type": "object" }, { "additionalProperties": false, "properties": { "stateMutability": { "const": "payable", "type": "string" }, "type": { "const": "receive", "type": "string" } }, "required": [ "type", "stateMutability" ], "type": "object" } ] } ] } ] }, "type": "array" }, "address": { "description": "The contract's address.", "type": "string" }, "args": { "description": "Arguments to pass when calling the contract.", "items": {}, "type": "array" }, "chainId": { "description": "Chain ID to validate against before sending transaction.", "type": "number" }, "functionName": { "description": "Function to call on the contract.", "type": "string" }, "maxFeePerGas": { "description": "Total fee per gas in wei, inclusive of maxPriorityFeePerGas.", "format": "int64", "type": "integer" }, "maxPriorityFeePerGas": { "description": "Max priority fee per gas in wei.", "format": "int64", "type": "integer" }, "value": { "description": "Value in wei sent with this transaction.", "format": "int64", "type": "integer" } }, "required": [ "abi", "address", "functionName" ], "type": "object" }
ID: cw2ldcetl4