Skip to main content
Glama

get_nft_metadata

Retrieve metadata for specific NFTs by providing contract address and token ID, supporting ERC721 and ERC1155 token standards.

Instructions

Get metadata for a specific NFT

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contractAddressYesThe contract address of the NFT
tokenIdYesThe token ID of the NFT
tokenTypeNoThe token type (ERC721 or ERC1155)
refreshCacheNoWhether to refresh the cache

Implementation Reference

  • The handler function for the get_nft_metadata tool. Validates the input parameters using isValidGetNftMetadataParams and calls the Alchemy SDK's nft.getNftMetadata method with contractAddress, tokenId, and additional params.
    private async handleGetNftMetadata(args: Record<string, unknown>) {
      const params = this.validateAndCastParams<GetNftMetadataParams>(
        args,
        isValidGetNftMetadataParams,
        "Invalid NFT metadata parameters"
      );
      return await this.alchemy.nft.getNftMetadata(
        params.contractAddress,
        params.tokenId,
        params
      );
    }
  • TypeScript type definition for GetNftMetadataParams, extending GetNftMetadataOptions with required contractAddress and tokenId.
    type GetNftMetadataParams = GetNftMetadataOptions & {
      contractAddress: string;
      tokenId: string;
    };
  • Validation function for get_nft_metadata parameters, ensuring required fields and types.
    const isValidGetNftMetadataParams = (
      args: any
    ): args is GetNftMetadataParams => {
      return (
        typeof args === "object" &&
        args !== null &&
        typeof args.contractAddress === "string" &&
        typeof args.tokenId === "string" &&
        (args.tokenType === undefined || typeof args.tokenType === "string") &&
        (args.refreshCache === undefined || typeof args.refreshCache === "boolean")
      );
    };
  • index.ts:444-468 (registration)
    Tool registration in ListTools handler, defining the name, description, and input schema for get_nft_metadata.
    {
      name: "get_nft_metadata",
      description: "Get metadata for a specific NFT",
      inputSchema: {
        type: "object",
        properties: {
          contractAddress: {
            type: "string",
            description: "The contract address of the NFT",
          },
          tokenId: {
            type: "string",
            description: "The token ID of the NFT",
          },
          tokenType: {
            type: "string",
            description: "The token type (ERC721 or ERC1155)",
          },
          refreshCache: {
            type: "boolean",
            description: "Whether to refresh the cache",
          },
        },
        required: ["contractAddress", "tokenId"],
      },
  • index.ts:990-992 (registration)
    Dispatch case in CallToolRequest handler that routes to the get_nft_metadata handler.
    case "get_nft_metadata":
      result = await this.handleGetNftMetadata(request.params.arguments);
      break;
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. It states what the tool does but reveals nothing about behavioral traits: no information on rate limits, authentication requirements, error conditions, response format, or caching behavior (despite a 'refreshCache' parameter). The description is minimal and doesn't compensate for the lack of annotations.

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 a single, clear sentence with zero wasted words. It's front-loaded with the core purpose and appropriately sized for a straightforward tool. Every word earns its place, making it easy to parse quickly without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of NFT metadata retrieval (involving blockchain contracts and tokens) and the absence of both annotations and an output schema, the description is insufficient. It doesn't explain what metadata is returned, potential errors, or how the tool behaves in different scenarios (e.g., invalid addresses). For a tool with four parameters and no structured output documentation, more context is needed.

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 fully documents all four parameters. The description adds no additional meaning beyond what's in the schema—it doesn't explain parameter relationships, provide examples, or clarify semantics like token type implications. With high schema coverage, the baseline score of 3 is appropriate as the description doesn't enhance parameter understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get') and resource ('metadata for a specific NFT'), making the purpose immediately understandable. It distinguishes from siblings like 'get_nfts_for_owner' or 'get_nfts_for_contract' by focusing on individual NFT metadata rather than collections or lists. However, it doesn't explicitly contrast with 'get_token_metadata', which might be a similar sibling tool.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With many sibling tools for NFTs (e.g., get_nfts_for_owner, get_nft_sales, get_owners_for_nft), there's no indication of when this specific metadata retrieval is appropriate versus broader queries. No prerequisites, exclusions, or context for usage are mentioned.

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

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/itsanishjain/alchemy-sdk-mcp'

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