get-top-selling-collections
Retrieve top-performing NFT collections on Magic Eden testnet based on sales volume and transactions for specific time periods using Monad NFT Analytics MCP.
Instructions
Retrieve top selling NFT collections on Magic Eden testnet
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| period | Yes | Magic Eden user address on Monad testnet |
Implementation Reference
- src/top-selling-collections.ts:31-70 (handler)The handler function that implements the 'get-top-selling-collections' tool logic: fetches data from Magic Eden API, sorts collections by sales count, and returns formatted text output.async ({ period }) => { const url = `https://api-mainnet.magiceden.dev/v3/rtp/monad-testnet/collections/trending/v1?period=${period}&limit=50&sortBy=sales&normalizeRoyalties=false&useNonFlaggedFloorAsk=false` try { const res = await fetch(url); if (!res.ok) { throw new Error(`MagicEden API error: ${res.status} ${res.statusText}`); } const data = (await res.json()) as { collections: Array<{ name: string; count: number }> }; // Sort by number of sales (count) and build output lines const lines = data.collections .sort((a, b) => b.count - a.count) .map(item => `${item.name}: ${item.count} sales`); const output = lines.join("\n"); return { content: [ { type: "text", text: output, }, ], }; } catch (err) { const msg = err instanceof Error ? err.message : String(err); return { content: [ { type: "text", text: `Failed to fetch trending collections : ${msg}`, }, ], }; } }
- src/top-selling-collections.ts:28-30 (schema)Zod schema for the tool input parameter 'period' (string, though description incorrectly mentions address).{ period: z.string().describe("Magic Eden user address on Monad testnet"), },
- src/top-selling-collections.ts:25-71 (registration)Registration of the 'get-top-selling-collections' tool on the MCP server, including name, description, input schema, and handler reference.server.tool( "get-top-selling-collections", "Retrieve top selling NFT collections on Magic Eden testnet", { period: z.string().describe("Magic Eden user address on Monad testnet"), }, async ({ period }) => { const url = `https://api-mainnet.magiceden.dev/v3/rtp/monad-testnet/collections/trending/v1?period=${period}&limit=50&sortBy=sales&normalizeRoyalties=false&useNonFlaggedFloorAsk=false` try { const res = await fetch(url); if (!res.ok) { throw new Error(`MagicEden API error: ${res.status} ${res.statusText}`); } const data = (await res.json()) as { collections: Array<{ name: string; count: number }> }; // Sort by number of sales (count) and build output lines const lines = data.collections .sort((a, b) => b.count - a.count) .map(item => `${item.name}: ${item.count} sales`); const output = lines.join("\n"); return { content: [ { type: "text", text: output, }, ], }; } catch (err) { const msg = err instanceof Error ? err.message : String(err); return { content: [ { type: "text", text: `Failed to fetch trending collections : ${msg}`, }, ], }; } } );