@decodo/mcp-server 1.0.3 → 1.1.1
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 +93 -34
- package/build/clients/scraper-api-client.js +78 -16
- package/build/clients/scraper-api-client.js.map +1 -1
- package/build/constants.js +35 -1
- package/build/constants.js.map +1 -1
- package/build/index.js +11 -11
- package/build/index.js.map +1 -1
- package/build/server/sapi-base-server.js +76 -0
- package/build/server/sapi-base-server.js.map +1 -0
- package/build/server/sapi-http-server.js +11 -0
- package/build/server/sapi-http-server.js.map +1 -0
- package/build/server/sapi-stdio-server.js +11 -0
- package/build/server/sapi-stdio-server.js.map +1 -0
- package/build/server.js +53 -0
- package/build/server.js.map +1 -0
- package/build/tools/amazon-bestsellers/amazon-bestsellers-tool.js +55 -0
- package/build/tools/amazon-bestsellers/amazon-bestsellers-tool.js.map +1 -0
- package/build/tools/amazon-bestsellers/index.js +18 -0
- package/build/tools/amazon-bestsellers/index.js.map +1 -0
- package/build/tools/amazon-pricing/amazon-pricing-tool.js +67 -0
- package/build/tools/amazon-pricing/amazon-pricing-tool.js.map +1 -0
- package/build/tools/amazon-pricing/index.js +18 -0
- package/build/tools/amazon-pricing/index.js.map +1 -0
- package/build/tools/amazon-product/amazon-product-tool.js +62 -0
- package/build/tools/amazon-product/amazon-product-tool.js.map +1 -0
- package/build/tools/amazon-product/index.js +18 -0
- package/build/tools/amazon-product/index.js.map +1 -0
- package/build/tools/amazon-search/amazon-search-tool.js +63 -0
- package/build/tools/amazon-search/amazon-search-tool.js.map +1 -0
- package/build/tools/amazon-search/index.js +18 -0
- package/build/tools/amazon-search/index.js.map +1 -0
- package/build/tools/amazon-sellers/amazon-sellers-tool.js +56 -0
- package/build/tools/amazon-sellers/amazon-sellers-tool.js.map +1 -0
- package/build/tools/amazon-sellers/index.js +18 -0
- package/build/tools/amazon-sellers/index.js.map +1 -0
- package/build/tools/bing-search/bing-search-tool.js +64 -0
- package/build/tools/bing-search/bing-search-tool.js.map +1 -0
- package/build/tools/bing-search/index.js +18 -0
- package/build/tools/bing-search/index.js.map +1 -0
- package/build/tools/chatgpt/chatgpt-tool.js +47 -0
- package/build/tools/chatgpt/chatgpt-tool.js.map +1 -0
- package/build/tools/chatgpt/index.js +18 -0
- package/build/tools/chatgpt/index.js.map +1 -0
- package/build/tools/google-ads/google-ads-tool.js +59 -0
- package/build/tools/google-ads/google-ads-tool.js.map +1 -0
- package/build/tools/google-ads/index.js +18 -0
- package/build/tools/google-ads/index.js.map +1 -0
- package/build/tools/google-ai-mode/google-ai-mode-tool.js +50 -0
- package/build/tools/google-ai-mode/google-ai-mode-tool.js.map +1 -0
- package/build/tools/google-ai-mode/index.js +18 -0
- package/build/tools/google-ai-mode/index.js.map +1 -0
- package/build/tools/google-lens/google-lens-tool.js +52 -0
- package/build/tools/google-lens/google-lens-tool.js.map +1 -0
- package/build/tools/google-lens/index.js +18 -0
- package/build/tools/google-lens/index.js.map +1 -0
- package/build/tools/google-search/google-search-tool.js +60 -0
- package/build/tools/google-search/google-search-tool.js.map +1 -0
- package/build/tools/google-search/index.js +18 -0
- package/build/tools/google-search/index.js.map +1 -0
- package/build/tools/google-travel-hotels/google-travel-hotels-tool.js +52 -0
- package/build/tools/google-travel-hotels/google-travel-hotels-tool.js.map +1 -0
- package/build/tools/google-travel-hotels/index.js +18 -0
- package/build/tools/google-travel-hotels/index.js.map +1 -0
- package/build/tools/index.js +30 -5
- package/build/tools/index.js.map +1 -1
- package/build/tools/perplexity/index.js +18 -0
- package/build/tools/perplexity/index.js.map +1 -0
- package/build/tools/perplexity/perplexity-tool.js +46 -0
- package/build/tools/perplexity/perplexity-tool.js.map +1 -0
- package/build/tools/reddit-post/index.js +18 -0
- package/build/tools/reddit-post/index.js.map +1 -0
- package/build/tools/reddit-post/reddit-post-tool.js +51 -0
- package/build/tools/reddit-post/reddit-post-tool.js.map +1 -0
- package/build/tools/reddit-subreddit/index.js +18 -0
- package/build/tools/reddit-subreddit/index.js.map +1 -0
- package/build/tools/reddit-subreddit/reddit-subreddit-tool.js +49 -0
- package/build/tools/reddit-subreddit/reddit-subreddit-tool.js.map +1 -0
- package/build/tools/reddit-user/index.js +18 -0
- package/build/tools/reddit-user/index.js.map +1 -0
- package/build/tools/reddit-user/reddit-user-tool.js +55 -0
- package/build/tools/reddit-user/reddit-user-tool.js.map +1 -0
- package/build/tools/scrape-as-markdown/index.js +18 -0
- package/build/tools/scrape-as-markdown/index.js.map +1 -0
- package/build/tools/scrape-as-markdown/scrape-as-markdown-tool.js +79 -0
- package/build/tools/scrape-as-markdown/scrape-as-markdown-tool.js.map +1 -0
- package/build/tools/screenshot/index.js +18 -0
- package/build/tools/screenshot/index.js.map +1 -0
- package/build/tools/screenshot/screenshot-tool.js +48 -0
- package/build/tools/screenshot/screenshot-tool.js.map +1 -0
- package/build/tools/target-product/index.js +18 -0
- package/build/tools/target-product/index.js.map +1 -0
- package/build/tools/target-product/target-product-tool.js +50 -0
- package/build/tools/target-product/target-product-tool.js.map +1 -0
- package/build/tools/target-search/index.js +18 -0
- package/build/tools/target-search/index.js.map +1 -0
- package/build/tools/target-search/target-search-tool.js +56 -0
- package/build/tools/target-search/target-search-tool.js.map +1 -0
- package/build/tools/tiktok-post/index.js +18 -0
- package/build/tools/tiktok-post/index.js.map +1 -0
- package/build/tools/tiktok-post/tiktok-post-tool.js +48 -0
- package/build/tools/tiktok-post/tiktok-post-tool.js.map +1 -0
- package/build/tools/tiktok-shop-product/index.js +18 -0
- package/build/tools/tiktok-shop-product/index.js.map +1 -0
- package/build/tools/tiktok-shop-product/tiktok-shop-product-tool.js +47 -0
- package/build/tools/tiktok-shop-product/tiktok-shop-product-tool.js.map +1 -0
- package/build/tools/tiktok-shop-search/index.js +18 -0
- package/build/tools/tiktok-shop-search/index.js.map +1 -0
- package/build/tools/tiktok-shop-search/tiktok-shop-search-tool.js +54 -0
- package/build/tools/tiktok-shop-search/tiktok-shop-search-tool.js.map +1 -0
- package/build/tools/tiktok-shop-url/index.js +18 -0
- package/build/tools/tiktok-shop-url/index.js.map +1 -0
- package/build/tools/tiktok-shop-url/tiktok-shop-url-tool.js +45 -0
- package/build/tools/tiktok-shop-url/tiktok-shop-url-tool.js.map +1 -0
- package/build/tools/tool.js +7 -0
- package/build/tools/tool.js.map +1 -0
- package/build/tools/walmart-product/index.js +18 -0
- package/build/tools/walmart-product/index.js.map +1 -0
- package/build/tools/walmart-product/walmart-product-tool.js +61 -0
- package/build/tools/walmart-product/walmart-product-tool.js.map +1 -0
- package/build/tools/walmart-search/index.js +18 -0
- package/build/tools/walmart-search/index.js.map +1 -0
- package/build/tools/walmart-search/walmart-search-tool.js +62 -0
- package/build/tools/walmart-search/walmart-search-tool.js.map +1 -0
- package/build/tools/youtube-channel/index.js +18 -0
- package/build/tools/youtube-channel/index.js.map +1 -0
- package/build/tools/youtube-channel/youtube-channel-tool.js +48 -0
- package/build/tools/youtube-channel/youtube-channel-tool.js.map +1 -0
- package/build/tools/youtube-metadata/index.js +18 -0
- package/build/tools/youtube-metadata/index.js.map +1 -0
- package/build/tools/youtube-metadata/youtube-metadata-tool.js +43 -0
- package/build/tools/youtube-metadata/youtube-metadata-tool.js.map +1 -0
- package/build/tools/youtube-search/index.js +18 -0
- package/build/tools/youtube-search/index.js.map +1 -0
- package/build/tools/youtube-search/youtube-search-tool.js +43 -0
- package/build/tools/youtube-search/youtube-search-tool.js.map +1 -0
- package/build/tools/youtube-subtitles/index.js +18 -0
- package/build/tools/youtube-subtitles/index.js.map +1 -0
- package/build/tools/youtube-subtitles/youtube-subtitles-tool.js +48 -0
- package/build/tools/youtube-subtitles/youtube-subtitles-tool.js.map +1 -0
- package/build/utils.js +14 -3
- package/build/utils.js.map +1 -1
- package/build/zod/zod-types.js +12 -4
- package/build/zod/zod-types.js.map +1 -1
- package/package.json +37 -12
- package/build/sapi-mcp-server.js +0 -40
- package/build/sapi-mcp-server.js.map +0 -1
- package/build/tools/amazon-search-parsed-tool.js +0 -46
- package/build/tools/amazon-search-parsed-tool.js.map +0 -1
- package/build/tools/google-search-parsed-tool.js +0 -54
- package/build/tools/google-search-parsed-tool.js.map +0 -1
- package/build/tools/reddit-post-tool.js +0 -34
- package/build/tools/reddit-post-tool.js.map +0 -1
- package/build/tools/reddit-subreddit-tool.js +0 -34
- package/build/tools/reddit-subreddit-tool.js.map +0 -1
- package/build/tools/scrape-as-markdown-tool.js +0 -70
- package/build/tools/scrape-as-markdown-tool.js.map +0 -1
- package/build/tools/scrape-tool.js +0 -70
- package/build/tools/scrape-tool.js.map +0 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./reddit-subreddit-tool"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/reddit-subreddit/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.RedditSubredditTool = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
const constants_1 = require("../../constants");
|
|
9
|
+
const utils_1 = require("../../utils");
|
|
10
|
+
const tool_1 = require("../tool");
|
|
11
|
+
class RedditSubredditTool extends tool_1.Tool {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.toolset = constants_1.TOOLSET.SOCIAL_MEDIA;
|
|
15
|
+
this.transformResponse = ({ data }) => {
|
|
16
|
+
for (const fieldToRemove of RedditSubredditTool.FIELDS_WITH_HIGH_CHAR_COUNT) {
|
|
17
|
+
data = (0, utils_1.removeKeyFromNestedObject)({ obj: data, keyToRemove: fieldToRemove });
|
|
18
|
+
}
|
|
19
|
+
return { data: JSON.stringify(data) };
|
|
20
|
+
};
|
|
21
|
+
this.register = ({ server, sapiClient, auth }) => {
|
|
22
|
+
server.registerTool('reddit_subreddit', {
|
|
23
|
+
description: 'Scrape Reddit subreddit results with automatic parsing',
|
|
24
|
+
inputSchema: {
|
|
25
|
+
url: zod_1.default.string().describe('URL to subreddit'),
|
|
26
|
+
},
|
|
27
|
+
annotations: {
|
|
28
|
+
readOnlyHint: true,
|
|
29
|
+
openWorldHint: true,
|
|
30
|
+
},
|
|
31
|
+
}, async (scrapingParams) => {
|
|
32
|
+
const params = Object.assign(Object.assign({}, scrapingParams), { target: constants_1.SCRAPER_API_TARGETS.REDDIT_SUBREDDIT });
|
|
33
|
+
const { data } = await sapiClient.scrape({ auth, scrapingParams: params });
|
|
34
|
+
const { data: text } = this.transformResponse({ data });
|
|
35
|
+
return {
|
|
36
|
+
content: [
|
|
37
|
+
{
|
|
38
|
+
type: 'text',
|
|
39
|
+
text,
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.RedditSubredditTool = RedditSubredditTool;
|
|
48
|
+
RedditSubredditTool.FIELDS_WITH_HIGH_CHAR_COUNT = ['preview', 'media_metadata'];
|
|
49
|
+
//# sourceMappingURL=reddit-subreddit-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reddit-subreddit-tool.js","sourceRoot":"","sources":["../../../src/tools/reddit-subreddit/reddit-subreddit-tool.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAoB;AAEpB,+CAA+D;AAC/D,uCAAwD;AACxD,kCAAqD;AAErD,MAAa,mBAAoB,SAAQ,WAAI;IAA7C;;QACE,YAAO,GAAG,mBAAO,CAAC,YAAY,CAAC;QAI/B,sBAAiB,GAAG,CAAC,EAAE,IAAI,EAAoB,EAAE,EAAE;YACjD,KAAK,MAAM,aAAa,IAAI,mBAAmB,CAAC,2BAA2B,EAAE,CAAC;gBAC5E,IAAI,GAAG,IAAA,iCAAyB,EAAC,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC,CAAC;YAC9E,CAAC;YAED,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,CAAC,CAAC;QAEF,aAAQ,GAAG,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAwB,EAAE,EAAE;YAChE,MAAM,CAAC,YAAY,CACjB,kBAAkB,EAClB;gBACE,WAAW,EAAE,wDAAwD;gBACrE,WAAW,EAAE;oBACX,GAAG,EAAE,aAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC;iBAC7C;gBACD,WAAW,EAAE;oBACX,YAAY,EAAE,IAAI;oBAClB,aAAa,EAAE,IAAI;iBACpB;aACF,EACD,KAAK,EAAE,cAAiC,EAAE,EAAE;gBAC1C,MAAM,MAAM,GAAG,gCACV,cAAc,KACjB,MAAM,EAAE,+BAAmB,CAAC,gBAAgB,GAClB,CAAC;gBAE7B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,UAAU,CAAC,MAAM,CAAS,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC,CAAC;gBAEnF,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,iBAAiB,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;gBAExD,OAAO;oBACL,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,MAAM;4BACZ,IAAI;yBACL;qBACF;iBACF,CAAC;YACJ,CAAC,CACF,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;;AA/CD,kDA+CC;AA5CgB,+CAA2B,GAAG,CAAC,SAAS,EAAE,gBAAgB,CAAC,AAAhC,CAAiC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./reddit-user-tool"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/reddit-user/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.RedditUserTool = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
const constants_1 = require("../../constants");
|
|
9
|
+
const utils_1 = require("../../utils");
|
|
10
|
+
const tool_1 = require("../tool");
|
|
11
|
+
class RedditUserTool extends tool_1.Tool {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.toolset = constants_1.TOOLSET.SOCIAL_MEDIA;
|
|
15
|
+
this.transformResponse = ({ data }) => {
|
|
16
|
+
for (const fieldToRemove of RedditUserTool.FIELDS_WITH_HIGH_CHAR_COUNT) {
|
|
17
|
+
data = (0, utils_1.removeKeyFromNestedObject)({ obj: data, keyToRemove: fieldToRemove });
|
|
18
|
+
}
|
|
19
|
+
return { data: JSON.stringify(data) };
|
|
20
|
+
};
|
|
21
|
+
this.register = ({ server, sapiClient, auth }) => {
|
|
22
|
+
server.registerTool('reddit_user', {
|
|
23
|
+
description: 'Scrape a Reddit user profile and their posts/comments',
|
|
24
|
+
inputSchema: {
|
|
25
|
+
url: zod_1.default
|
|
26
|
+
.string()
|
|
27
|
+
.describe('Reddit user profile URL (eg. https://www.reddit.com/user/IWasRightOnce/)'),
|
|
28
|
+
},
|
|
29
|
+
annotations: {
|
|
30
|
+
readOnlyHint: true,
|
|
31
|
+
openWorldHint: true,
|
|
32
|
+
},
|
|
33
|
+
}, async (scrapingParams) => {
|
|
34
|
+
const params = Object.assign(Object.assign({}, scrapingParams), { target: constants_1.SCRAPER_API_TARGETS.REDDIT_USER });
|
|
35
|
+
const { data } = await sapiClient.scrape({ auth, scrapingParams: params });
|
|
36
|
+
const { data: text } = this.transformResponse({ data });
|
|
37
|
+
return {
|
|
38
|
+
content: [
|
|
39
|
+
{
|
|
40
|
+
type: 'text',
|
|
41
|
+
text,
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.RedditUserTool = RedditUserTool;
|
|
50
|
+
RedditUserTool.FIELDS_WITH_HIGH_CHAR_COUNT = [
|
|
51
|
+
'author_flair_richtext',
|
|
52
|
+
'preview',
|
|
53
|
+
'media_metadata',
|
|
54
|
+
];
|
|
55
|
+
//# sourceMappingURL=reddit-user-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reddit-user-tool.js","sourceRoot":"","sources":["../../../src/tools/reddit-user/reddit-user-tool.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAoB;AAEpB,+CAA+D;AAC/D,uCAAwD;AACxD,kCAAqD;AAErD,MAAa,cAAe,SAAQ,WAAI;IAAxC;;QACE,YAAO,GAAG,mBAAO,CAAC,YAAY,CAAC;QAQ/B,sBAAiB,GAAG,CAAC,EAAE,IAAI,EAAoB,EAAE,EAAE;YACjD,KAAK,MAAM,aAAa,IAAI,cAAc,CAAC,2BAA2B,EAAE,CAAC;gBACvE,IAAI,GAAG,IAAA,iCAAyB,EAAC,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC,CAAC;YAC9E,CAAC;YAED,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,CAAC,CAAC;QAEF,aAAQ,GAAG,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAwB,EAAE,EAAE;YAChE,MAAM,CAAC,YAAY,CACjB,aAAa,EACb;gBACE,WAAW,EAAE,uDAAuD;gBACpE,WAAW,EAAE;oBACX,GAAG,EAAE,aAAC;yBACH,MAAM,EAAE;yBACR,QAAQ,CAAC,0EAA0E,CAAC;iBACxF;gBACD,WAAW,EAAE;oBACX,YAAY,EAAE,IAAI;oBAClB,aAAa,EAAE,IAAI;iBACpB;aACF,EACD,KAAK,EAAE,cAAiC,EAAE,EAAE;gBAC1C,MAAM,MAAM,GAAG,gCACV,cAAc,KACjB,MAAM,EAAE,+BAAmB,CAAC,WAAW,GACb,CAAC;gBAE7B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,UAAU,CAAC,MAAM,CAAS,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC,CAAC;gBAEnF,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,iBAAiB,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;gBAExD,OAAO;oBACL,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,MAAM;4BACZ,IAAI;yBACL;qBACF;iBACF,CAAC;YACJ,CAAC,CACF,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;;AArDD,wCAqDC;AAlDgB,0CAA2B,GAAG;IAC3C,uBAAuB;IACvB,SAAS;IACT,gBAAgB;CACjB,AAJyC,CAIxC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./scrape-as-markdown-tool"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/scrape-as-markdown/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ScrapeAsMarkdownTool = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
const node_html_markdown_1 = require("node-html-markdown");
|
|
9
|
+
const zod_types_1 = require("../../zod/zod-types");
|
|
10
|
+
const constants_1 = require("../../constants");
|
|
11
|
+
const tool_1 = require("../tool");
|
|
12
|
+
class ScrapeAsMarkdownTool extends tool_1.Tool {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.toolset = constants_1.TOOLSET.WEB;
|
|
16
|
+
this.isResponseOverLimit = (content) => {
|
|
17
|
+
return content.length > ScrapeAsMarkdownTool.LARGE_CONTENT_SYMBOL_COUNT;
|
|
18
|
+
};
|
|
19
|
+
this.truncateResponse = ({ content, limit }) => {
|
|
20
|
+
return content.substring(0, limit);
|
|
21
|
+
};
|
|
22
|
+
this.transformResponse = ({ data, tokenLimit }) => {
|
|
23
|
+
let markdown;
|
|
24
|
+
try {
|
|
25
|
+
markdown = node_html_markdown_1.NodeHtmlMarkdown.translate(data, {});
|
|
26
|
+
}
|
|
27
|
+
catch (_a) {
|
|
28
|
+
markdown = data;
|
|
29
|
+
}
|
|
30
|
+
if (tokenLimit || this.isResponseOverLimit(markdown)) {
|
|
31
|
+
const truncated = this.truncateResponse({
|
|
32
|
+
content: markdown,
|
|
33
|
+
limit: tokenLimit || ScrapeAsMarkdownTool.LARGE_CONTENT_SYMBOL_COUNT,
|
|
34
|
+
});
|
|
35
|
+
return { data: truncated, isTruncated: true };
|
|
36
|
+
}
|
|
37
|
+
return { data: markdown, isTruncated: false };
|
|
38
|
+
};
|
|
39
|
+
this.register = ({ server, sapiClient, auth }) => {
|
|
40
|
+
server.registerTool('scrape_as_markdown', {
|
|
41
|
+
description: 'Scrape the contents of a website and return Markdown-formatted results',
|
|
42
|
+
inputSchema: {
|
|
43
|
+
url: zod_1.default.string().describe('URL to scrape'),
|
|
44
|
+
geo: zod_types_1.zodGeo,
|
|
45
|
+
locale: zod_types_1.zodLocale,
|
|
46
|
+
jsRender: zod_types_1.zodJsRender,
|
|
47
|
+
tokenLimit: zod_types_1.zodTokenLimit,
|
|
48
|
+
},
|
|
49
|
+
annotations: {
|
|
50
|
+
readOnlyHint: true,
|
|
51
|
+
openWorldHint: true,
|
|
52
|
+
},
|
|
53
|
+
}, async (scrapingParams) => {
|
|
54
|
+
const { data } = await sapiClient.scrape({ auth, scrapingParams });
|
|
55
|
+
const { data: markdown, isTruncated } = this.transformResponse({
|
|
56
|
+
data,
|
|
57
|
+
tokenLimit: scrapingParams.tokenLimit,
|
|
58
|
+
});
|
|
59
|
+
return {
|
|
60
|
+
content: [
|
|
61
|
+
{
|
|
62
|
+
type: 'text',
|
|
63
|
+
text: isTruncated
|
|
64
|
+
? `The website content is over ${ScrapeAsMarkdownTool.LARGE_CONTENT_SYMBOL_COUNT} symbols, therefore, the content has been truncated. If you wish to obtain the full response, just say "full response". Alternatively, you say a specific token limit in the prompt.`
|
|
65
|
+
: 'Full website content retrieved.',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
type: 'text',
|
|
69
|
+
text: markdown,
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
};
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.ScrapeAsMarkdownTool = ScrapeAsMarkdownTool;
|
|
78
|
+
ScrapeAsMarkdownTool.LARGE_CONTENT_SYMBOL_COUNT = 100000;
|
|
79
|
+
//# sourceMappingURL=scrape-as-markdown-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scrape-as-markdown-tool.js","sourceRoot":"","sources":["../../../src/tools/scrape-as-markdown/scrape-as-markdown-tool.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAoB;AAEpB,2DAAsD;AACtD,mDAAoF;AACpF,+CAA0C;AAC1C,kCAAqD;AAErD,MAAa,oBAAqB,SAAQ,WAAI;IAA9C;;QACE,YAAO,GAAG,mBAAO,CAAC,GAAG,CAAC;QAItB,wBAAmB,GAAG,CAAC,OAAe,EAAE,EAAE;YACxC,OAAO,OAAO,CAAC,MAAM,GAAG,oBAAoB,CAAC,0BAA0B,CAAC;QAC1E,CAAC,CAAC;QAEF,qBAAgB,GAAG,CAAC,EAAE,OAAO,EAAE,KAAK,EAAsC,EAAE,EAAE;YAC5E,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;QACrC,CAAC,CAAC;QAEF,sBAAiB,GAAG,CAAC,EAAE,IAAI,EAAE,UAAU,EAAyC,EAAE,EAAE;YAClF,IAAI,QAAgB,CAAC;YAErB,IAAI,CAAC;gBACH,QAAQ,GAAG,qCAAgB,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAClD,CAAC;YAAC,WAAM,CAAC;gBACP,QAAQ,GAAG,IAAI,CAAC;YAClB,CAAC;YAED,IAAI,UAAU,IAAI,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACrD,MAAM,SAAS,GAAG,IAAI,CAAC,gBAAgB,CAAC;oBACtC,OAAO,EAAE,QAAQ;oBACjB,KAAK,EAAE,UAAU,IAAI,oBAAoB,CAAC,0BAA0B;iBACrE,CAAC,CAAC;gBAEH,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;YAChD,CAAC;YAED,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;QAChD,CAAC,CAAC;QAEF,aAAQ,GAAG,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAwB,EAAE,EAAE;YAChE,MAAM,CAAC,YAAY,CACjB,oBAAoB,EACpB;gBACE,WAAW,EAAE,wEAAwE;gBACrF,WAAW,EAAE;oBACX,GAAG,EAAE,aAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC;oBACzC,GAAG,EAAE,kBAAM;oBACX,MAAM,EAAE,qBAAS;oBACjB,QAAQ,EAAE,uBAAW;oBACrB,UAAU,EAAE,yBAAa;iBAC1B;gBACD,WAAW,EAAE;oBACX,YAAY,EAAE,IAAI;oBAClB,aAAa,EAAE,IAAI;iBACpB;aACF,EACD,KAAK,EAAE,cAAiC,EAAE,EAAE;gBAC1C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;gBAEnE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,iBAAiB,CAAC;oBAC7D,IAAI;oBACJ,UAAU,EAAE,cAAc,CAAC,UAAU;iBACtC,CAAC,CAAC;gBAEH,OAAO;oBACL,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,MAAM;4BACZ,IAAI,EAAE,WAAW;gCACf,CAAC,CAAC,+BAA+B,oBAAoB,CAAC,0BAA0B,sLAAsL;gCACtQ,CAAC,CAAC,iCAAiC;yBACtC;wBACD;4BACE,IAAI,EAAE,MAAM;4BACZ,IAAI,EAAE,QAAQ;yBACf;qBACF;iBACF,CAAC;YACJ,CAAC,CACF,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;;AA5ED,oDA4EC;AAzEgB,+CAA0B,GAAG,MAAO,AAAV,CAAW"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./screenshot-tool"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/screenshot/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ScreenshotTool = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
const zod_types_1 = require("../../zod/zod-types");
|
|
9
|
+
const constants_1 = require("../../constants");
|
|
10
|
+
const tool_1 = require("../tool");
|
|
11
|
+
class ScreenshotTool extends tool_1.Tool {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.toolset = constants_1.TOOLSET.WEB;
|
|
15
|
+
this.transformResponse = ({ data }) => {
|
|
16
|
+
return { data };
|
|
17
|
+
};
|
|
18
|
+
this.register = ({ server, sapiClient, auth }) => {
|
|
19
|
+
server.registerTool('screenshot', {
|
|
20
|
+
description: 'Capture a screenshot of any webpage and return it as a PNG image',
|
|
21
|
+
inputSchema: {
|
|
22
|
+
url: zod_1.default.string().describe('URL to screenshot'),
|
|
23
|
+
geo: zod_types_1.zodGeo,
|
|
24
|
+
},
|
|
25
|
+
annotations: {
|
|
26
|
+
readOnlyHint: true,
|
|
27
|
+
openWorldHint: true,
|
|
28
|
+
},
|
|
29
|
+
}, async (scrapingParams) => {
|
|
30
|
+
const { data } = await sapiClient.scrape({
|
|
31
|
+
auth,
|
|
32
|
+
scrapingParams: Object.assign(Object.assign({}, scrapingParams), { headless: 'png' }),
|
|
33
|
+
});
|
|
34
|
+
return {
|
|
35
|
+
content: [
|
|
36
|
+
{
|
|
37
|
+
type: 'image',
|
|
38
|
+
data: data,
|
|
39
|
+
mimeType: 'image/png',
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.ScreenshotTool = ScreenshotTool;
|
|
48
|
+
//# sourceMappingURL=screenshot-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screenshot-tool.js","sourceRoot":"","sources":["../../../src/tools/screenshot/screenshot-tool.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAoB;AAEpB,mDAA6C;AAC7C,+CAA0C;AAC1C,kCAAqD;AAErD,MAAa,cAAe,SAAQ,WAAI;IAAxC;;QACE,YAAO,GAAG,mBAAO,CAAC,GAAG,CAAC;QAEtB,sBAAiB,GAAG,CAAC,EAAE,IAAI,EAAoB,EAAE,EAAE;YACjD,OAAO,EAAE,IAAI,EAAE,CAAC;QAClB,CAAC,CAAC;QAEF,aAAQ,GAAG,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAwB,EAAE,EAAE;YAChE,MAAM,CAAC,YAAY,CACjB,YAAY,EACZ;gBACE,WAAW,EAAE,kEAAkE;gBAC/E,WAAW,EAAE;oBACX,GAAG,EAAE,aAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mBAAmB,CAAC;oBAC7C,GAAG,EAAE,kBAAM;iBACZ;gBACD,WAAW,EAAE;oBACX,YAAY,EAAE,IAAI;oBAClB,aAAa,EAAE,IAAI;iBACpB;aACF,EACD,KAAK,EAAE,cAAiC,EAAE,EAAE;gBAC1C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC;oBACvC,IAAI;oBACJ,cAAc,kCAAO,cAAc,KAAE,QAAQ,EAAE,KAAK,GAAE;iBACvD,CAAC,CAAC;gBAEH,OAAO;oBACL,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,OAAgB;4BACtB,IAAI,EAAE,IAAc;4BACpB,QAAQ,EAAE,WAAW;yBACtB;qBACF;iBACF,CAAC;YACJ,CAAC,CACF,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CAAA;AAvCD,wCAuCC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./target-product-tool"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/target-product/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TargetProductTool = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
const constants_1 = require("../../constants");
|
|
9
|
+
const zod_types_1 = require("../../zod/zod-types");
|
|
10
|
+
const tool_1 = require("../tool");
|
|
11
|
+
const zodDeliveryZip = zod_1.default.string().describe('ZIP code for delivery location').optional();
|
|
12
|
+
const zodStoreId = zod_1.default.string().describe('Target store ID for local inventory').optional();
|
|
13
|
+
class TargetProductTool extends tool_1.Tool {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.toolset = constants_1.TOOLSET.ECOMMERCE;
|
|
17
|
+
this.transformResponse = ({ data }) => {
|
|
18
|
+
return { data: JSON.stringify(data) };
|
|
19
|
+
};
|
|
20
|
+
this.register = ({ server, sapiClient, auth }) => {
|
|
21
|
+
server.registerTool('target_product', {
|
|
22
|
+
description: 'Scrape Target Product page with automatic parsing',
|
|
23
|
+
inputSchema: {
|
|
24
|
+
product_id: zod_1.default.string().describe('Target product ID (e.g., "1003921355")'),
|
|
25
|
+
jsRender: zod_types_1.zodJsRender,
|
|
26
|
+
deviceType: zod_types_1.zodDeviceType,
|
|
27
|
+
deliveryZip: zodDeliveryZip,
|
|
28
|
+
storeId: zodStoreId,
|
|
29
|
+
},
|
|
30
|
+
annotations: {
|
|
31
|
+
readOnlyHint: true,
|
|
32
|
+
openWorldHint: true,
|
|
33
|
+
},
|
|
34
|
+
}, async (scrapingParams) => {
|
|
35
|
+
const params = Object.assign(Object.assign({ headless: 'html' }, scrapingParams), { target: constants_1.SCRAPER_API_TARGETS.TARGET_PRODUCT, parse: true });
|
|
36
|
+
const { data } = await sapiClient.scrape({ auth, scrapingParams: params });
|
|
37
|
+
return {
|
|
38
|
+
content: [
|
|
39
|
+
{
|
|
40
|
+
type: 'text',
|
|
41
|
+
text: JSON.stringify(data),
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.TargetProductTool = TargetProductTool;
|
|
50
|
+
//# sourceMappingURL=target-product-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"target-product-tool.js","sourceRoot":"","sources":["../../../src/tools/target-product/target-product-tool.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAoB;AAEpB,+CAA+D;AAC/D,mDAAiE;AACjE,kCAAqD;AAErD,MAAM,cAAc,GAAG,aAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC,CAAC,QAAQ,EAAE,CAAC;AAExF,MAAM,UAAU,GAAG,aAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC,CAAC,QAAQ,EAAE,CAAC;AAEzF,MAAa,iBAAkB,SAAQ,WAAI;IAA3C;;QACE,YAAO,GAAG,mBAAO,CAAC,SAAS,CAAC;QAE5B,sBAAiB,GAAG,CAAC,EAAE,IAAI,EAAoB,EAAE,EAAE;YACjD,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,CAAC,CAAC;QAEF,aAAQ,GAAG,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAwB,EAAE,EAAE;YAChE,MAAM,CAAC,YAAY,CACjB,gBAAgB,EAChB;gBACE,WAAW,EAAE,mDAAmD;gBAChE,WAAW,EAAE;oBACX,UAAU,EAAE,aAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wCAAwC,CAAC;oBACzE,QAAQ,EAAE,uBAAW;oBACrB,UAAU,EAAE,yBAAa;oBACzB,WAAW,EAAE,cAAc;oBAC3B,OAAO,EAAE,UAAU;iBACpB;gBACD,WAAW,EAAE;oBACX,YAAY,EAAE,IAAI;oBAClB,aAAa,EAAE,IAAI;iBACpB;aACF,EACD,KAAK,EAAE,cAAiC,EAAE,EAAE;gBAC1C,MAAM,MAAM,GAAG,8BACb,QAAQ,EAAE,MAAM,IACb,cAAc,KACjB,MAAM,EAAE,+BAAmB,CAAC,cAAc,EAC1C,KAAK,EAAE,IAAI,GACe,CAAC;gBAE7B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,UAAU,CAAC,MAAM,CAAS,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC,CAAC;gBAEnF,OAAO;oBACL,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,MAAM;4BACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;yBAC3B;qBACF;iBACF,CAAC;YACJ,CAAC,CACF,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CAAA;AA7CD,8CA6CC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./target-search-tool"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/target-search/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TargetSearchTool = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
const constants_1 = require("../../constants");
|
|
9
|
+
const utils_1 = require("../../utils");
|
|
10
|
+
const zod_types_1 = require("../../zod/zod-types");
|
|
11
|
+
const tool_1 = require("../tool");
|
|
12
|
+
const zodDeliveryZip = zod_1.default.string().describe('ZIP code for delivery location').optional();
|
|
13
|
+
const zodStoreId = zod_1.default.string().describe('Target store ID for local inventory').optional();
|
|
14
|
+
class TargetSearchTool extends tool_1.Tool {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.toolset = constants_1.TOOLSET.ECOMMERCE;
|
|
18
|
+
this.transformResponse = ({ data }) => {
|
|
19
|
+
for (const fieldToRemove of TargetSearchTool.FIELDS_WITH_HIGH_CHAR_COUNT) {
|
|
20
|
+
data = (0, utils_1.removeKeyFromNestedObject)({ obj: data, keyToRemove: fieldToRemove });
|
|
21
|
+
}
|
|
22
|
+
return { data: JSON.stringify(data) };
|
|
23
|
+
};
|
|
24
|
+
this.register = ({ server, sapiClient, auth }) => {
|
|
25
|
+
server.registerTool('target_search', {
|
|
26
|
+
description: 'Scrape Target Search results with automatic parsing',
|
|
27
|
+
inputSchema: {
|
|
28
|
+
query: zod_1.default.string().describe('Search query for Target products'),
|
|
29
|
+
jsRender: zod_types_1.zodJsRender,
|
|
30
|
+
deviceType: zod_types_1.zodDeviceType,
|
|
31
|
+
deliveryZip: zodDeliveryZip,
|
|
32
|
+
storeId: zodStoreId,
|
|
33
|
+
},
|
|
34
|
+
annotations: {
|
|
35
|
+
readOnlyHint: true,
|
|
36
|
+
openWorldHint: true,
|
|
37
|
+
},
|
|
38
|
+
}, async (scrapingParams) => {
|
|
39
|
+
const params = Object.assign(Object.assign({ headless: 'html' }, scrapingParams), { target: constants_1.SCRAPER_API_TARGETS.TARGET_SEARCH, markdown: true });
|
|
40
|
+
const { data } = await sapiClient.scrape({ auth, scrapingParams: params });
|
|
41
|
+
const { data: text } = this.transformResponse({ data });
|
|
42
|
+
return {
|
|
43
|
+
content: [
|
|
44
|
+
{
|
|
45
|
+
type: 'text',
|
|
46
|
+
text,
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.TargetSearchTool = TargetSearchTool;
|
|
55
|
+
TargetSearchTool.FIELDS_WITH_HIGH_CHAR_COUNT = ['suggested', 'refinements'];
|
|
56
|
+
//# sourceMappingURL=target-search-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"target-search-tool.js","sourceRoot":"","sources":["../../../src/tools/target-search/target-search-tool.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAoB;AAEpB,+CAA+D;AAC/D,uCAAwD;AACxD,mDAAiE;AACjE,kCAAqD;AAErD,MAAM,cAAc,GAAG,aAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC,CAAC,QAAQ,EAAE,CAAC;AAExF,MAAM,UAAU,GAAG,aAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC,CAAC,QAAQ,EAAE,CAAC;AAEzF,MAAa,gBAAiB,SAAQ,WAAI;IAA1C;;QACE,YAAO,GAAG,mBAAO,CAAC,SAAS,CAAC;QAI5B,sBAAiB,GAAG,CAAC,EAAE,IAAI,EAAoB,EAAE,EAAE;YACjD,KAAK,MAAM,aAAa,IAAI,gBAAgB,CAAC,2BAA2B,EAAE,CAAC;gBACzE,IAAI,GAAG,IAAA,iCAAyB,EAAC,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC,CAAC;YAC9E,CAAC;YAED,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,CAAC,CAAC;QAEF,aAAQ,GAAG,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAwB,EAAE,EAAE;YAChE,MAAM,CAAC,YAAY,CACjB,eAAe,EACf;gBACE,WAAW,EAAE,qDAAqD;gBAClE,WAAW,EAAE;oBACX,KAAK,EAAE,aAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;oBAC9D,QAAQ,EAAE,uBAAW;oBACrB,UAAU,EAAE,yBAAa;oBACzB,WAAW,EAAE,cAAc;oBAC3B,OAAO,EAAE,UAAU;iBACpB;gBACD,WAAW,EAAE;oBACX,YAAY,EAAE,IAAI;oBAClB,aAAa,EAAE,IAAI;iBACpB;aACF,EACD,KAAK,EAAE,cAAiC,EAAE,EAAE;gBAC1C,MAAM,MAAM,GAAG,8BACb,QAAQ,EAAE,MAAM,IACb,cAAc,KACjB,MAAM,EAAE,+BAAmB,CAAC,aAAa,EACzC,QAAQ,EAAE,IAAI,GACY,CAAC;gBAE7B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,UAAU,CAAC,MAAM,CAAS,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC,CAAC;gBAEnF,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,iBAAiB,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;gBAExD,OAAO;oBACL,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,MAAM;4BACZ,IAAI;yBACL;qBACF;iBACF,CAAC;YACJ,CAAC,CACF,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;;AArDD,4CAqDC;AAlDgB,4CAA2B,GAAG,CAAC,WAAW,EAAE,aAAa,CAAC,AAA/B,CAAgC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./tiktok-post-tool"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/tiktok-post/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TiktokPostTool = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
const constants_1 = require("../../constants");
|
|
9
|
+
const zod_types_1 = require("../../zod/zod-types");
|
|
10
|
+
const tool_1 = require("../tool");
|
|
11
|
+
class TiktokPostTool extends tool_1.Tool {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.toolset = constants_1.TOOLSET.SOCIAL_MEDIA;
|
|
15
|
+
this.transformResponse = ({ data }) => {
|
|
16
|
+
return { data: JSON.stringify(data) };
|
|
17
|
+
};
|
|
18
|
+
this.register = ({ server, sapiClient, auth }) => {
|
|
19
|
+
server.registerTool('tiktok_post', {
|
|
20
|
+
description: 'Scrape a TikTok post URL for structured data such as engagement, captions, and hashtags',
|
|
21
|
+
inputSchema: {
|
|
22
|
+
url: zod_1.default
|
|
23
|
+
.string()
|
|
24
|
+
.describe('TikTok post URL, e.g. https://www.tiktok.com/@user/video/1234567890'),
|
|
25
|
+
xhr: zod_types_1.zodXhr,
|
|
26
|
+
},
|
|
27
|
+
annotations: {
|
|
28
|
+
readOnlyHint: true,
|
|
29
|
+
openWorldHint: true,
|
|
30
|
+
},
|
|
31
|
+
}, async (scrapingParams) => {
|
|
32
|
+
const params = Object.assign(Object.assign({}, scrapingParams), { target: constants_1.SCRAPER_API_TARGETS.TIKTOK_POST });
|
|
33
|
+
const { data } = await sapiClient.scrape({ auth, scrapingParams: params });
|
|
34
|
+
const { data: text } = this.transformResponse({ data });
|
|
35
|
+
return {
|
|
36
|
+
content: [
|
|
37
|
+
{
|
|
38
|
+
type: 'text',
|
|
39
|
+
text,
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.TiktokPostTool = TiktokPostTool;
|
|
48
|
+
//# sourceMappingURL=tiktok-post-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tiktok-post-tool.js","sourceRoot":"","sources":["../../../src/tools/tiktok-post/tiktok-post-tool.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAoB;AAEpB,+CAA+D;AAC/D,mDAA6C;AAC7C,kCAAqD;AAErD,MAAa,cAAe,SAAQ,WAAI;IAAxC;;QACE,YAAO,GAAG,mBAAO,CAAC,YAAY,CAAC;QAE/B,sBAAiB,GAAG,CAAC,EAAE,IAAI,EAAoB,EAAE,EAAE;YACjD,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,CAAC,CAAC;QAEF,aAAQ,GAAG,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAwB,EAAE,EAAE;YAChE,MAAM,CAAC,YAAY,CACjB,aAAa,EACb;gBACE,WAAW,EACT,yFAAyF;gBAC3F,WAAW,EAAE;oBACX,GAAG,EAAE,aAAC;yBACH,MAAM,EAAE;yBACR,QAAQ,CAAC,qEAAqE,CAAC;oBAClF,GAAG,EAAE,kBAAM;iBACZ;gBACD,WAAW,EAAE;oBACX,YAAY,EAAE,IAAI;oBAClB,aAAa,EAAE,IAAI;iBACpB;aACF,EACD,KAAK,EAAE,cAAiC,EAAE,EAAE;gBAC1C,MAAM,MAAM,GAAG,gCACV,cAAc,KACjB,MAAM,EAAE,+BAAmB,CAAC,WAAW,GACb,CAAC;gBAE7B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,UAAU,CAAC,MAAM,CAAS,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC,CAAC;gBAEnF,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,iBAAiB,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;gBAExD,OAAO;oBACL,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,MAAM;4BACZ,IAAI;yBACL;qBACF;iBACF,CAAC;YACJ,CAAC,CACF,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CAAA;AA7CD,wCA6CC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./tiktok-shop-product-tool"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/tiktok-shop-product/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6DAA2C"}
|