datalab_shopping_by_age
Analyze Naver Shopping trends by age group, category, and time period to identify purchasing patterns and consumer preferences for targeted insights.
Instructions
Perform a trend analysis on Naver Shopping by age. (네이버 쇼핑 연령별 트렌드 분석)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ages | Yes | Age groups | |
| category | Yes | Category code | |
| endDate | Yes | End date (yyyy-mm-dd) | |
| startDate | Yes | Start date (yyyy-mm-dd) | |
| timeUnit | Yes | Time unit |
Implementation Reference
- src/handlers/datalab.handlers.ts:119-127 (handler)Core handler function that processes the tool arguments and delegates to the NaverSearchClient's datalabShoppingByAge methodexport async function handleShoppingByAgeTrend(params: DatalabShoppingAge) { return client.datalabShoppingByAge({ startDate: params.startDate, endDate: params.endDate, timeUnit: params.timeUnit, category: params.category, ages: params.ages, }); }
- src/schemas/datalab.schemas.ts:47-52 (schema)Zod schema defining the input parameters for the datalab_shopping_by_age tool: category code and array of age groups (10-60) on top of base dates and timeUnitexport const DatalabShoppingAgeSchema = DatalabBaseSchema.extend({ category: z.string().describe("Category code"), ages: z .array(z.enum(["10", "20", "30", "40", "50", "60"])) .describe("Age groups"), });
- src/index.ts:340-359 (registration)MCP server tool registration including name, description, inputSchema (derived from DatalabShoppingAgeSchema), and handler dispatcher to datalabToolHandlersserver.registerTool( "datalab_shopping_by_age", { description: "👶👦👨👴 Analyze shopping trends by age groups (10s, 20s, 30s, 40s, 50s, 60s+). Use find_category first. BUSINESS CASES: Age-targeted products, generational preferences, lifecycle marketing. EXAMPLE: '개발 도구는 어느 연령대가 많이 구매하나?' For current age trends, use get_current_korean_time to set proper analysis period. (연령별 쇼핑 트렌드 - 먼저 find_category 도구로 카테고리 코드를 찾고, 현재 연령 트렌드 분석시 get_current_korean_time으로 적절한 분석 기간 설정)", inputSchema: DatalabShoppingAgeSchema.pick({ startDate: true, endDate: true, timeUnit: true, category: true, ages: true, }).shape, }, async (args) => { const result = await datalabToolHandlers.datalab_shopping_by_age(args); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; } );
- NaverSearchClient method that performs the actual POST request to Naver Datalab API endpoint for shopping trends by ageasync datalabShoppingByAge( params: DatalabShoppingAgeRequest ): Promise<DatalabShoppingResponse> { return this.post(`${this.datalabBaseUrl}/shopping/category/age`, params); }
- src/handlers/datalab.handlers.ts:40-42 (handler)Dispatcher entry in datalabToolHandlers map that logs args and calls the core handleShoppingByAgeTrend functiondatalab_shopping_by_age: (args) => { console.error("datalab_shopping_by_age called with args:", JSON.stringify(args, null, 2)); return handleShoppingByAgeTrend(args);