Skip to main content
Glama

get_nfts_for_contract

Retrieve all NFTs from a specific smart contract address, with options for pagination, metadata inclusion, and token URI resolution.

Instructions

Get all NFTs for a contract

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contractAddressYesThe contract address of the NFT collection
pageKeyNoKey for pagination
pageSizeNoNumber of results per page
tokenUriTimeoutInMsNoTimeout for token URI resolution in milliseconds
withMetadataNoWhether to include metadata

Implementation Reference

  • index.ts:591-620 (registration)
    Registration of the 'get_nfts_for_contract' tool in the ListTools response, defining its name, description, and input schema.
    {
      name: "get_nfts_for_contract",
      description: "Get all NFTs for a contract",
      inputSchema: {
        type: "object",
        properties: {
          contractAddress: {
            type: "string",
            description: "The contract address of the NFT collection",
          },
          pageKey: {
            type: "string",
            description: "Key for pagination",
          },
          pageSize: {
            type: "number",
            description: "Number of results per page",
          },
          tokenUriTimeoutInMs: {
            type: "number",
            description: "Timeout for token URI resolution in milliseconds",
          },
          withMetadata: {
            type: "boolean",
            description: "Whether to include metadata",
          },
        },
        required: ["contractAddress"],
      },
    },
  • TypeScript type definition for the input parameters of the get_nfts_for_contract tool.
    type GetNftsForContractParams = GetBaseNftsForContractOptions & {
      contractAddress: string;
    };
  • Helper function to validate if the provided arguments conform to GetNftsForContractParams type, used in the tool handler.
    const isValidGetNftsForContractParams = (
      args: any
    ): args is GetNftsForContractParams => {
      return (
        typeof args === "object" &&
        args !== null &&
        typeof args.contractAddress === "string" &&
        (args.pageKey === undefined || typeof args.pageKey === "string") &&
        (args.pageSize === undefined || typeof args.pageSize === "number") &&
        (args.tokenUriTimeoutInMs === undefined ||
          typeof args.tokenUriTimeoutInMs === "number") &&
        (args.withMetadata === undefined || typeof args.withMetadata === "boolean")
      );
    };
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action but does not cover critical aspects like whether this is a read-only operation, potential rate limits, authentication needs, or pagination behavior. This is inadequate for a tool with multiple parameters and no output schema.

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, efficient sentence with no wasted words. It is front-loaded with the core purpose, making it easy to parse quickly, which is ideal for conciseness.

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 tool's complexity (5 parameters, no output schema, and no annotations), the description is insufficient. It does not explain return values, error conditions, or behavioral traits, leaving significant gaps for the agent to infer usage in a broader context.

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?

The input schema has 100% description coverage, providing clear details for all 5 parameters. The description adds no additional parameter semantics beyond implying the contractAddress is required, which is already covered in the schema. This meets the baseline for high schema coverage.

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 verb 'Get' and the resource 'all NFTs for a contract', making the purpose immediately understandable. However, it does not differentiate from sibling tools like 'get_nfts_for_owner' or 'get_contracts_for_owner', which involve similar resources but different scopes, so it lacks sibling distinction.

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. It does not mention sibling tools like 'get_nfts_for_owner' for user-specific NFTs or 'get_nft_metadata' for individual NFT details, leaving the agent without context for tool selection.

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