get-top-selling-collections
Retrieve top-selling NFT collections on Magic Eden testnet to analyze market trends and identify high-volume performers by specifying a time period.
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 fetches top selling NFT collections from the Magic Eden API for the given period, sorts them by sales count, formats the output, and handles errors by returning text content.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 defining the input parameter 'period' as a string for the tool.{ period: z.string().describe("Magic Eden user address on Monad testnet"), },
- src/top-selling-collections.ts:25-27 (registration)Registers the 'get-top-selling-collections' tool with the MCP server, providing the tool name and description.server.tool( "get-top-selling-collections", "Retrieve top selling NFT collections on Magic Eden testnet",
- src/top-selling-collections.ts:18-22 (registration)Initializes the MCP server instance declaring the 'top-selling-collections' capability.const server = new McpServer({ name: "monad-mcp-magiceden", version: "0.0.2", capabilities: ["top-selling-collections"], });