get_size_groups
Retrieve all Vinted size groups (e.g., Women's clothing, Men's shoes) with their size IDs and labels. Use the size IDs to filter listings to an exact size.
Instructions
Fetch all Vinted size groups with their constituent size IDs and labels. Returns a list of size groups (e.g. "Women's clothing", "Men's shoes", "Kids 2–8 yrs") — each containing the group ID, caption, description, and an array of sizes with numeric IDs and display titles (e.g. "XS", "42", "12 UK"). Pass individual size IDs from the sizes array to search_items.sizeIds or search_all_items.sizeIds to filter listings to an exact size. Results are cached for 1 hour.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| country | No | Vinted country site to query (size catalogues are shared across countries) | fr |
Implementation Reference
- src/ops/get-size-groups.ts:6-11 (handler)The handler function opGetSizeGroups that executes the tool logic. It takes a VintedClient and args (with optional country), defaults country to 'fr', and delegates to the client endpoint function.
export async function opGetSizeGroups( client: VintedClient, args: { country?: Country }, ): Promise<SizeGroup[]> { return getSizeGroups(client, args.country ?? 'fr'); } - src/mcp.ts:169-178 (schema)The tool schema/inputSchema definition for 'get_size_groups', including the JSON schema for the 'country' parameter and the description explaining output (size groups with IDs, captions, descriptions, and size arrays).
{ name: 'get_size_groups', description: 'Fetch all Vinted size groups with their constituent size IDs and labels. Returns a list of size groups (e.g. "Women\'s clothing", "Men\'s shoes", "Kids 2–8 yrs") — each containing the group ID, caption, description, and an array of sizes with numeric IDs and display titles (e.g. "XS", "42", "12 UK"). Pass individual size IDs from the sizes array to search_items.sizeIds or search_all_items.sizeIds to filter listings to an exact size. Results are cached for 1 hour.', inputSchema: { type: 'object', properties: { country: { type: 'string', enum: COUNTRIES, default: 'fr', description: 'Vinted country site to query (size catalogues are shared across countries)' }, }, }, }, - src/mcp.ts:18-19 (registration)Import of opGetSizeGroups from ops/get-size-groups.js.
import { opGetSizeGroups } from './ops/get-size-groups.js'; - src/mcp.ts:237-248 (registration)The switch-case dispatch in the CallToolRequestSchema handler that routes 'get_size_groups' to opGetSizeGroups.
case 'get_size_groups': result = await opGetSizeGroups(c, a as any); break; default: throw new Error(`Unknown tool: ${name}`); } return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; } catch (e) { const msg = e instanceof Error ? e.message : String(e); return { content: [{ type: 'text', text: `Error: ${msg}` }], isError: true }; } }); return server; } - src/client/endpoints.ts:329-344 (helper)The client endpoint function getSizeGroups that makes the actual HTTP API call to /api/v2/size_groups with 1-hour caching (STATIC_TTL_MS), maps the response to SizeGroup objects with id, caption, description, and nested sizes array.
export async function getSizeGroups( client: VintedClient, country: Country = 'fr', ): Promise<SizeGroup[]> { const data = await client.apiGet<{ size_groups?: any[] }>( country, `/api/v2/size_groups`, STATIC_TTL_MS, ); return (data.size_groups ?? []).map((g) => ({ id: Number(g.id), caption: String(g.caption ?? ''), description: String(g.description ?? ''), sizes: (g.sizes ?? []).map((s: any) => ({ id: Number(s.id), title: String(s.title ?? '') })), })); }