@scavio/mcp-server 0.13.0 → 0.14.0
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 +1 -1
- package/dist/lib/trim-response.d.ts +6 -0
- package/dist/lib/trim-response.js +26 -0
- package/dist/lib/trim-response.js.map +1 -0
- package/dist/tools/airbnb.js +30 -49
- package/dist/tools/airbnb.js.map +1 -1
- package/dist/tools/amazon.js +11 -18
- package/dist/tools/amazon.js.map +1 -1
- package/dist/tools/appstore.js +16 -15
- package/dist/tools/appstore.js.map +1 -1
- package/dist/tools/booking.js +28 -45
- package/dist/tools/booking.js.map +1 -1
- package/dist/tools/capterra.js +16 -15
- package/dist/tools/capterra.js.map +1 -1
- package/dist/tools/companieshouse.js +11 -10
- package/dist/tools/companieshouse.js.map +1 -1
- package/dist/tools/ebay.js +21 -30
- package/dist/tools/ebay.js.map +1 -1
- package/dist/tools/extract.js +6 -5
- package/dist/tools/extract.js.map +1 -1
- package/dist/tools/g2.js +23 -22
- package/dist/tools/g2.js.map +1 -1
- package/dist/tools/glassdoor.js +18 -17
- package/dist/tools/glassdoor.js.map +1 -1
- package/dist/tools/google.js +154 -153
- package/dist/tools/google.js.map +1 -1
- package/dist/tools/googleads.js +20 -19
- package/dist/tools/googleads.js.map +1 -1
- package/dist/tools/googleplay.js +14 -13
- package/dist/tools/googleplay.js.map +1 -1
- package/dist/tools/homedepot.js +15 -28
- package/dist/tools/homedepot.js.map +1 -1
- package/dist/tools/indeed.js +20 -39
- package/dist/tools/indeed.js.map +1 -1
- package/dist/tools/instagram.js +59 -58
- package/dist/tools/instagram.js.map +1 -1
- package/dist/tools/kuaishou.js +49 -48
- package/dist/tools/kuaishou.js.map +1 -1
- package/dist/tools/linkedin.js +26 -25
- package/dist/tools/linkedin.js.map +1 -1
- package/dist/tools/metaads.js +21 -20
- package/dist/tools/metaads.js.map +1 -1
- package/dist/tools/reddit.js +48 -47
- package/dist/tools/reddit.js.map +1 -1
- package/dist/tools/redfin.js +29 -28
- package/dist/tools/redfin.js.map +1 -1
- package/dist/tools/sec.js +36 -35
- package/dist/tools/sec.js.map +1 -1
- package/dist/tools/target.js +19 -40
- package/dist/tools/target.js.map +1 -1
- package/dist/tools/threads.js +20 -19
- package/dist/tools/threads.js.map +1 -1
- package/dist/tools/tiktok-shop.js +38 -37
- package/dist/tools/tiktok-shop.js.map +1 -1
- package/dist/tools/tiktok.js +54 -53
- package/dist/tools/tiktok.js.map +1 -1
- package/dist/tools/tripadvisor.js +20 -43
- package/dist/tools/tripadvisor.js.map +1 -1
- package/dist/tools/usage.js +3 -2
- package/dist/tools/usage.js.map +1 -1
- package/dist/tools/walmart.js +35 -34
- package/dist/tools/walmart.js.map +1 -1
- package/dist/tools/x.js +44 -43
- package/dist/tools/x.js.map +1 -1
- package/dist/tools/yelp.js +21 -20
- package/dist/tools/yelp.js.map +1 -1
- package/dist/tools/youtube.js +77 -76
- package/dist/tools/youtube.js.map +1 -1
- package/dist/tools/zillow.js +38 -53
- package/dist/tools/zillow.js.map +1 -1
- package/package.json +2 -2
package/dist/tools/redfin.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { handleApiError } from "../lib/tool-error.js";
|
|
3
|
+
import { trimResponse } from "../lib/trim-response.js";
|
|
3
4
|
// Redfin - US residential real estate. Three tools, 1 credit each, flat:
|
|
4
5
|
// property and market read the listing/region PAGE, whose inlined request cache
|
|
5
6
|
// replaces the ~40 internal calls the page made, which is why a full fact sheet
|
|
@@ -22,32 +23,32 @@ import { handleApiError } from "../lib/tool-error.js";
|
|
|
22
23
|
/** location OR (region_id AND region_type) - the region halves must travel together. */
|
|
23
24
|
const regionRef = {
|
|
24
25
|
location: z.string().min(1).max(500).optional()
|
|
25
|
-
.describe("
|
|
26
|
+
.describe("Redfin URL or 5-digit ZIP. CITY NAMES NOT ACCEPTED. Required unless region_id+region_type."),
|
|
26
27
|
region_id: z.number().int().min(1).optional()
|
|
27
|
-
.describe("Redfin
|
|
28
|
+
.describe("Redfin region id (NOT a ZIP). Use with region_type."),
|
|
28
29
|
region_type: z.union([z.literal(1), z.literal(2), z.literal(5), z.literal(6)]).optional()
|
|
29
|
-
.describe("
|
|
30
|
+
.describe("1=neighborhood, 2=ZIP, 5=county, 6=city. Use with region_id."),
|
|
30
31
|
};
|
|
31
32
|
export function registerRedfinTools(server, getClient) {
|
|
32
33
|
const call = (path) => async (params) => {
|
|
33
34
|
try {
|
|
34
35
|
const data = await getClient().post(path, params);
|
|
35
|
-
return
|
|
36
|
+
return trimResponse(data);
|
|
36
37
|
}
|
|
37
38
|
catch (err) {
|
|
38
39
|
return handleApiError(err);
|
|
39
40
|
}
|
|
40
41
|
};
|
|
41
|
-
server.tool("search_redfin", `Search Redfin
|
|
42
|
+
server.tool("search_redfin", `Search Redfin US real estate listings. CITY NAMES NOT ACCEPTED for location. days_on_market is ALWAYS NULL; filter via max/min_days_on_market. sold_within_days only valid with listing_status=sold. 1 credit.`, {
|
|
42
43
|
...regionRef,
|
|
43
44
|
listing_status: z.enum(["for_sale", "sold", "for_rent"]).optional()
|
|
44
|
-
.describe("
|
|
45
|
+
.describe("Default 'for_sale'."),
|
|
45
46
|
sold_within_days: z.number().int().min(1).optional()
|
|
46
|
-
.describe("
|
|
47
|
+
.describe("Last N days. ONLY with listing_status=sold, else 400."),
|
|
47
48
|
page: z.number().int().min(1).optional()
|
|
48
|
-
.describe("
|
|
49
|
+
.describe("Page, 1-based."),
|
|
49
50
|
limit: z.number().int().min(1).max(350).optional()
|
|
50
|
-
.describe("
|
|
51
|
+
.describe("Per page, default 100."),
|
|
51
52
|
sort: z.enum([
|
|
52
53
|
"recommended",
|
|
53
54
|
"price_low",
|
|
@@ -59,42 +60,42 @@ export function registerRedfinTools(server, getClient) {
|
|
|
59
60
|
"price_per_sqft_low",
|
|
60
61
|
"price_per_sqft_high",
|
|
61
62
|
]).optional()
|
|
62
|
-
.describe("
|
|
63
|
+
.describe("Sort order."),
|
|
63
64
|
min_price: z.number().min(0).optional()
|
|
64
|
-
.describe("
|
|
65
|
+
.describe("Min price (rent if for_rent)."),
|
|
65
66
|
max_price: z.number().min(0).optional()
|
|
66
|
-
.describe("
|
|
67
|
+
.describe("Max price (rent if for_rent)."),
|
|
67
68
|
beds_min: z.number().int().min(0).optional()
|
|
68
|
-
.describe("
|
|
69
|
+
.describe("Min bedrooms."),
|
|
69
70
|
beds_max: z.number().int().min(0).optional()
|
|
70
|
-
.describe("
|
|
71
|
+
.describe("Max bedrooms."),
|
|
71
72
|
baths_min: z.number().int().min(0).optional()
|
|
72
|
-
.describe("
|
|
73
|
+
.describe("Min baths, whole only."),
|
|
73
74
|
sqft_min: z.number().int().min(0).optional()
|
|
74
|
-
.describe("
|
|
75
|
+
.describe("Min sqft."),
|
|
75
76
|
sqft_max: z.number().int().min(0).optional()
|
|
76
|
-
.describe("
|
|
77
|
+
.describe("Max sqft."),
|
|
77
78
|
lot_size_min: z.number().int().min(0).optional()
|
|
78
|
-
.describe("
|
|
79
|
+
.describe("Min lot sqft."),
|
|
79
80
|
year_built_min: z.number().int().min(0).optional()
|
|
80
|
-
.describe("Earliest year
|
|
81
|
+
.describe("Earliest year."),
|
|
81
82
|
year_built_max: z.number().int().min(0).optional()
|
|
82
|
-
.describe("Latest year
|
|
83
|
+
.describe("Latest year."),
|
|
83
84
|
max_hoa: z.number().min(0).optional()
|
|
84
|
-
.describe("
|
|
85
|
+
.describe("Max HOA $/mo."),
|
|
85
86
|
property_type: z.enum(["house", "condo", "townhouse", "multi_family", "land", "other", "co_op"]).optional()
|
|
86
|
-
.describe("
|
|
87
|
+
.describe("Property type."),
|
|
87
88
|
has_pool: z.boolean().optional()
|
|
88
|
-
.describe("
|
|
89
|
+
.describe("Pool filter."),
|
|
89
90
|
max_days_on_market: z.number().int().min(0).optional()
|
|
90
|
-
.describe("
|
|
91
|
+
.describe("At most N days. Cannot combine with min."),
|
|
91
92
|
min_days_on_market: z.number().int().min(0).optional()
|
|
92
|
-
.describe("
|
|
93
|
+
.describe("At least N days. Cannot combine with max."),
|
|
93
94
|
}, call("/api/v1/redfin/search"));
|
|
94
|
-
server.tool("get_redfin_property", `
|
|
95
|
+
server.tool("get_redfin_property", `Full Redfin property detail: estimates, MLS facts, history, schools, comps. 1 credit.`, {
|
|
95
96
|
property_id: z.string().min(1).max(500)
|
|
96
|
-
.describe("
|
|
97
|
+
.describe("Property id or redfin.com URL."),
|
|
97
98
|
}, call("/api/v1/redfin/property"));
|
|
98
|
-
server.tool("get_redfin_market", `
|
|
99
|
+
server.tool("get_redfin_market", `Redfin housing-market stats for a US region: prices, inventory, compete score. CITY NAMES NOT ACCEPTED. 1 credit.`, { ...regionRef }, call("/api/v1/redfin/market"));
|
|
99
100
|
}
|
|
100
101
|
//# sourceMappingURL=redfin.js.map
|
package/dist/tools/redfin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redfin.js","sourceRoot":"","sources":["../../src/tools/redfin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"redfin.js","sourceRoot":"","sources":["../../src/tools/redfin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,yEAAyE;AACzE,gFAAgF;AAChF,gFAAgF;AAChF,mCAAmC;AACnC,EAAE;AACF,iEAAiE;AACjE,8EAA8E;AAC9E,gFAAgF;AAChF,qEAAqE;AACrE,+EAA+E;AAC/E,8EAA8E;AAC9E,4EAA4E;AAC5E,0CAA0C;AAC1C,EAAE;AACF,+EAA+E;AAC/E,4EAA4E;AAC5E,4EAA4E;AAC5E,+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O,EAAE,CAAC,QAAQ,EAAE;aAC7B,QAAQ,CAAC,cAAc,CAAC;QAC3B,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;aACnD,QAAQ,CAAC,0CAA0C,CAAC;QACvD,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;aACnD,QAAQ,CAAC,2CAA2C,CAAC;KACzD,EACD,IAAI,CAAC,uBAAuB,CAAC,CAC9B,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,qBAAqB,EACrB,uFAAuF,EACvF;QACE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;aACpC,QAAQ,CAAC,gCAAgC,CAAC;KAC9C,EACD,IAAI,CAAC,yBAAyB,CAAC,CAChC,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,mBAAmB,EACnB,mHAAmH,EACnH,EAAE,GAAG,SAAS,EAAE,EAChB,IAAI,CAAC,uBAAuB,CAAC,CAC9B,CAAC;AACJ,CAAC"}
|
package/dist/tools/sec.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { handleApiError } from "../lib/tool-error.js";
|
|
3
|
+
import { trimResponse } from "../lib/trim-response.js";
|
|
3
4
|
// SEC EDGAR - US Securities and Exchange Commission regulatory filings. Six
|
|
4
5
|
// tools, 1 credit each, flat: the SEC publishes this data itself and even
|
|
5
6
|
// include_history, the one call that can buy up to 10 upstream fetches, is
|
|
@@ -18,9 +19,9 @@ import { handleApiError } from "../lib/tool-error.js";
|
|
|
18
19
|
/** Both spellings are accepted by both fields; one of the two is required. */
|
|
19
20
|
const filerRef = {
|
|
20
21
|
cik: z.string().min(1).max(20).optional()
|
|
21
|
-
.describe("
|
|
22
|
+
.describe("CIK, e.g. '0000320193'. Ticker also accepted. Either this or ticker required."),
|
|
22
23
|
ticker: z.string().min(1).max(20).optional()
|
|
23
|
-
.describe("Ticker
|
|
24
|
+
.describe("Ticker, e.g. 'AAPL' or 'BRK.B'. Either this or cik required."),
|
|
24
25
|
};
|
|
25
26
|
const formItem = z.string().min(1).max(50);
|
|
26
27
|
const locationCode = z.string().regex(/^[A-Za-z0-9]{2}$/, "must be a 2-character EDGAR location code");
|
|
@@ -28,77 +29,77 @@ export function registerSecTools(server, getClient) {
|
|
|
28
29
|
const call = (path) => async (params) => {
|
|
29
30
|
try {
|
|
30
31
|
const data = await getClient().post(path, params);
|
|
31
|
-
return
|
|
32
|
+
return trimResponse(data);
|
|
32
33
|
}
|
|
33
34
|
catch (err) {
|
|
34
35
|
return handleApiError(err);
|
|
35
36
|
}
|
|
36
37
|
};
|
|
37
|
-
server.tool("resolve_sec_company", `
|
|
38
|
+
server.tool("resolve_sec_company", `Resolve a ticker or company name to a SEC EDGAR CIK. Start here before other SEC tools. 1 credit.`, {
|
|
38
39
|
query: z.string().min(1).max(200)
|
|
39
|
-
.describe("
|
|
40
|
+
.describe("Ticker, company name, or fragment."),
|
|
40
41
|
limit: z.number().int().min(1).max(100).optional()
|
|
41
|
-
.describe("Rows to return
|
|
42
|
+
.describe("Rows to return (default 10). Not paginated."),
|
|
42
43
|
exchange: z.enum(["NASDAQ", "NYSE", "OTC", "CBOE"]).optional()
|
|
43
|
-
.describe("
|
|
44
|
+
.describe("Filter by exchange. Omit to include filers with no exchange."),
|
|
44
45
|
}, call("/api/v1/sec/lookup"));
|
|
45
|
-
server.tool("get_sec_company", `Get a
|
|
46
|
-
server.tool("get_sec_filings", `List
|
|
46
|
+
server.tool("get_sec_company", `Get a SEC EDGAR filer profile: names, industry, addresses, tickers, recent filings. Requires cik or ticker. 1 credit.`, { ...filerRef }, call("/api/v1/sec/company"));
|
|
47
|
+
server.tool("get_sec_filings", `List a SEC EDGAR filer's filings. 'form' matches root too ('10-K' includes 10-K/A). Paginated. include_history reaches archived shards. 1 credit.`, {
|
|
47
48
|
...filerRef,
|
|
48
49
|
form: z.union([formItem, z.array(formItem).min(1).max(25)]).optional()
|
|
49
|
-
.describe("
|
|
50
|
+
.describe("e.g. '10-K', ['10-K','10-Q']. Matches root form too."),
|
|
50
51
|
date_from: z.string().regex(/^\d{4}-\d{2}-\d{2}$/, "must be YYYY-MM-DD").optional()
|
|
51
|
-
.describe("Earliest filing date,
|
|
52
|
+
.describe("Earliest filing date, YYYY-MM-DD."),
|
|
52
53
|
date_to: z.string().regex(/^\d{4}-\d{2}-\d{2}$/, "must be YYYY-MM-DD").optional()
|
|
53
|
-
.describe("Latest filing date,
|
|
54
|
+
.describe("Latest filing date, YYYY-MM-DD."),
|
|
54
55
|
page: z.number().int().min(1).optional()
|
|
55
|
-
.describe("
|
|
56
|
+
.describe("Page, 1-based."),
|
|
56
57
|
limit: z.number().int().min(1).max(500).optional()
|
|
57
|
-
.describe("
|
|
58
|
+
.describe("Per page (default 50)."),
|
|
58
59
|
include_history: z.boolean().optional()
|
|
59
|
-
.describe("
|
|
60
|
+
.describe("Fetch archived history beyond the recent block."),
|
|
60
61
|
}, call("/api/v1/sec/filings"));
|
|
61
|
-
server.tool("get_sec_concept", `Get
|
|
62
|
+
server.tool("get_sec_concept", `Get all reported values for one XBRL concept. Tags are CASE-SENSITIVE (use get_sec_facts to discover them). 'form' is EXACT here ('10-K' excludes 10-K/A). 1 credit.`, {
|
|
62
63
|
...filerRef,
|
|
63
64
|
concept: z.string().min(1).max(120).regex(/^[A-Za-z][A-Za-z0-9]*$/, "must be an XBRL tag name, e.g. NetIncomeLoss")
|
|
64
|
-
.describe("
|
|
65
|
+
.describe("XBRL tag, CASE-SENSITIVE, e.g. 'NetIncomeLoss'."),
|
|
65
66
|
taxonomy: z.string().min(1).max(40).regex(/^[A-Za-z][A-Za-z0-9-]*$/, "must be an XBRL taxonomy, e.g. us-gaap").optional()
|
|
66
|
-
.describe("
|
|
67
|
+
.describe("e.g. 'us-gaap' (default), 'dei', 'ifrs-full'."),
|
|
67
68
|
unit: z.string().min(1).max(40).optional()
|
|
68
|
-
.describe("
|
|
69
|
+
.describe("Filter by unit, e.g. 'USD' or 'USD/shares'."),
|
|
69
70
|
form: formItem.optional()
|
|
70
|
-
.describe("
|
|
71
|
+
.describe("Exact form match ('10-K' excludes 10-K/A)."),
|
|
71
72
|
limit: z.number().int().min(1).max(2000).optional()
|
|
72
|
-
.describe("Facts to return
|
|
73
|
+
.describe("Facts to return (default 250). Not paginated."),
|
|
73
74
|
}, call("/api/v1/sec/concept"));
|
|
74
|
-
server.tool("get_sec_facts", `
|
|
75
|
+
server.tool("get_sec_facts", `List all XBRL concepts a filer reports. Discovery step: find tags here, then pull history with get_sec_concept. 1 credit.`, {
|
|
75
76
|
...filerRef,
|
|
76
77
|
taxonomy: z.string().min(1).max(40).optional()
|
|
77
|
-
.describe("
|
|
78
|
+
.describe("e.g. 'us-gaap', 'dei'. Omit for all."),
|
|
78
79
|
query: z.string().min(1).max(200).optional()
|
|
79
|
-
.describe("
|
|
80
|
+
.describe("Substring match on tag name/label, e.g. 'revenue'."),
|
|
80
81
|
limit: z.number().int().min(1).max(2000).optional()
|
|
81
|
-
.describe("
|
|
82
|
+
.describe("Rows to return (default 250). Not paginated."),
|
|
82
83
|
}, call("/api/v1/sec/facts"));
|
|
83
|
-
server.tool("search_sec_filings", `Full-text search across
|
|
84
|
+
server.tool("search_sec_filings", `Full-text search across SEC EDGAR filing documents. Coverage starts 2001. Capped at page 100 (10k docs). Use get_sec_filings for a single filer's list instead. 1 credit.`, {
|
|
84
85
|
query: z.string().min(1).max(500).optional()
|
|
85
|
-
.describe("Full-text query
|
|
86
|
+
.describe("Full-text query. Quoted phrases matched exactly. Optional if filters set."),
|
|
86
87
|
cik: z.union([z.string().min(1).max(20), z.array(z.string().min(1).max(20)).min(1).max(25)]).optional()
|
|
87
|
-
.describe("
|
|
88
|
+
.describe("CIK(s) or ticker(s), string or array up to 25."),
|
|
88
89
|
ticker: z.union([z.string().min(1).max(20), z.array(z.string().min(1).max(20)).min(1).max(25)]).optional()
|
|
89
|
-
.describe("
|
|
90
|
+
.describe("Ticker(s), string or array up to 25."),
|
|
90
91
|
form: z.union([formItem, z.array(formItem).min(1).max(25)]).optional()
|
|
91
|
-
.describe("
|
|
92
|
+
.describe("e.g. '8-K' or ['10-K','10-Q']."),
|
|
92
93
|
date_from: z.string().regex(/^\d{4}-\d{2}-\d{2}$/, "must be YYYY-MM-DD").optional()
|
|
93
|
-
.describe("Earliest filing date,
|
|
94
|
+
.describe("Earliest filing date, YYYY-MM-DD."),
|
|
94
95
|
date_to: z.string().regex(/^\d{4}-\d{2}-\d{2}$/, "must be YYYY-MM-DD").optional()
|
|
95
|
-
.describe("Latest filing date,
|
|
96
|
+
.describe("Latest filing date, YYYY-MM-DD."),
|
|
96
97
|
location: z.union([locationCode, z.array(locationCode).min(1).max(25)]).optional()
|
|
97
|
-
.describe("
|
|
98
|
+
.describe("EDGAR 2-char location codes, e.g. 'CA', 'NY'."),
|
|
98
99
|
sort: z.enum(["relevance", "newest", "oldest"]).optional()
|
|
99
|
-
.describe("
|
|
100
|
+
.describe("Default: relevance."),
|
|
100
101
|
page: z.number().int().min(1).max(100).optional()
|
|
101
|
-
.describe("
|
|
102
|
+
.describe("Page, 1-100. 100 docs/page. Max page 100."),
|
|
102
103
|
}, call("/api/v1/sec/search"));
|
|
103
104
|
}
|
|
104
105
|
//# sourceMappingURL=sec.js.map
|
package/dist/tools/sec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sec.js","sourceRoot":"","sources":["../../src/tools/sec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"sec.js","sourceRoot":"","sources":["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AC;QAC9C,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;aAC/E,QAAQ,CAAC,+CAA+C,CAAC;QAC5D,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE;aACvD,QAAQ,CAAC,qBAAqB,CAAC;QAClC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;aAC9C,QAAQ,CAAC,2CAA2C,CAAC;KACzD,EACD,IAAI,CAAC,oBAAoB,CAAC,CAC3B,CAAC;AACJ,CAAC"}
|
package/dist/tools/target.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { handleApiError } from "../lib/tool-error.js";
|
|
3
|
+
import { trimResponse } from "../lib/trim-response.js";
|
|
3
4
|
// Every description opens "Target.com, the US retailer" on purpose: read out of
|
|
4
5
|
// context, a tool called get_target_* is easily taken for "the target of the
|
|
5
6
|
// operation". The brand has to be established in the first clause, before the
|
|
@@ -11,91 +12,69 @@ import { handleApiError } from "../lib/tool-error.js";
|
|
|
11
12
|
// text and left for the backend to apply.
|
|
12
13
|
const SORT_DESCRIPTION = "Sort order. Upstream default is 'relevance'.";
|
|
13
14
|
const storeIdField = z.string().optional()
|
|
14
|
-
.describe("
|
|
15
|
+
.describe("Target store id for prices/availability. Default '3991'.");
|
|
15
16
|
export function registerTargetTools(server, getClient) {
|
|
16
|
-
server.tool("search_target_products", `Target.com
|
|
17
|
-
|
|
18
|
-
seller_id and seller_name are NULL for first-party stock, which is most of Target. NULL means "sold by Target", not missing data — only Target Plus marketplace rows name a third-party vendor.
|
|
19
|
-
|
|
20
|
-
Paginate with page. count sets the page size and is capped at 28: Target rejects anything above that outright (upstream default 24). store_id picks the store whose prices and availability you see.
|
|
21
|
-
|
|
22
|
-
LATENCY, not price, is the thing to plan around: Target refuses proxy pools and is reached through a headless browser, so a search takes roughly 9 seconds and can hold a concurrency slot much longer under retry. Do not put it in a tight loop. Costs 1 credit per page.`, {
|
|
17
|
+
server.tool("search_target_products", `Search Target.com products. Slow (~9s/call, headless browser). Max 28/page. 1 credit/page.`, {
|
|
23
18
|
keyword: z.string().min(1).max(500)
|
|
24
|
-
.describe("
|
|
19
|
+
.describe("Search keyword, e.g. 'office chair'."),
|
|
25
20
|
page: z.number().int().min(1).optional()
|
|
26
|
-
.describe("
|
|
21
|
+
.describe("Page, 1-based."),
|
|
27
22
|
count: z.number().int().min(1).max(28).optional()
|
|
28
|
-
.describe("
|
|
23
|
+
.describe("Items/page, max 28. Default 24."),
|
|
29
24
|
sort: z.enum(["relevance", "featured", "price_low", "price_high", "rating_high", "best_seller", "newest"]).optional()
|
|
30
25
|
.describe(SORT_DESCRIPTION),
|
|
31
26
|
store_id: storeIdField,
|
|
32
27
|
}, async (params) => {
|
|
33
28
|
try {
|
|
34
29
|
const data = await getClient().post("/api/v1/target/search", params);
|
|
35
|
-
return
|
|
30
|
+
return trimResponse(data);
|
|
36
31
|
}
|
|
37
32
|
catch (err) {
|
|
38
33
|
return handleApiError(err);
|
|
39
34
|
}
|
|
40
35
|
});
|
|
41
|
-
server.tool("get_target_category", `Target.com
|
|
42
|
-
|
|
43
|
-
seller_id and seller_name are NULL for first-party stock, which is most of Target — NULL means "sold by Target", not missing data.
|
|
44
|
-
|
|
45
|
-
category_id is the segment after \`N-\` in a target.com /c/ URL. Paginate with page; count is capped at 28 (upstream default 24). store_id picks the store whose prices and availability you see.
|
|
46
|
-
|
|
47
|
-
This is the SLOWEST Target endpoint at roughly 37 seconds per call, with 502-then-retry cases observed near 100 seconds. Use it for catalogue sweeps you can wait on, not for interactive lookups. Costs 1 credit per page.`, {
|
|
36
|
+
server.tool("get_target_category", `List Target.com products in a category. Very slow (~37s/call). Max 28/page. 1 credit/page.`, {
|
|
48
37
|
category_id: z.string().min(1)
|
|
49
|
-
.describe("
|
|
38
|
+
.describe("Segment after N- in target.com /c/ URL, e.g. '5xtg6'."),
|
|
50
39
|
page: z.number().int().min(1).optional()
|
|
51
|
-
.describe("
|
|
40
|
+
.describe("Page, 1-based."),
|
|
52
41
|
count: z.number().int().min(1).max(28).optional()
|
|
53
|
-
.describe("
|
|
42
|
+
.describe("Items/page, max 28. Default 24."),
|
|
54
43
|
sort: z.enum(["relevance", "featured", "price_low", "price_high", "rating_high", "best_seller", "newest"]).optional()
|
|
55
44
|
.describe(SORT_DESCRIPTION),
|
|
56
45
|
store_id: storeIdField,
|
|
57
46
|
}, async (params) => {
|
|
58
47
|
try {
|
|
59
48
|
const data = await getClient().post("/api/v1/target/category", params);
|
|
60
|
-
return
|
|
49
|
+
return trimResponse(data);
|
|
61
50
|
}
|
|
62
51
|
catch (err) {
|
|
63
52
|
return handleApiError(err);
|
|
64
53
|
}
|
|
65
54
|
});
|
|
66
|
-
server.tool("get_target_product", `Target.com
|
|
67
|
-
|
|
68
|
-
Pass a child TCIN and Target answers with its variation PARENT, with the child present in variants — that is the normal response, not a wrong match.
|
|
69
|
-
|
|
70
|
-
seller_id / seller_name are NULL for first-party stock, which is most of Target; NULL means "sold by Target". Unlike Walmart, store_id IS a real request param here — prices and availability are your choice.
|
|
71
|
-
|
|
72
|
-
Fastest Target endpoint at roughly 4 seconds. Single-product lookup, no pagination. For review bodies call get_target_reviews. Costs 1 credit.`, {
|
|
55
|
+
server.tool("get_target_product", `Get full Target.com product detail by TCIN. Child TCIN returns variation parent. 1 credit.`, {
|
|
73
56
|
tcin: z.string().min(1)
|
|
74
|
-
.describe("
|
|
57
|
+
.describe("TCIN from target.com /p/ URL, e.g. '54551690'."),
|
|
75
58
|
store_id: storeIdField,
|
|
76
59
|
}, async (params) => {
|
|
77
60
|
try {
|
|
78
61
|
const data = await getClient().post("/api/v1/target/product", params);
|
|
79
|
-
return
|
|
62
|
+
return trimResponse(data);
|
|
80
63
|
}
|
|
81
64
|
catch (err) {
|
|
82
65
|
return handleApiError(err);
|
|
83
66
|
}
|
|
84
67
|
});
|
|
85
|
-
server.tool("get_target_reviews", `Target.com
|
|
86
|
-
|
|
87
|
-
HARD CAP: 8 REVIEW BODIES MAXIMUM, no matter how large review_count is. Target publishes no more than that anonymously. There is NO page and NO offset param — \`limit\` only TRIMS the 8 you would already receive, it cannot fetch more. If you need a deep review corpus, this endpoint cannot supply it and no amount of extra calls will change that.
|
|
88
|
-
|
|
89
|
-
Roughly 40 seconds per call. Costs 1 credit.`, {
|
|
68
|
+
server.tool("get_target_reviews", `Get Target.com product reviews. HARD CAP: 8 reviews max, no pagination. ~40s/call. 1 credit.`, {
|
|
90
69
|
tcin: z.string().min(1)
|
|
91
|
-
.describe("
|
|
70
|
+
.describe("TCIN, e.g. '54551690'."),
|
|
92
71
|
limit: z.number().int().min(1).optional()
|
|
93
|
-
.describe("
|
|
72
|
+
.describe("Trim returned reviews. Max 8 regardless."),
|
|
94
73
|
store_id: storeIdField,
|
|
95
74
|
}, async (params) => {
|
|
96
75
|
try {
|
|
97
76
|
const data = await getClient().post("/api/v1/target/reviews", params);
|
|
98
|
-
return
|
|
77
|
+
return trimResponse(data);
|
|
99
78
|
}
|
|
100
79
|
catch (err) {
|
|
101
80
|
return handleApiError(err);
|
package/dist/tools/target.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"target.js","sourceRoot":"","sources":["../../src/tools/target.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"target.js","sourceRoot":"","sources":["../../src/t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AC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/tools/threads.js
CHANGED
|
@@ -1,89 +1,90 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { handleApiError } from "../lib/tool-error.js";
|
|
3
|
+
import { trimResponse } from "../lib/trim-response.js";
|
|
3
4
|
/**
|
|
4
5
|
* The handle surcharge. Threads' upstream handle lookup is dead, so a username
|
|
5
6
|
* has to be resolved through people search first — a second upstream call, and
|
|
6
7
|
* 2 extra credits. user_id is always the cheap path.
|
|
7
8
|
*/
|
|
8
9
|
const usernameField = z.string().min(1).max(60).optional()
|
|
9
|
-
.describe("
|
|
10
|
+
.describe("Handle without @. Costs 2 EXTRA credits (4 vs 2) due to handle resolution. Prefer user_id. Either username or user_id required.");
|
|
10
11
|
const userIdField = z.string().min(1).optional()
|
|
11
|
-
.describe("Numeric
|
|
12
|
+
.describe("Numeric user id from get_threads_profile or search_threads_users. Cheap path: 2 credits. Either username or user_id required.");
|
|
12
13
|
const cursorField = z.string().optional()
|
|
13
|
-
.describe("
|
|
14
|
+
.describe("Cursor from data.next_cursor.");
|
|
14
15
|
export function registerThreadsTools(server, getClient) {
|
|
15
|
-
server.tool("get_threads_profile", `Get a Threads
|
|
16
|
+
server.tool("get_threads_profile", `Get a Threads user profile. 2 credits by user_id, 4 by username (handle resolution surcharge). Pass one of username or user_id.`, {
|
|
16
17
|
username: usernameField,
|
|
17
18
|
user_id: userIdField,
|
|
18
19
|
}, async (params) => {
|
|
19
20
|
try {
|
|
20
21
|
const data = await getClient().post("/api/v1/threads/profile", params);
|
|
21
|
-
return
|
|
22
|
+
return trimResponse(data);
|
|
22
23
|
}
|
|
23
24
|
catch (err) {
|
|
24
25
|
return handleApiError(err);
|
|
25
26
|
}
|
|
26
27
|
});
|
|
27
|
-
server.tool("get_threads_user_posts", `List a Threads user's
|
|
28
|
+
server.tool("get_threads_user_posts", `List a Threads user's posts. Cursor-paginated. 2 credits/page by user_id, 4 by username.`, {
|
|
28
29
|
username: usernameField,
|
|
29
30
|
user_id: userIdField,
|
|
30
31
|
cursor: cursorField,
|
|
31
32
|
}, async (params) => {
|
|
32
33
|
try {
|
|
33
34
|
const data = await getClient().post("/api/v1/threads/user/posts", params);
|
|
34
|
-
return
|
|
35
|
+
return trimResponse(data);
|
|
35
36
|
}
|
|
36
37
|
catch (err) {
|
|
37
38
|
return handleApiError(err);
|
|
38
39
|
}
|
|
39
40
|
});
|
|
40
|
-
server.tool("get_threads_user_replies", `List
|
|
41
|
+
server.tool("get_threads_user_replies", `List replies a Threads user wrote to others (the Replies tab, not their own posts). Cursor-paginated. 2 credits/page by user_id, 4 by username.`, {
|
|
41
42
|
username: usernameField,
|
|
42
43
|
user_id: userIdField,
|
|
43
44
|
cursor: cursorField,
|
|
44
45
|
}, async (params) => {
|
|
45
46
|
try {
|
|
46
47
|
const data = await getClient().post("/api/v1/threads/user/replies", params);
|
|
47
|
-
return
|
|
48
|
+
return trimResponse(data);
|
|
48
49
|
}
|
|
49
50
|
catch (err) {
|
|
50
51
|
return handleApiError(err);
|
|
51
52
|
}
|
|
52
53
|
});
|
|
53
|
-
server.tool("get_threads_post", `Get a
|
|
54
|
+
server.tool("get_threads_post", `Get a Threads post by id or URL. Does NOT return replies (use get_threads_post_comments). Pass post_id or url. 2 credits.`, {
|
|
54
55
|
post_id: z.string().min(1).optional()
|
|
55
|
-
.describe("
|
|
56
|
+
.describe("Post id. Either this or url required."),
|
|
56
57
|
url: z.string().url().optional()
|
|
57
|
-
.describe("
|
|
58
|
+
.describe("threads.net post URL. Either this or post_id required."),
|
|
58
59
|
}, async (params) => {
|
|
59
60
|
try {
|
|
60
61
|
const data = await getClient().post("/api/v1/threads/post", params);
|
|
61
|
-
return
|
|
62
|
+
return trimResponse(data);
|
|
62
63
|
}
|
|
63
64
|
catch (err) {
|
|
64
65
|
return handleApiError(err);
|
|
65
66
|
}
|
|
66
67
|
});
|
|
67
|
-
server.tool("get_threads_post_comments", `List
|
|
68
|
+
server.tool("get_threads_post_comments", `List replies to a Threads post. Cursor-paginated. Takes post_id only (no URL form). 2 credits/page.`, {
|
|
68
69
|
post_id: z.string().min(1)
|
|
69
|
-
.describe("
|
|
70
|
+
.describe("Post id (no URL form on this endpoint)."),
|
|
70
71
|
cursor: cursorField,
|
|
71
72
|
}, async (params) => {
|
|
72
73
|
try {
|
|
73
74
|
const data = await getClient().post("/api/v1/threads/post/comments", params);
|
|
74
|
-
return
|
|
75
|
+
return trimResponse(data);
|
|
75
76
|
}
|
|
76
77
|
catch (err) {
|
|
77
78
|
return handleApiError(err);
|
|
78
79
|
}
|
|
79
80
|
});
|
|
80
|
-
server.tool("search_threads_users", `Search Threads
|
|
81
|
+
server.tool("search_threads_users", `Search Threads profiles by name/handle. People search ONLY (no post/content search on Threads). Use to resolve a handle to user_id for cheaper calls. 2 credits.`, {
|
|
81
82
|
query: z.string().min(1).max(200)
|
|
82
|
-
.describe("Name or handle to search for
|
|
83
|
+
.describe("Name or handle to search for."),
|
|
83
84
|
}, async (params) => {
|
|
84
85
|
try {
|
|
85
86
|
const data = await getClient().post("/api/v1/threads/search/users", params);
|
|
86
|
-
return
|
|
87
|
+
return trimResponse(data);
|
|
87
88
|
}
|
|
88
89
|
catch (err) {
|
|
89
90
|
return handleApiError(err);
|