Skip to main content
Glama
wspotter

MCP Art Supply Store

by wspotter

get_best_sellers

Retrieve top-selling art supplies by category or overall, showing quantity sold and revenue data for specific time periods to identify popular products.

Instructions

Get top-selling products by category or overall, with quantity sold and revenue generated.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryNoOptional: filter by category
periodYesTime period: week, month, quarter, year

Implementation Reference

  • Handler function for 'get_best_sellers' tool. Filters inventory by optional category, sorts by price descending (as proxy for best sellers), returns top 5 with details.
    case 'get_best_sellers': {
      const category = args?.category ? String(args.category) : null;
      const period = String(args?.period || 'week');
      
      let items = storeData.inventory;
      if (category) {
        items = items.filter(i => i.category.toLowerCase() === category.toLowerCase());
      }
      
      const bestSellers = items.sort((a, b) => b.price - a.price).slice(0, 5);
      
      return {
        content: [{
          type: 'text',
          text: `🏆 Best Sellers${category ? ` in ${category}` : ''} (${period}):\n\n${bestSellers.map((item, i) =>
            `${i + 1}. ${item.name}\n   Price: $${item.price} | In stock: ${item.quantity}`
          ).join('\n\n')}`
        }]
      };
    }
  • Input schema definition for the 'get_best_sellers' tool, specifying parameters category (optional) and period (required).
    {
      name: 'get_best_sellers',
      description: 'Get top-selling products by category or overall, with quantity sold and revenue generated.',
      inputSchema: {
        type: 'object',
        properties: {
          category: { type: 'string', description: 'Optional: filter by category' },
          period: { type: 'string', description: 'Time period: week, month, quarter, year' },
        },
        required: ['period'],
      },
    },
  • src/index.ts:516-518 (registration)
    Registration of all tools list handler, which includes 'get_best_sellers' in the tools array.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return { tools };
    });
  • src/dashboard.ts:49-49 (registration)
    Mock tool listing in dashboard server for UI display.
    { name: 'get_best_sellers', description: 'Top selling products', category: 'Sales & Analytics' },

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/wspotter/mcpart'

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