Skip to main content
Glama
googlarz

Vinted MCP and CLI Server

compare_prices

Compare prices for an item across multiple Vinted country sites simultaneously. Use median, mean, min, max, standard deviation to find the cheapest market.

Instructions

Compare prices for a search query across multiple Vinted country sites simultaneously. Returns median, mean, min, max, standard deviation, and sample count per country along with the local currency. Useful for finding the cheapest market to buy a specific item or understanding cross-border price gaps.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesItem to compare prices for, e.g. "Levi 501 jeans" or "iPhone 14 case"
countriesNoList of country codes to compare. Defaults to all 19 Vinted countries if omitted.
limitNoNumber of listings to sample per country. Higher values give more accurate statistics (max 96).

Implementation Reference

  • Main handler function `opCompare` that executes the compare_prices tool logic. It fetches items from multiple Vinted country sites in parallel (with concurrency control), computes price statistics (median, mean, min, max, item count) per country, and returns the best buy/sell countries along with arbitrage spread percentage.
    export async function opCompare(
      client: VintedClient,
      input: { query: string; countries?: Country[]; limit?: number; concurrency?: number },
    ): Promise<CompareResult> {
      if (!input.query?.trim()) throw new Error('query is required');
      const countries = input.countries ?? ['fr', 'de', 'it', 'es', 'nl', 'pl'];
      const limit = input.limit ?? 20;
      const concurrency = Math.max(1, Math.min(input.concurrency ?? 3, 6));
    
      const fetchOne = async (c: Country): Promise<CountryStats | null> => {
        try {
          const items = await searchSlim(client, input.query, c, limit);
          if (!items.length) return null;
          const prices = items.map((i) => i.price);
          return {
            country: c,
            itemCount: items.length,
            currency: items[0].currency,
            avgPrice: round(prices.reduce((a, b) => a + b, 0) / prices.length),
            medianPrice: round(median(prices)),
            minPrice: round(Math.min(...prices)),
            maxPrice: round(Math.max(...prices)),
          } satisfies CountryStats;
        } catch {
          return null;
        }
      };
    
      const results = await runWithConcurrency(countries, concurrency, fetchOne);
      const stats = results.filter((x): x is CountryStats => x !== null);
      if (!stats.length) {
        return { query: input.query, countries: [], bestBuyCountry: null, bestSellCountry: null, arbitrageSpreadPct: 0 };
      }
    
      const byMedian = [...stats].sort((a, b) => a.medianPrice - b.medianPrice);
      const lo = byMedian[0];
      const hi = byMedian[byMedian.length - 1];
      const spread = lo.medianPrice > 0 ? ((hi.medianPrice - lo.medianPrice) / lo.medianPrice) * 100 : 0;
    
      return {
        query: input.query,
        countries: stats,
        bestBuyCountry: lo.country,
        bestSellCountry: hi.country,
        arbitrageSpreadPct: round(spread),
      };
    }
  • Type definitions for `CountryStats` (per-country price statistics with currency) and `CompareResult` (overall result with query, countries stats, best buy/sell countries, and arbitrage spread).
    export interface CountryStats {
      country: Country;
      itemCount: number;
      currency: string;
      avgPrice: number;
      medianPrice: number;
      minPrice: number;
      maxPrice: number;
    }
    
    export interface CompareResult {
      query: string;
      countries: CountryStats[];
      bestBuyCountry: Country | null;
      bestSellCountry: Country | null;
      arbitrageSpreadPct: number;
    }
  • Helper function `median` to compute the median of a numeric array. Also includes `round` (line 78-80) for rounding to 2 decimal places and `runWithConcurrency` (line 82-98) for parallel execution with a concurrency limit.
    function median(xs: number[]): number {
      if (!xs.length) return 0;
      const s = [...xs].sort((a, b) => a - b);
      const m = Math.floor(s.length / 2);
      return s.length % 2 ? s[m] : (s[m - 1] + s[m]) / 2;
    }
  • src/mcp.ts:85-97 (registration)
    MCP tool registration: defines the tool name 'compare_prices', its description, and input JSON schema (query, countries array, limit) in the TOOLS array.
    {
      name: 'compare_prices',
      description: 'Compare prices for a search query across multiple Vinted country sites simultaneously. Returns median, mean, min, max, standard deviation, and sample count per country along with the local currency. Useful for finding the cheapest market to buy a specific item or understanding cross-border price gaps.',
      inputSchema: {
        type: 'object',
        properties: {
          query: { type: 'string', description: 'Item to compare prices for, e.g. "Levi 501 jeans" or "iPhone 14 case"' },
          countries: { type: 'array', items: { type: 'string', enum: COUNTRIES }, description: 'List of country codes to compare. Defaults to all 19 Vinted countries if omitted.' },
          limit: { type: 'integer', default: 20, description: 'Number of listings to sample per country. Higher values give more accurate statistics (max 96).' },
        },
        required: ['query'],
      },
    },
  • Routing: the MCP CallToolRequestSchema handler dispatches 'compare_prices' to call `opCompare(client, args)`.
    case 'compare_prices': result = await opCompare(c, a as any); break;
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Without annotations, the description reveals key behaviors: it returns statistical aggregations per country, samples listings (via limit parameter), and defaults to all countries. It does not mention real-time vs. cached data, but read operations can have such ambiguity.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, no waste. First sentence explains core function, second adds output details and use cases. Efficient and front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema, the description covers return values sufficiently. It explains the sampling behavior and default countries. Lacks details on error handling or rate limits, but for a simple comparison tool, it is complete enough.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so all parameters are described in the schema. The description reinforces the limit and countries default but adds little new meaning beyond the schema. Baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool compares prices across multiple Vinted countries simultaneously. It specifies the verb (compare), resource (prices), and output statistics (median, mean, etc.), distinguishing it from siblings like search_items or get_trending.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides a clear use case: finding the cheapest market or understanding cross-border price gaps. It does not explicitly state when not to use or mention alternative tools, but the context is sufficient for an agent.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/googlarz/vinted-mcp-cli'

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