Skip to main content
Glama

fetchNftContractDataByMultichainAddress

Retrieve NFT contract data across multiple blockchain networks using wallet addresses. Query token ownership and metadata from Ethereum, Base, and other supported chains.

Input Schema

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

Implementation Reference

  • Core handler function that executes the tool logic by calling the Alchemy NFT API to fetch NFT contract data for given multichain addresses.
    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; } },
  • index.ts:287-312 (registration)
    MCP tool registration including input schema (zod), thin wrapper handler, and error handling.
    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 }; } });
  • TypeScript interface defining the input parameters for the NFT contracts by address query.
    export interface NftContractsByAddressParams { addresses: AddressPair[]; withMetadata: boolean; }
  • Helper function to create the Axios client configured for Alchemy's NFT API endpoint.
    export const createNftClient = () => axios.create({ baseURL: `https://api.g.alchemy.com/data/v1/${API_KEY}/assets/nfts`, headers: { 'accept': 'application/json', 'content-type': 'application/json', 'x-alchemy-client-breadcrumb': BREADCRUMB_HEADER }, });

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