get_colors
Retrieve all Vinted color options with IDs, names, and hex codes. Use the IDs to filter search results by specific colors.
Instructions
Fetch the complete list of Vinted color options available as search filters. Returns every color with its numeric ID, display name, hex color code, short code (e.g. "BLACK"), and sort order. Pass the returned IDs to search_items.colorIds or search_all_items.colorIds to restrict results to specific colors. Results are cached for 1 hour — color catalogues change rarely.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| country | No | Vinted country site to query (color catalogues are shared across countries) | fr |
Implementation Reference
- src/mcp.ts:160-168 (registration)Tool registration for 'get_colors' in the TOOLS array with name, description, and inputSchema (only optional 'country' parameter).
name: 'get_colors', description: 'Fetch the complete list of Vinted color options available as search filters. Returns every color with its numeric ID, display name, hex color code, short code (e.g. "BLACK"), and sort order. Pass the returned IDs to search_items.colorIds or search_all_items.colorIds to restrict results to specific colors. Results are cached for 1 hour — color catalogues change rarely.', inputSchema: { type: 'object', properties: { country: { type: 'string', enum: COUNTRIES, default: 'fr', description: 'Vinted country site to query (color catalogues are shared across countries)' }, }, }, }, - src/mcp.ts:236-236 (registration)Switch-case handler in CallToolRequestSchema routing the tool name 'get_colors' to the opGetColors function.
case 'get_colors': result = await opGetColors(c, a as any); break; - src/mcp.ts:17-17 (registration)Import statement importing opGetColors from src/ops/get-colors.js.
import { opGetColors } from './ops/get-colors.js'; - src/ops/get-colors.ts:6-11 (handler)Handler function opGetColors that calls the underlying getColors API endpoint, defaulting country to 'fr'.
export async function opGetColors( client: VintedClient, args: { country?: Country }, ): Promise<ColorHit[]> { return getColors(client, args.country ?? 'fr'); } - src/client/endpoints.ts:295-315 (helper)The ColorHit interface (id, title, hex, code, order) and the getColors client function that calls Vinted's /api/v2/colors API with 1-hour cache TTL and maps results.
export interface ColorHit { id: number; title: string; hex: string; code: string; order: number; } export async function getColors( client: VintedClient, country: Country = 'fr', ): Promise<ColorHit[]> { const data = await client.apiGet<{ colors?: any[] }>(country, `/api/v2/colors`, STATIC_TTL_MS); return (data.colors ?? []).map((c) => ({ id: Number(c.id), title: String(c.title ?? ''), hex: String(c.hex ?? ''), code: String(c.code ?? ''), order: Number(c.order ?? 0), })); }