Skip to main content
Glama

getNFTOwner

Retrieve the Ethereum address that owns a specific ERC721 NFT token by providing the contract address and token ID. This tool queries blockchain data to identify current NFT ownership.

Instructions

Get the current owner of a specific ERC721 NFT token. Returns the Ethereum address that owns the specified token ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contractAddressYesThe address of the ERC721 contract
tokenIdYesThe ID of the token to check
providerNoOptional. The provider to use. If not provided, the default provider is used.
chainIdNoOptional. The chain ID to use.

Implementation Reference

  • Registration of the getNFTOwner MCP tool, including inline schema definition and handler function that queries the owner via ethersService and returns formatted response.
    server.tool( "getNFTOwner", "Get the current owner of a specific ERC721 NFT token. Returns the Ethereum address that owns the specified token ID.", { contractAddress: contractAddressSchema.describe("The address of the ERC721 contract"), tokenId: tokenIdSchema.describe("The ID of the token to check"), provider: providerSchema.describe("Optional. The provider to use. If not provided, the default provider is used."), chainId: chainIdSchema.describe("Optional. The chain ID to use.") }, async (params) => { try { const owner = await ethersService.getERC721Owner( params.contractAddress, params.tokenId, params.provider, params.chainId ); return { content: [{ type: "text", text: `Owner of token ${params.tokenId} is ${owner}` }] }; } catch (error) { return { isError: true, content: [{ type: "text", text: `Error getting NFT owner: ${error instanceof Error ? error.message : String(error)}` }] }; } } );
  • TypeScript type definition for the input parameters of the getNFTOwner tool.
    type GetNFTOwnerParams = { contractAddress: string; tokenId: string | number; provider?: string; chainId?: number; };
  • Call to registerERC721Tools function which includes the getNFTOwner tool registration.
    registerERC721Tools(server, ethersService);
  • src/mcpServer.ts:51-51 (registration)
    Top-level call to registerAllTools, which indirectly registers getNFTOwner via the tools index.
    registerAllTools(server, ethersService);

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/crazyrabbitLTC/mcp-ethers-server'

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