Skip to main content
Glama

fetchNftContractDataByMultichainAddress

Retrieve NFT contract data across multiple blockchain networks using wallet addresses. Specify networks like 'eth-mainnet' or 'base-mainnet' and include metadata as needed.

Input Schema

NameRequiredDescriptionDefault
addressesYesA list of wallet address and network pairs
withMetadataNoWhether to include metadata in the results.

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "addresses": { "description": "A list of wallet address and network pairs", "items": { "additionalProperties": false, "properties": { "address": { "description": "The wallet address to query. e.g. \"0x1234567890123456789012345678901234567890\"", "type": "string" }, "networks": { "default": [ "eth-mainnet" ], "description": "The blockchain networks to query. e.g. [\"eth-mainnet\", \"base-mainnet\"]", "items": { "type": "string" }, "type": "array" } }, "required": [ "address" ], "type": "object" }, "type": "array" }, "withMetadata": { "default": true, "description": "Whether to include metadata in the results.", "type": "boolean" } }, "required": [ "addresses" ], "type": "object" }

Implementation Reference

  • index.ts:287-312 (registration)
    Tool registration with inline Zod input schema and thin async handler function that calls the helper and handles response/error formatting.
    server.tool('fetchNftContractDataByMultichainAddress', { addresses: z.array(z.object({ address: z.string().describe('The wallet address to query. e.g. "0x1234567890123456789012345678901234567890"'), networks: z.array(z.string()).default(['eth-mainnet']).describe('The blockchain networks to query. e.g. ["eth-mainnet", "base-mainnet"]'), })).describe('A list of wallet address and network pairs'), withMetadata: z.boolean().default(true).describe('Whether to include metadata in the results.'), }, async (params) => { try { const result = await alchemyApi.getNftContractsByAddress(params); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; } catch (error) { if (error instanceof Error) { console.error('Error in getNftContractsByAddress:', error); return { content: [{ type: "text", text: `Error: ${error.message}` }], isError: true }; } return { content: [{ type: "text", text: 'Unknown error occurred' }], isError: true }; } });
  • Core handler implementation that creates an NFT API client and performs POST request to '/by-address' endpoint to fetch NFT contract data.
    async getNftContractsByAddress(params: NftContractsByAddressParams) { try { const client = createNftClient(); const response = await client.post('/by-address', { ...params }); return response.data; } catch (error) { console.error('Error fetching NFT contracts by address:', error); throw error; } },
  • Zod schema defining the input parameters for the tool.
    addresses: z.array(z.object({ address: z.string().describe('The wallet address to query. e.g. "0x1234567890123456789012345678901234567890"'), networks: z.array(z.string()).default(['eth-mainnet']).describe('The blockchain networks to query. e.g. ["eth-mainnet", "base-mainnet"]'), })).describe('A list of wallet address and network pairs'), withMetadata: z.boolean().default(true).describe('Whether to include metadata in the results.'),
  • TypeScript interface defining the parameter shape used in the alchemyApi handler.
    export interface NftContractsByAddressParams { addresses: AddressPair[]; withMetadata: boolean; }
  • Supporting type for address-network pairs used in params.
    export interface AddressPair { address: string; networks: string[]; }

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/alchemyplatform/alchemy-mcp-server'

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