Skip to main content
Glama

get_erc1155_token_uri

Retrieve the metadata URI for a specific ERC1155 token, which points to JSON data about the token's properties, including its contract address and ID, across Ethereum-compatible networks.

Instructions

Get the metadata URI for an ERC1155 token (multi-token standard used for both fungible and non-fungible tokens). The URI typically points to JSON metadata about the token.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
networkNoNetwork name (e.g., 'ethereum', 'optimism', 'arbitrum', 'base', 'polygon') or chain ID. ERC1155 tokens exist across many networks. Defaults to Ethereum mainnet.
tokenAddressYesThe contract address of the ERC1155 token collection (e.g., '0x76BE3b62873462d2142405439777e971754E8E77')
tokenIdYesThe ID of the specific token to query metadata for (e.g., '1234')

Implementation Reference

  • The main handler function that implements the logic to fetch the ERC1155 token URI by calling the contract's 'uri' method using viem's getContract and read functionality.
    /** * Get ERC1155 token URI */ export async function getERC1155TokenURI( tokenAddress: Address, tokenId: bigint, network: string = 'ethereum' ): Promise<string> { const publicClient = getPublicClient(network); const contract = getContract({ address: tokenAddress, abi: erc1155Abi, client: publicClient, }); return contract.read.uri([tokenId]); }
  • The ABI definition used by the handler to interact with the ERC1155 contract's uri function.
    // Standard ERC1155 ABI (minimal for reading) const erc1155Abi = [ { inputs: [{ type: 'uint256', name: 'id' }], name: 'uri', outputs: [{ type: 'string' }], stateMutability: 'view', type: 'function' } ] as const;

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