@isnow890/naver-search-mcp 1.0.14 → 1.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,6 +6,26 @@
6
6
 
7
7
  MCP server for Naver Search API and DataLab API integration, enabling comprehensive search across various Naver services and data trend analysis.
8
8
 
9
+ #### Version History
10
+
11
+ ###### 1.0.2 (2025-04-26)
12
+
13
+ - README updated: cafe article search tool and version history section improved
14
+
15
+ ###### 1.0.1 (2025-04-26)
16
+
17
+ - Cafe article search feature added
18
+ - Shopping category info added to zod
19
+ - Source code refactored
20
+
21
+ ###### 1.0.0 (2025-04-08)
22
+
23
+ - Initial release
24
+
25
+ #### Information
26
+
27
+ **If you want to install the MCP via npm, do NOT use @mseep/server-naver-search (https://www.npmjs.com/package/@mseep/server-naver-search). That package is a copy of my work and was published without my permission. The npx version of that package is also broken and will not work properly. Please use this official package instead.**
28
+
9
29
  #### Prerequisites
10
30
 
11
31
  - Naver Developers API Key (Client ID and Secret)
@@ -30,6 +50,7 @@ MCP server for Naver Search API and DataLab API integration, enabling comprehens
30
50
  - **search_webkr**: Search Naver web documents
31
51
  - **search_news**: Search Naver news
32
52
  - **search_blog**: Search Naver blogs
53
+ - **search_cafearticle**: Search Naver cafe articles
33
54
  - **search_shop**: Search Naver shopping
34
55
  - **search_image**: Search Naver images
35
56
  - **search_kin**: Search Naver KnowledgeiN
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@isnow890/naver-search-mcp",
3
+ "version": "1.0.19",
4
+ "description": "Naver Search MCP Server",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "scripts": {
11
+ "prebuild": "shx rm -rf dist",
12
+ "build": "tsc",
13
+ "prepare": "npm run build",
14
+ "watch": "tsc --watch",
15
+ "start": "node dist/src/index.js",
16
+ "test": "npx cross-env NODE_OPTIONS=--experimental-vm-modules npx jest"
17
+ },
18
+ "engines": {
19
+ "node": ">=18"
20
+ },
21
+ "dependencies": {
22
+ "@modelcontextprotocol/sdk": "1.10.2",
23
+ "axios": "^1.6.7",
24
+ "dotenv": "^16.4.5",
25
+ "sharp": "^0.33.2",
26
+ "zod": "^3.22.4",
27
+ "zod-to-json-schema": "^3.23.5"
28
+ },
29
+ "devDependencies": {
30
+ "@types/jest": "^29.5.14",
31
+ "@types/node": "^22",
32
+ "jest": "^29.7.0",
33
+ "shx": "^0.3.4",
34
+ "ts-jest": "^29.3.2",
35
+ "typescript": "^5.3.3"
36
+ },
37
+ "author": "isnow890",
38
+ "license": "MIT",
39
+ "bin": {
40
+ "naver-search-mcp": "dist/src/index.js"
41
+ },
42
+ "type": "module"
43
+ }
@@ -0,0 +1,30 @@
1
+ import axios from "axios";
2
+ export class NaverApiCoreClient {
3
+ constructor() {
4
+ this.searchBaseUrl = "https://openapi.naver.com/v1/search";
5
+ this.datalabBaseUrl = "https://openapi.naver.com/v1/datalab";
6
+ this.config = null;
7
+ }
8
+ initialize(config) {
9
+ this.config = config;
10
+ }
11
+ getHeaders(contentType = "application/json") {
12
+ if (!this.config)
13
+ throw new Error("NaverApiCoreClient is not initialized.");
14
+ return {
15
+ headers: {
16
+ "X-Naver-Client-Id": this.config.clientId,
17
+ "X-Naver-Client-Secret": this.config.clientSecret,
18
+ "Content-Type": contentType,
19
+ },
20
+ };
21
+ }
22
+ async get(url, params) {
23
+ const response = await axios.get(url, { params, ...this.getHeaders() });
24
+ return response.data;
25
+ }
26
+ async post(url, data) {
27
+ const response = await axios.post(url, data, this.getHeaders());
28
+ return response.data;
29
+ }
30
+ }
@@ -0,0 +1,100 @@
1
+ import { NaverApiCoreClient } from "./naver-api-core.client.js";
2
+ /**
3
+ * NaverSearchClient - 네이버 API 서비스를 위한 싱글톤 클라이언트
4
+ * 검색, 데이터랩 API 요청 처리
5
+ */
6
+ export class NaverSearchClient extends NaverApiCoreClient {
7
+ constructor() {
8
+ super();
9
+ }
10
+ /**
11
+ * 싱글톤 인스턴스 반환
12
+ */
13
+ static getInstance() {
14
+ if (!NaverSearchClient.instance) {
15
+ NaverSearchClient.instance = new NaverSearchClient();
16
+ }
17
+ return NaverSearchClient.instance;
18
+ }
19
+ /**
20
+ * API 자격 증명으로 클라이언트 초기화
21
+ */
22
+ initialize(config) {
23
+ this.config = config;
24
+ }
25
+ /**
26
+ * 네이버 검색 API 호출 (type별로)
27
+ * @param type 검색 타입(카테고리)
28
+ * @param params 검색 파라미터
29
+ */
30
+ async search(type, params) {
31
+ return this.get(`${this.searchBaseUrl}/${type}`, params);
32
+ }
33
+ /**
34
+ * 전문자료 검색 메서드
35
+ */
36
+ async searchAcademic(params) {
37
+ return this.get(`${this.searchBaseUrl}/doc`, params);
38
+ }
39
+ /**
40
+ * 지역 검색 메서드
41
+ */
42
+ async searchLocal(params) {
43
+ return this.get(`${this.searchBaseUrl}/local`, params);
44
+ }
45
+ /**
46
+ * 검색어 트렌드 분석 메서드
47
+ */
48
+ async searchTrend(params) {
49
+ return this.post(`${this.datalabBaseUrl}/search`, params);
50
+ }
51
+ /**
52
+ * 쇼핑 카테고리 트렌드 분석 메서드
53
+ */
54
+ async datalabShoppingCategory(params) {
55
+ return this.post(`${this.datalabBaseUrl}/shopping/categories`, params);
56
+ }
57
+ /**
58
+ * 쇼핑 기기별 트렌드 분석 메서드
59
+ */
60
+ async datalabShoppingByDevice(params) {
61
+ return this.post(`${this.datalabBaseUrl}/shopping/category/device`, params);
62
+ }
63
+ /**
64
+ * 쇼핑 성별 트렌드 분석 메서드
65
+ */
66
+ async datalabShoppingByGender(params) {
67
+ return this.post(`${this.datalabBaseUrl}/shopping/category/gender`, params);
68
+ }
69
+ /**
70
+ * 쇼핑 연령별 트렌드 분석 메서드
71
+ */
72
+ async datalabShoppingByAge(params) {
73
+ return this.post(`${this.datalabBaseUrl}/shopping/category/age`, params);
74
+ }
75
+ /**
76
+ * 쇼핑 키워드 트렌드 분석 메서드
77
+ */
78
+ async datalabShoppingKeywords(params) {
79
+ return this.post(`${this.datalabBaseUrl}/shopping/category/keywords`, params);
80
+ }
81
+ /**
82
+ * 쇼핑 키워드 기기별 트렌드 분석 메서드
83
+ */
84
+ async datalabShoppingKeywordByDevice(params) {
85
+ return this.post(`${this.datalabBaseUrl}/shopping/category/keyword/device`, params);
86
+ }
87
+ /**
88
+ * 쇼핑 키워드 성별 트렌드 분석 메서드
89
+ */
90
+ async datalabShoppingKeywordByGender(params) {
91
+ return this.post(`${this.datalabBaseUrl}/shopping/category/keyword/gender`, params);
92
+ }
93
+ /**
94
+ * 쇼핑 키워드 연령별 트렌드 분석 메서드
95
+ */
96
+ async datalabShoppingKeywordByAge(params) {
97
+ return this.post(`${this.datalabBaseUrl}/shopping/category/keyword/age`, params);
98
+ }
99
+ }
100
+ NaverSearchClient.instance = null;
@@ -1,20 +1,42 @@
1
- import { NaverSearchClient } from "../naver-search.client.js";
2
- // 클라이언트 인스턴스
1
+ import { NaverSearchClient } from "../clients/naver-search.client.js";
2
+ // 클라이언트 인스턴스 (싱글톤)
3
3
  const client = NaverSearchClient.getInstance();
4
+ /**
5
+ * 데이터랩 도구 핸들러 맵
6
+ * 각 도구 이름을 키로, 실행할 핸들러 함수를 값으로 가짐
7
+ * index.ts에서 도구 실행 분기 없이 바로 사용
8
+ */
9
+ export const datalabToolHandlers = {
10
+ datalab_search: (args) => handleSearchTrend(args), // 검색어 트렌드 분석
11
+ datalab_shopping_category: (args) => handleShoppingCategoryTrend(args), // 쇼핑 카테고리별 트렌드
12
+ datalab_shopping_by_device: (args) => handleShoppingByDeviceTrend(args), // 쇼핑 기기별 트렌드
13
+ datalab_shopping_by_gender: (args) => handleShoppingByGenderTrend(args), // 쇼핑 성별 트렌드
14
+ datalab_shopping_by_age: (args) => handleShoppingByAgeTrend(args), // 쇼핑 연령별 트렌드
15
+ datalab_shopping_keywords: (args) => handleShoppingKeywordsTrend(args), // 쇼핑 키워드 그룹 트렌드
16
+ datalab_shopping_keyword_by_device: (args) => handleShoppingKeywordByDeviceTrend(args), // 쇼핑 키워드 기기별 트렌드
17
+ datalab_shopping_keyword_by_gender: (args) => handleShoppingKeywordByGenderTrend(args), // 쇼핑 키워드 성별 트렌드
18
+ datalab_shopping_keyword_by_age: (args) => handleShoppingKeywordByAgeTrend(args), // 쇼핑 키워드 연령별 트렌드
19
+ };
4
20
  /**
5
21
  * 검색어 트렌드 핸들러
22
+ * 네이버 데이터랩 검색어 트렌드 분석 API 호출
23
+ * @param params DatalabSearch
6
24
  */
7
25
  export async function handleSearchTrend(params) {
8
26
  return client.searchTrend(params);
9
27
  }
10
28
  /**
11
29
  * 쇼핑 카테고리 트렌드 핸들러
30
+ * 네이버 데이터랩 쇼핑 카테고리별 트렌드 분석 API 호출
31
+ * @param params DatalabShopping
12
32
  */
13
33
  export async function handleShoppingCategoryTrend(params) {
14
34
  return client.datalabShoppingCategory(params);
15
35
  }
16
36
  /**
17
37
  * 쇼핑 기기별 트렌드 핸들러
38
+ * 네이버 데이터랩 쇼핑 기기별 트렌드 분석 API 호출
39
+ * @param params DatalabShoppingDevice
18
40
  */
19
41
  export async function handleShoppingByDeviceTrend(params) {
20
42
  return client.datalabShoppingByDevice({
@@ -27,6 +49,8 @@ export async function handleShoppingByDeviceTrend(params) {
27
49
  }
28
50
  /**
29
51
  * 쇼핑 성별 트렌드 핸들러
52
+ * 네이버 데이터랩 쇼핑 성별 트렌드 분석 API 호출
53
+ * @param params DatalabShoppingGender
30
54
  */
31
55
  export async function handleShoppingByGenderTrend(params) {
32
56
  return client.datalabShoppingByGender({
@@ -39,6 +63,8 @@ export async function handleShoppingByGenderTrend(params) {
39
63
  }
40
64
  /**
41
65
  * 쇼핑 연령별 트렌드 핸들러
66
+ * 네이버 데이터랩 쇼핑 연령별 트렌드 분석 API 호출
67
+ * @param params DatalabShoppingAge
42
68
  */
43
69
  export async function handleShoppingByAgeTrend(params) {
44
70
  return client.datalabShoppingByAge({
@@ -50,8 +76,9 @@ export async function handleShoppingByAgeTrend(params) {
50
76
  });
51
77
  }
52
78
  /**
53
- * 쇼핑 키워드 트렌드 핸들러
54
- * 복수 키워드 그룹을 지원합니다.
79
+ * 쇼핑 키워드 트렌드 핸들러 (복수 키워드 그룹 지원)
80
+ * 네이버 데이터랩 쇼핑 키워드 그룹 트렌드 분석 API 호출
81
+ * @param params DatalabShoppingKeywords
55
82
  */
56
83
  export async function handleShoppingKeywordsTrend(params) {
57
84
  // 키워드 배열을 네이버 API에 맞는 형식으로 변환
@@ -60,11 +87,13 @@ export async function handleShoppingKeywordsTrend(params) {
60
87
  endDate: params.endDate,
61
88
  timeUnit: params.timeUnit,
62
89
  category: params.category,
63
- keyword: params.keyword
90
+ keyword: params.keyword,
64
91
  });
65
92
  }
66
93
  /**
67
94
  * 쇼핑 키워드 기기별 트렌드 핸들러
95
+ * 네이버 데이터랩 쇼핑 키워드 기기별 트렌드 분석 API 호출
96
+ * @param params DatalabShoppingKeywordDevice
68
97
  */
69
98
  export async function handleShoppingKeywordByDeviceTrend(params) {
70
99
  return client.datalabShoppingKeywordByDevice({
@@ -78,6 +107,8 @@ export async function handleShoppingKeywordByDeviceTrend(params) {
78
107
  }
79
108
  /**
80
109
  * 쇼핑 키워드 성별 트렌드 핸들러
110
+ * 네이버 데이터랩 쇼핑 키워드 성별 트렌드 분석 API 호출
111
+ * @param params DatalabShoppingKeywordGender
81
112
  */
82
113
  export async function handleShoppingKeywordByGenderTrend(params) {
83
114
  return client.datalabShoppingKeywordByGender({
@@ -91,6 +122,8 @@ export async function handleShoppingKeywordByGenderTrend(params) {
91
122
  }
92
123
  /**
93
124
  * 쇼핑 키워드 연령별 트렌드 핸들러
125
+ * 네이버 데이터랩 쇼핑 키워드 연령별 트렌드 분석 API 호출
126
+ * @param params DatalabShoppingKeywordAge
94
127
  */
95
128
  export async function handleShoppingKeywordByAgeTrend(params) {
96
129
  return client.datalabShoppingKeywordByAge({
@@ -1,12 +1,20 @@
1
- import { NaverSearchClient } from "../naver-search.client.js";
1
+ import { NaverSearchClient } from "../clients/naver-search.client.js";
2
+ import { SearchArgsSchema } from "../schemas/search.schemas.js";
2
3
  // 클라이언트 인스턴스
3
4
  const client = NaverSearchClient.getInstance();
4
- /**
5
- * 기본 검색 핸들러
6
- */
7
- export async function handleSearch(params) {
8
- return client.search({ ...params });
9
- }
5
+ export const searchToolHandlers = {
6
+ search_webkr: (args) => handleWebKrSearch(SearchArgsSchema.parse(args)),
7
+ search_news: (args) => handleNewsSearch(SearchArgsSchema.parse(args)),
8
+ search_blog: (args) => handleBlogSearch(SearchArgsSchema.parse(args)),
9
+ search_shop: (args) => handleShopSearch(SearchArgsSchema.parse(args)),
10
+ search_image: (args) => handleImageSearch(SearchArgsSchema.parse(args)),
11
+ search_kin: (args) => handleKinSearch(SearchArgsSchema.parse(args)),
12
+ search_book: (args) => handleBookSearch(SearchArgsSchema.parse(args)),
13
+ search_encyc: (args) => handleEncycSearch(SearchArgsSchema.parse(args)),
14
+ search_academic: (args) => handleAcademicSearch(SearchArgsSchema.parse(args)),
15
+ search_local: (args) => handleLocalSearch(args),
16
+ search_cafearticle: (args) => handleCafeArticleSearch(args),
17
+ };
10
18
  /**
11
19
  * 전문자료 검색 핸들러
12
20
  */
@@ -17,25 +25,25 @@ export async function handleAcademicSearch(params) {
17
25
  * 도서 검색 핸들러
18
26
  */
19
27
  export async function handleBookSearch(params) {
20
- return client.search({ type: "book", ...params });
28
+ return client.search("book", params);
21
29
  }
22
30
  /**
23
31
  * 지식백과 검색 핸들러
24
32
  */
25
33
  export async function handleEncycSearch(params) {
26
- return client.search({ type: "encyc", ...params });
34
+ return client.search("encyc", params);
27
35
  }
28
36
  /**
29
37
  * 이미지 검색 핸들러
30
38
  */
31
39
  export async function handleImageSearch(params) {
32
- return client.search({ type: "image", ...params });
40
+ return client.search("image", params);
33
41
  }
34
42
  /**
35
43
  * 지식iN 검색 핸들러
36
44
  */
37
45
  export async function handleKinSearch(params) {
38
- return client.search({ type: "kin", ...params });
46
+ return client.search("kin", params);
39
47
  }
40
48
  /**
41
49
  * 지역 검색 핸들러
@@ -47,33 +55,27 @@ export async function handleLocalSearch(params) {
47
55
  * 뉴스 검색 핸들러
48
56
  */
49
57
  export async function handleNewsSearch(params) {
50
- return client.search({ type: "news", ...params });
58
+ return client.search("news", params);
51
59
  }
52
60
  /**
53
61
  * 블로그 검색 핸들러
54
62
  */
55
63
  export async function handleBlogSearch(params) {
56
- return client.search({ type: "blog", ...params });
64
+ return client.search("blog", params);
57
65
  }
58
66
  /**
59
67
  * 쇼핑 검색 핸들러
60
68
  */
61
69
  export async function handleShopSearch(params) {
62
- return client.search({ type: "shop", ...params });
63
- }
64
- /**
65
- * 웹문서 검색 핸들러
66
- */
67
- export async function handleWebSearch(params) {
68
- return client.search({ type: "webkr", ...params });
70
+ return client.search("shop", params);
69
71
  }
70
72
  /**
71
73
  * 카페글 검색 핸들러
72
74
  */
73
75
  export async function handleCafeArticleSearch(params) {
74
- return client.search({ type: "cafearticle", ...params });
76
+ return client.search("cafearticle", params);
75
77
  }
76
78
  export async function handleWebKrSearch(args) {
77
79
  const client = NaverSearchClient.getInstance();
78
- return await client.search({ type: "webkr", ...args });
80
+ return await client.search("webkr", args);
79
81
  }
@@ -0,0 +1,144 @@
1
+ import { searchToolHandlers } from "./search.handlers.js";
2
+ import { datalabToolHandlers } from "./datalab.handlers.js";
3
+ import { UnifiedSearchSchema } from "../schemas/unified-search.schemas.js";
4
+ /**
5
+ * 통합 검색 핸들러
6
+ * 일반 검색과 트렌드 검색을 통합하여 처리
7
+ * @param args 통합 검색 파라미터
8
+ * @returns 검색 결과
9
+ */
10
+ export async function handleUnifiedSearch(args) {
11
+ // Zod를 사용하여 입력 파라미터 검증
12
+ const parsedArgs = UnifiedSearchSchema.parse(args);
13
+ // 검색 유형에 따라 처리
14
+ if (parsedArgs.searchType === "general") {
15
+ return handleGeneralSearch(parsedArgs);
16
+ }
17
+ else if (parsedArgs.searchType === "trend") {
18
+ return handleTrendSearch(parsedArgs);
19
+ }
20
+ throw new Error("지원하지 않는 검색 유형입니다.");
21
+ }
22
+ /**
23
+ * 일반 검색 핸들러
24
+ * @param search 일반 검색 파라미터
25
+ * @returns 검색 결과
26
+ */
27
+ async function handleGeneralSearch(search) {
28
+ const { generalType, params } = search;
29
+ // 모든 검색 타입을 통합하여 검색하는 경우
30
+ if (generalType === "all") {
31
+ return handleAllGeneralSearch(params);
32
+ }
33
+ // 단일 검색 유형인 경우
34
+ const handlerKey = `search_${generalType}`;
35
+ const handler = searchToolHandlers[handlerKey];
36
+ if (!handler) {
37
+ throw new Error(`'${generalType}' 유형에 대한 검색 핸들러가 없습니다.`);
38
+ }
39
+ return handler(params);
40
+ }
41
+ /**
42
+ * 모든 일반 검색을 병렬로 수행하는 핸들러
43
+ * @param params 검색 파라미터
44
+ * @returns 모든 검색 결과 (검색 유형별로 객체 키 할당)
45
+ */
46
+ async function handleAllGeneralSearch(params) {
47
+ // 모든 가능한 일반 검색 타입 (local과 다른 타입은 파라미터가 다르므로 주의)
48
+ // 검색할 타입 목록 (local은 파라미터가 다르므로 처리 방식 구분)
49
+ const generalTypes = [
50
+ "webkr", "news", "blog", "shop", "image",
51
+ "kin", "book", "encyc", "academic", "cafearticle"
52
+ ];
53
+ // Promise 배열 생성 및 결과 수집
54
+ const searchPromises = generalTypes.map(type => {
55
+ const handlerKey = `search_${type}`;
56
+ const handler = searchToolHandlers[handlerKey];
57
+ return handler(params)
58
+ .then(result => ({ type, result }))
59
+ .catch(error => ({ type, error: error.message }));
60
+ });
61
+ // local 검색은 파라미터가 다르지만 동일 인터페이스로 처리
62
+ const localHandler = searchToolHandlers["search_local"];
63
+ searchPromises.push(localHandler(params)
64
+ .then(result => ({ type: "local", result }))
65
+ .catch(error => ({ type: "local", error: error.message })));
66
+ // 모든 검색 병렬 실행
67
+ const results = await Promise.all(searchPromises);
68
+ // 결과를 유형별로 객체로 변환
69
+ return results.reduce((acc, item) => {
70
+ const { type } = item;
71
+ if ('result' in item) {
72
+ acc[type] = item.result;
73
+ }
74
+ else if ('error' in item) {
75
+ acc[type] = { error: item.error };
76
+ }
77
+ return acc;
78
+ }, {});
79
+ }
80
+ /**
81
+ * 트렌드 검색 핸들러
82
+ * @param search 트렌드 검색 파라미터
83
+ * @returns 검색 결과
84
+ */
85
+ async function handleTrendSearch(search) {
86
+ const { trendType, params } = search;
87
+ // 모든 트렌드 타입을 통합하여 검색하는 경우
88
+ if (trendType === "all") {
89
+ return handleAllTrendSearch(params);
90
+ }
91
+ // 단일 트렌드 검색 유형인 경우
92
+ const handlerKey = `datalab_${trendType}`;
93
+ const handler = datalabToolHandlers[handlerKey];
94
+ if (!handler) {
95
+ throw new Error(`'${trendType}' 유형에 대한 트렌드 검색 핸들러가 없습니다.`);
96
+ }
97
+ return handler(params);
98
+ }
99
+ /**
100
+ * 모든 트렌드 검색을 병렬로 수행하는 핸들러
101
+ * @param params 트렌드 검색 파라미터
102
+ * @returns 모든 트렌드 검색 결과 (검색 유형별로 객체 키 할당)
103
+ */
104
+ async function handleAllTrendSearch(params) {
105
+ // 파라미터 유형에 따라 가능한 트렌드 검색 타입 결정
106
+ const trendTypes = [
107
+ "search"
108
+ ];
109
+ // 쇼핑 관련 트렌드는 category 파라미터가 있어야 함
110
+ if (params.category) {
111
+ trendTypes.push("shopping_category", "shopping_by_device", "shopping_by_gender", "shopping_by_age", "shopping_keywords");
112
+ // 키워드 관련 트렌드는 keyword 파라미터가 있어야 함
113
+ if (params.keyword) {
114
+ trendTypes.push("shopping_keyword_by_device", "shopping_keyword_by_gender", "shopping_keyword_by_age");
115
+ }
116
+ }
117
+ // Promise 배열 생성 및 결과 수집
118
+ const trendPromises = trendTypes.map(type => {
119
+ const handlerKey = `datalab_${type}`;
120
+ const handler = datalabToolHandlers[handlerKey];
121
+ // 일부 트렌드 검색은 파라미터 형식이 다를 수 있으므로
122
+ // 에러가 발생해도 다른 검색은 계속 진행하도록 처리
123
+ return handler(params)
124
+ .then((result) => ({ type, result }))
125
+ .catch((error) => ({ type, error: error.message }));
126
+ });
127
+ // 모든 트렌드 검색 병렬 실행
128
+ const results = await Promise.all(trendPromises);
129
+ // 결과를 유형별로 객체로 변환
130
+ return results.reduce((acc, item) => {
131
+ const { type } = item;
132
+ if ('result' in item) {
133
+ acc[type] = item.result;
134
+ }
135
+ else if ('error' in item) {
136
+ acc[type] = { error: item.error };
137
+ }
138
+ return acc;
139
+ }, {});
140
+ }
141
+ // 통합 검색 도구 핸들러 맵
142
+ export const unifiedSearchToolHandlers = {
143
+ unified_search: (args) => handleUnifiedSearch(args)
144
+ };