get_editor_choice
Retrieve curated editor-recommended book lists from Aladin’s API. Filter results by category, set max results, and define search start points for precise selections.
Instructions
알라딘 편집자 추천 리스트를 조회합니다. 카테고리별로 검색할 수 있습니다.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| categoryId | No | 카테고리 ID (CID) - 특정 카테고리로 검색을 제한할 때 사용 | |
| maxResults | No | 최대 결과 개수 | |
| start | No | 검색 시작 번호 |
Implementation Reference
- src/index.ts:547-600 (handler)Handler function that implements the 'get_editor_choice' tool. It calls the Aladin API with QueryType 'ItemEditorChoice' to fetch editor-recommended books, processes the results into a standardized BookSearchResult format, and returns formatted text output.async ({ maxResults, start, categoryId }) => { try { const params: any = { QueryType: 'ItemEditorChoice', MaxResults: maxResults, start: start, SearchTarget: 'Book', Cover: 'Big' }; if (categoryId) { params.CategoryId = categoryId; } const result = await callAladinApi('ItemList.aspx', params); const books: BookSearchResult[] = result.item?.map((item: any) => ({ title: item.title || '', author: item.author || '', publisher: item.publisher || '', pubDate: item.pubDate || '', isbn: item.isbn || '', isbn13: item.isbn13 || '', cover: item.cover || '', categoryName: item.categoryName || '', description: item.description || '', priceStandard: item.priceStandard || 0, priceSales: item.priceSales || 0, link: item.link || '', pages: item.subInfo?.itemPage || undefined, pricePerPage: (item.priceStandard > 0 && item.subInfo?.itemPage > 0) ? parseFloat((item.priceStandard / item.subInfo.itemPage).toFixed(2)) : undefined })) || []; const categoryText = categoryId ? ` (카테고리: ${categoryId})` : ''; return { content: [{ type: 'text', text: `👨💼 편집자 추천 리스트${categoryText}\n\n검색된 도서 수: ${books.length}권\n\n${JSON.stringify(books, null, 2)}` }] }; } catch (error) { logger.error(`편집자 추천 리스트 조회 중 오류 발생: ${error}`); return { content: [{ type: 'text', text: `편집자 추천 리스트 조회 중 오류가 발생했습니다: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } }
- src/index.ts:539-546 (schema)Input schema definition for the 'get_editor_choice' tool using Zod, specifying parameters for maxResults, start, and optional categoryId.title: '편집자 추천 리스트', description: '알라딘 편집자 추천 리스트를 조회합니다. 카테고리별로 검색할 수 있습니다.', inputSchema: { maxResults: z.number().min(1).max(100).default(10).describe('최대 결과 개수'), start: z.number().min(1).default(1).describe('검색 시작 번호'), categoryId: z.string().optional().describe('카테고리 ID (CID) - 특정 카테고리로 검색을 제한할 때 사용') } },
- src/index.ts:537-601 (registration)Registration of the 'get_editor_choice' tool using server.registerTool, including name, schema/spec, and handler function.'get_editor_choice', { title: '편집자 추천 리스트', description: '알라딘 편집자 추천 리스트를 조회합니다. 카테고리별로 검색할 수 있습니다.', inputSchema: { maxResults: z.number().min(1).max(100).default(10).describe('최대 결과 개수'), start: z.number().min(1).default(1).describe('검색 시작 번호'), categoryId: z.string().optional().describe('카테고리 ID (CID) - 특정 카테고리로 검색을 제한할 때 사용') } }, async ({ maxResults, start, categoryId }) => { try { const params: any = { QueryType: 'ItemEditorChoice', MaxResults: maxResults, start: start, SearchTarget: 'Book', Cover: 'Big' }; if (categoryId) { params.CategoryId = categoryId; } const result = await callAladinApi('ItemList.aspx', params); const books: BookSearchResult[] = result.item?.map((item: any) => ({ title: item.title || '', author: item.author || '', publisher: item.publisher || '', pubDate: item.pubDate || '', isbn: item.isbn || '', isbn13: item.isbn13 || '', cover: item.cover || '', categoryName: item.categoryName || '', description: item.description || '', priceStandard: item.priceStandard || 0, priceSales: item.priceSales || 0, link: item.link || '', pages: item.subInfo?.itemPage || undefined, pricePerPage: (item.priceStandard > 0 && item.subInfo?.itemPage > 0) ? parseFloat((item.priceStandard / item.subInfo.itemPage).toFixed(2)) : undefined })) || []; const categoryText = categoryId ? ` (카테고리: ${categoryId})` : ''; return { content: [{ type: 'text', text: `👨💼 편집자 추천 리스트${categoryText}\n\n검색된 도서 수: ${books.length}권\n\n${JSON.stringify(books, null, 2)}` }] }; } catch (error) { logger.error(`편집자 추천 리스트 조회 중 오류 발생: ${error}`); return { content: [{ type: 'text', text: `편집자 추천 리스트 조회 중 오류가 발생했습니다: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } );