MetaMask MCP

read-contract

Execute read-only functions on smart contracts to retrieve data without modifying the blockchain state. Requires ABI, contract address, and function details for accurate responses.

Instructions

Call a read-only function on a contract, and returning the response.

Input Schema

NameRequiredDescriptionDefault
abiYesThe contract's ABI.
addressYesThe contract's address.
argsNoArguments to pass when calling the contract.
chainIdNoID of chain to use when fetching data.
functionNameYesFunction to call on the contract.

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": "ID of chain to use when fetching data.", "type": "number" }, "functionName": { "description": "Function to call on the contract.", "type": "string" } }, "required": [ "abi", "address", "functionName" ], "type": "object" }
ID: cw2ldcetl4