list_watches
Retrieve watches by brand and family with optional date filtering to access comprehensive watch metadata from the WatchBase database.
Instructions
Retrieve a list of watches for a particular Brand and/or Family, optionally filtered by update date.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| brand_id | Yes | BrandID of the brand | |
| family_id | No | Optional: FamilyID of the family | |
| updated_since | No | Optional: Limit results to watches updated after this date (YYYY-MM-DD) |
Implementation Reference
- src/index.ts:213-223 (handler)Handler for the 'list_watches' tool: validates arguments, sets API endpoint to '/watches' and constructs query parameters for brand_id (required), family_id (optional), and updated_since (optional). The actual API call is made after the switch statement.case 'list_watches': if (!isListWatchesArgs(args)) throw new McpError(ErrorCode.InvalidParams, 'Invalid arguments for list_watches'); apiPath = 'watches'; apiParams = { 'brand-id': args.brand_id }; // API uses hyphen if (args.family_id !== undefined) { apiParams['family-id'] = args.family_id; // API uses hyphen } if (args.updated_since !== undefined) { apiParams['updated-since'] = args.updated_since; // API uses hyphen } break;
- src/index.ts:144-163 (schema)Input schema definition for the 'list_watches' tool, defining parameters and validation rules.inputSchema: { type: 'object', properties: { brand_id: { oneOf: [{ type: 'string' }, { type: 'number' }], description: 'BrandID of the brand', }, family_id: { oneOf: [{ type: 'string' }, { type: 'number' }], description: 'Optional: FamilyID of the family', }, updated_since: { type: 'string', format: 'date', // Indicates YYYY-MM-DD format description: 'Optional: Limit results to watches updated after this date (YYYY-MM-DD)', }, }, required: ['brand_id'], },
- src/index.ts:140-164 (registration)Tool registration object for 'list_watches' in the tools list provided to clients via list_tools.{ name: 'list_watches', description: 'Retrieve a list of watches for a particular Brand and/or Family, optionally filtered by update date.', inputSchema: { type: 'object', properties: { brand_id: { oneOf: [{ type: 'string' }, { type: 'number' }], description: 'BrandID of the brand', }, family_id: { oneOf: [{ type: 'string' }, { type: 'number' }], description: 'Optional: FamilyID of the family', }, updated_since: { type: 'string', format: 'date', // Indicates YYYY-MM-DD format description: 'Optional: Limit results to watches updated after this date (YYYY-MM-DD)', }, }, required: ['brand_id'], }, },
- src/index.ts:30-46 (helper)Type guard helper function to validate 'list_watches' tool arguments at runtime, matching the input schema.const isListWatchesArgs = ( args: any ): args is { brand_id: string | number; family_id?: string | number; updated_since?: string; } => typeof args === 'object' && args !== null && (typeof args.brand_id === 'string' || typeof args.brand_id === 'number') && (args.family_id === undefined || typeof args.family_id === 'string' || typeof args.family_id === 'number') && (args.updated_since === undefined || (typeof args.updated_since === 'string' && /^\d{4}-\d{2}-\d{2}$/.test(args.updated_since))); // Basic YYYY-MM-DD check