Skip to main content
Glama

get_nft_sales

Retrieve NFT sales data for collections or specific tokens using contract addresses, token IDs, and customizable filters like block ranges and marketplaces.

Instructions

Get NFT sales data for a contract or specific NFT

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contractAddressNoThe contract address of the NFT collection
tokenIdNoThe token ID of the specific NFT
fromBlockNoStarting block number for the query
toBlockNoEnding block number for the query
orderNoOrder of results (ascending or descending)
marketplaceNoFilter by marketplace (e.g., 'seaport', 'wyvern')
pageKeyNoKey for pagination
pageSizeNoNumber of results per page

Implementation Reference

  • index.ts:471-512 (registration)
    Registration of the 'get_nft_sales' tool in the tools list, including its description and input schema definition.
    name: "get_nft_sales", description: "Get NFT sales data for a contract or specific NFT", inputSchema: { type: "object", properties: { contractAddress: { type: "string", description: "The contract address of the NFT collection", }, tokenId: { type: "string", description: "The token ID of the specific NFT", }, fromBlock: { type: "number", description: "Starting block number for the query", }, toBlock: { type: "number", description: "Ending block number for the query", }, order: { type: "string", enum: ["asc", "desc"], description: "Order of results (ascending or descending)", }, marketplace: { type: "string", description: "Filter by marketplace (e.g., 'seaport', 'wyvern')", }, pageKey: { type: "string", description: "Key for pagination", }, pageSize: { type: "number", description: "Number of results per page", }, }, }, },
  • TypeScript type definition for GetNftSalesParams, extending Alchemy SDK's GetNftSalesOptions with optional contractAddress and tokenId.
    type GetNftSalesParams = GetNftSalesOptions & { contractAddress?: string; tokenId?: string; };
  • Parameter validation function for get_nft_sales tool inputs, ensuring args conform to GetNftSalesParams.
    const isValidGetNftSalesParams = (args: any): args is GetNftSalesParams => { return ( typeof args === "object" && args !== null && (args.contractAddress === undefined || typeof args.contractAddress === "string") && (args.tokenId === undefined || typeof args.tokenId === "string") && (args.fromBlock === undefined || typeof args.fromBlock === "number") && (args.toBlock === undefined || typeof args.toBlock === "number") && (args.order === undefined || typeof args.order === "string") && (args.marketplace === undefined || typeof args.marketplace === "string") && (args.pageKey === undefined || typeof args.pageKey === "string") && (args.pageSize === undefined || typeof args.pageSize === "number") ); };
  • Import of GetNftSalesOptions type from alchemy-sdk for use in get_nft_sales schema.
    GetNftSalesOptions,

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