@yawlabs/lemonsqueezy-mcp 0.2.1 → 0.4.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 +51 -0
- package/dist/index.js +555 -191
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -21010,19 +21010,219 @@ var StdioServerTransport = class {
|
|
|
21010
21010
|
}
|
|
21011
21011
|
};
|
|
21012
21012
|
|
|
21013
|
-
// src/
|
|
21014
|
-
var
|
|
21013
|
+
// src/guardrails.ts
|
|
21014
|
+
var GuardrailError = class extends Error {
|
|
21015
|
+
constructor(message) {
|
|
21016
|
+
super(message);
|
|
21017
|
+
this.name = "GuardrailError";
|
|
21018
|
+
}
|
|
21019
|
+
};
|
|
21020
|
+
var cachedOptions = null;
|
|
21021
|
+
var destructiveTimestamps = [];
|
|
21022
|
+
function readNumber(name, raw) {
|
|
21023
|
+
if (raw === void 0 || raw.trim() === "") return null;
|
|
21024
|
+
const n = Number(raw);
|
|
21025
|
+
if (!Number.isFinite(n) || n < 0) {
|
|
21026
|
+
throw new Error(`${name} must be a non-negative number (got ${JSON.stringify(raw)})`);
|
|
21027
|
+
}
|
|
21028
|
+
return n;
|
|
21029
|
+
}
|
|
21030
|
+
function loadOptions() {
|
|
21031
|
+
if (cachedOptions) return cachedOptions;
|
|
21032
|
+
const allowed = process.env.LEMONSQUEEZY_ALLOWED_STORE_IDS;
|
|
21033
|
+
const allowedSet = allowed ? new Set(
|
|
21034
|
+
allowed.split(",").map((s) => s.trim()).filter(Boolean)
|
|
21035
|
+
) : null;
|
|
21036
|
+
cachedOptions = {
|
|
21037
|
+
allowedStoreIds: allowedSet && allowedSet.size > 0 ? allowedSet : null,
|
|
21038
|
+
maxRefundAmountCents: readNumber(
|
|
21039
|
+
"LEMONSQUEEZY_MAX_REFUND_AMOUNT_CENTS",
|
|
21040
|
+
process.env.LEMONSQUEEZY_MAX_REFUND_AMOUNT_CENTS
|
|
21041
|
+
),
|
|
21042
|
+
rateLimitPerMinute: readNumber(
|
|
21043
|
+
"LEMONSQUEEZY_DESTRUCTIVE_RATE_LIMIT",
|
|
21044
|
+
process.env.LEMONSQUEEZY_DESTRUCTIVE_RATE_LIMIT
|
|
21045
|
+
)
|
|
21046
|
+
};
|
|
21047
|
+
return cachedOptions;
|
|
21048
|
+
}
|
|
21049
|
+
function checkStoreAllowed(storeId) {
|
|
21050
|
+
if (!storeId) return;
|
|
21051
|
+
const o = loadOptions();
|
|
21052
|
+
if (!o.allowedStoreIds) return;
|
|
21053
|
+
if (!o.allowedStoreIds.has(String(storeId))) {
|
|
21054
|
+
throw new GuardrailError(`Store ID ${storeId} is not in LEMONSQUEEZY_ALLOWED_STORE_IDS allowlist`);
|
|
21055
|
+
}
|
|
21056
|
+
}
|
|
21057
|
+
function checkRefundAmount(cents) {
|
|
21058
|
+
const o = loadOptions();
|
|
21059
|
+
if (o.maxRefundAmountCents === null) return;
|
|
21060
|
+
if (cents > o.maxRefundAmountCents) {
|
|
21061
|
+
throw new GuardrailError(
|
|
21062
|
+
`Refund amount ${cents} cents exceeds LEMONSQUEEZY_MAX_REFUND_AMOUNT_CENTS (${o.maxRefundAmountCents})`
|
|
21063
|
+
);
|
|
21064
|
+
}
|
|
21065
|
+
}
|
|
21066
|
+
function checkDestructiveRateLimit(now = Date.now()) {
|
|
21067
|
+
const o = loadOptions();
|
|
21068
|
+
if (o.rateLimitPerMinute === null) return;
|
|
21069
|
+
const cutoff = now - 6e4;
|
|
21070
|
+
destructiveTimestamps = destructiveTimestamps.filter((t) => t > cutoff);
|
|
21071
|
+
if (destructiveTimestamps.length >= o.rateLimitPerMinute) {
|
|
21072
|
+
throw new GuardrailError(`Destructive call rate limit exceeded (${o.rateLimitPerMinute}/min). Wait and retry.`);
|
|
21073
|
+
}
|
|
21074
|
+
destructiveTimestamps.push(now);
|
|
21075
|
+
}
|
|
21076
|
+
|
|
21077
|
+
// src/logger.ts
|
|
21078
|
+
function isEnabled() {
|
|
21079
|
+
return process.env.LEMONSQUEEZY_LOG === "json";
|
|
21080
|
+
}
|
|
21081
|
+
function logEvent(entry) {
|
|
21082
|
+
if (!isEnabled()) return;
|
|
21083
|
+
try {
|
|
21084
|
+
const line = JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), ...entry });
|
|
21085
|
+
process.stderr.write(`${line}
|
|
21086
|
+
`);
|
|
21087
|
+
} catch {
|
|
21088
|
+
}
|
|
21089
|
+
}
|
|
21090
|
+
|
|
21091
|
+
// src/retry.ts
|
|
21015
21092
|
var REQUEST_TIMEOUT_MS = 3e4;
|
|
21016
|
-
|
|
21093
|
+
var DEFAULT_RETRY_WAIT_MS = 1e3;
|
|
21094
|
+
var MAX_RETRY_WAIT_MS = 3e4;
|
|
21095
|
+
var DEFAULT_MAX_ATTEMPTS = 4;
|
|
21096
|
+
var BASE_BACKOFF_MS = 250;
|
|
21097
|
+
var JITTER_FRACTION = 0.25;
|
|
21098
|
+
function parseRetryAfterMs(header) {
|
|
21099
|
+
if (!header) return DEFAULT_RETRY_WAIT_MS;
|
|
21100
|
+
const trimmed = header.trim();
|
|
21101
|
+
const seconds = Number(trimmed);
|
|
21102
|
+
if (!Number.isNaN(seconds)) {
|
|
21103
|
+
return seconds >= 0 ? seconds * 1e3 : DEFAULT_RETRY_WAIT_MS;
|
|
21104
|
+
}
|
|
21105
|
+
const dateMs = Date.parse(trimmed);
|
|
21106
|
+
if (Number.isFinite(dateMs)) return Math.max(0, dateMs - Date.now());
|
|
21107
|
+
return DEFAULT_RETRY_WAIT_MS;
|
|
21108
|
+
}
|
|
21109
|
+
function isAbortTimeoutError(err) {
|
|
21110
|
+
if (!err || typeof err !== "object") return false;
|
|
21111
|
+
const e = err;
|
|
21112
|
+
return e.name === "TimeoutError" || e.name === "AbortError" || e.code === "ABORT_ERR";
|
|
21113
|
+
}
|
|
21114
|
+
function backoffDelay(attempt, rand = Math.random) {
|
|
21115
|
+
const base = BASE_BACKOFF_MS * 2 ** (attempt - 1);
|
|
21116
|
+
const jitter = rand() * base * JITTER_FRACTION;
|
|
21117
|
+
return Math.min(base + jitter, MAX_RETRY_WAIT_MS);
|
|
21118
|
+
}
|
|
21119
|
+
var defaultSleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
21120
|
+
async function fetchWithRetry(url, init, opts) {
|
|
21121
|
+
const maxAttempts = opts.maxAttempts ?? DEFAULT_MAX_ATTEMPTS;
|
|
21122
|
+
const sleep = opts.sleep ?? defaultSleep;
|
|
21123
|
+
const fetchImpl = opts.fetchImpl ?? fetch;
|
|
21124
|
+
const rand = opts.rand ?? Math.random;
|
|
21125
|
+
let lastError;
|
|
21126
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
21127
|
+
try {
|
|
21128
|
+
const res = await fetchImpl(url, { ...init, signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS) });
|
|
21129
|
+
if (res.status === 429) {
|
|
21130
|
+
if (attempt === maxAttempts) return res;
|
|
21131
|
+
const waitMs = parseRetryAfterMs(res.headers.get("retry-after"));
|
|
21132
|
+
if (waitMs > MAX_RETRY_WAIT_MS) return res;
|
|
21133
|
+
await sleep(waitMs);
|
|
21134
|
+
continue;
|
|
21135
|
+
}
|
|
21136
|
+
if (res.status >= 500 && res.status < 600 && opts.idempotent && attempt < maxAttempts) {
|
|
21137
|
+
await sleep(backoffDelay(attempt, rand));
|
|
21138
|
+
continue;
|
|
21139
|
+
}
|
|
21140
|
+
return res;
|
|
21141
|
+
} catch (err) {
|
|
21142
|
+
lastError = err;
|
|
21143
|
+
if (isAbortTimeoutError(err)) {
|
|
21144
|
+
if (!opts.idempotent || attempt === maxAttempts) throw err;
|
|
21145
|
+
await sleep(backoffDelay(attempt, rand));
|
|
21146
|
+
continue;
|
|
21147
|
+
}
|
|
21148
|
+
if (err instanceof TypeError && opts.idempotent && attempt < maxAttempts) {
|
|
21149
|
+
await sleep(backoffDelay(attempt, rand));
|
|
21150
|
+
continue;
|
|
21151
|
+
}
|
|
21152
|
+
throw err;
|
|
21153
|
+
}
|
|
21154
|
+
}
|
|
21155
|
+
throw lastError ?? new Error("fetchWithRetry exhausted attempts");
|
|
21156
|
+
}
|
|
21157
|
+
|
|
21158
|
+
// src/secret.ts
|
|
21159
|
+
import { execFile } from "node:child_process";
|
|
21160
|
+
import { promisify } from "node:util";
|
|
21161
|
+
var execFileAsync = promisify(execFile);
|
|
21162
|
+
var CACHE_TTL_MS = 60 * 60 * 1e3;
|
|
21163
|
+
var COMMAND_TIMEOUT_MS = 1e4;
|
|
21164
|
+
var COMMAND_MAX_BUFFER = 64 * 1024;
|
|
21165
|
+
var cached2 = null;
|
|
21166
|
+
function parseCommand(cmd) {
|
|
21167
|
+
const parts = [];
|
|
21168
|
+
let current = "";
|
|
21169
|
+
let quote = null;
|
|
21170
|
+
for (const ch of cmd) {
|
|
21171
|
+
if (quote) {
|
|
21172
|
+
if (ch === quote) {
|
|
21173
|
+
quote = null;
|
|
21174
|
+
continue;
|
|
21175
|
+
}
|
|
21176
|
+
current += ch;
|
|
21177
|
+
} else if (ch === '"' || ch === "'") {
|
|
21178
|
+
quote = ch;
|
|
21179
|
+
} else if (ch === " " || ch === " ") {
|
|
21180
|
+
if (current) {
|
|
21181
|
+
parts.push(current);
|
|
21182
|
+
current = "";
|
|
21183
|
+
}
|
|
21184
|
+
} else {
|
|
21185
|
+
current += ch;
|
|
21186
|
+
}
|
|
21187
|
+
}
|
|
21188
|
+
if (quote) throw new Error("LEMONSQUEEZY_API_KEY_COMMAND has an unterminated quote");
|
|
21189
|
+
if (current) parts.push(current);
|
|
21190
|
+
if (parts.length === 0) throw new Error("LEMONSQUEEZY_API_KEY_COMMAND is empty");
|
|
21191
|
+
return { command: parts[0], args: parts.slice(1) };
|
|
21192
|
+
}
|
|
21193
|
+
async function loadApiKey() {
|
|
21194
|
+
if (cached2 && cached2.expiresAt > Date.now()) return cached2.key;
|
|
21195
|
+
const cmdStr = process.env.LEMONSQUEEZY_API_KEY_COMMAND;
|
|
21196
|
+
if (cmdStr && cmdStr.trim() !== "") {
|
|
21197
|
+
const { command, args } = parseCommand(cmdStr);
|
|
21198
|
+
let stdout;
|
|
21199
|
+
try {
|
|
21200
|
+
const result = await execFileAsync(command, args, {
|
|
21201
|
+
timeout: COMMAND_TIMEOUT_MS,
|
|
21202
|
+
maxBuffer: COMMAND_MAX_BUFFER
|
|
21203
|
+
});
|
|
21204
|
+
stdout = result.stdout;
|
|
21205
|
+
} catch (err) {
|
|
21206
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
21207
|
+
throw new Error(`LEMONSQUEEZY_API_KEY_COMMAND failed: ${msg}`);
|
|
21208
|
+
}
|
|
21209
|
+
const key2 = stdout.trim();
|
|
21210
|
+
if (!key2) throw new Error("LEMONSQUEEZY_API_KEY_COMMAND produced empty output");
|
|
21211
|
+
cached2 = { key: key2, expiresAt: Date.now() + CACHE_TTL_MS };
|
|
21212
|
+
return key2;
|
|
21213
|
+
}
|
|
21017
21214
|
const key = process.env.LEMONSQUEEZY_API_KEY;
|
|
21018
21215
|
if (!key) {
|
|
21019
|
-
throw new Error("LEMONSQUEEZY_API_KEY environment variable is required.");
|
|
21216
|
+
throw new Error("LEMONSQUEEZY_API_KEY or LEMONSQUEEZY_API_KEY_COMMAND environment variable is required.");
|
|
21020
21217
|
}
|
|
21021
21218
|
if (key.trim() === "") {
|
|
21022
21219
|
throw new Error("LEMONSQUEEZY_API_KEY is set but empty. Provide a valid API key.");
|
|
21023
21220
|
}
|
|
21024
21221
|
return key;
|
|
21025
21222
|
}
|
|
21223
|
+
|
|
21224
|
+
// src/api.ts
|
|
21225
|
+
var BASE_URL = "https://api.lemonsqueezy.com/v1";
|
|
21026
21226
|
function buildQuery(params) {
|
|
21027
21227
|
if (!params) return "";
|
|
21028
21228
|
const parts = [];
|
|
@@ -21044,9 +21244,14 @@ function buildQuery(params) {
|
|
|
21044
21244
|
}
|
|
21045
21245
|
return parts.length > 0 ? `?${parts.join("&")}` : "";
|
|
21046
21246
|
}
|
|
21247
|
+
function decorateError(error2, requestId) {
|
|
21248
|
+
return requestId ? `${error2} (request_id: ${requestId})` : error2;
|
|
21249
|
+
}
|
|
21047
21250
|
async function apiRequest(method, path, body) {
|
|
21251
|
+
const start = Date.now();
|
|
21252
|
+
const apiKey = await loadApiKey();
|
|
21048
21253
|
const headers = {
|
|
21049
|
-
Authorization: `Bearer ${
|
|
21254
|
+
Authorization: `Bearer ${apiKey}`,
|
|
21050
21255
|
Accept: "application/vnd.api+json"
|
|
21051
21256
|
};
|
|
21052
21257
|
let fetchBody;
|
|
@@ -21055,70 +21260,163 @@ async function apiRequest(method, path, body) {
|
|
|
21055
21260
|
fetchBody = JSON.stringify(body);
|
|
21056
21261
|
}
|
|
21057
21262
|
const url = path.startsWith("http") ? path : `${BASE_URL}${path}`;
|
|
21263
|
+
const idempotent = method === "GET" || method === "DELETE";
|
|
21058
21264
|
let res;
|
|
21059
21265
|
try {
|
|
21060
|
-
res = await
|
|
21061
|
-
method,
|
|
21062
|
-
headers,
|
|
21063
|
-
body: fetchBody,
|
|
21064
|
-
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
|
|
21065
|
-
});
|
|
21266
|
+
res = await fetchWithRetry(url, { method, headers, body: fetchBody }, { idempotent });
|
|
21066
21267
|
} catch (err) {
|
|
21067
|
-
|
|
21068
|
-
|
|
21069
|
-
|
|
21268
|
+
const latency_ms2 = Date.now() - start;
|
|
21269
|
+
if (isAbortTimeoutError(err)) {
|
|
21270
|
+
const error2 = `Request timed out after ${REQUEST_TIMEOUT_MS / 1e3}s`;
|
|
21271
|
+
logEvent({ event: "http_call", method, path, status: "timeout", latency_ms: latency_ms2, error: error2 });
|
|
21272
|
+
return { ok: false, status: 0, error: error2 };
|
|
21273
|
+
}
|
|
21274
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
21275
|
+
logEvent({ event: "http_call", method, path, status: "network_error", latency_ms: latency_ms2, error: message });
|
|
21070
21276
|
throw err;
|
|
21071
21277
|
}
|
|
21278
|
+
const latency_ms = Date.now() - start;
|
|
21279
|
+
const requestId = res.headers.get("x-request-id") ?? void 0;
|
|
21072
21280
|
if (!res.ok) {
|
|
21073
21281
|
const errorBody = await res.text();
|
|
21074
21282
|
try {
|
|
21075
21283
|
const parsed = JSON.parse(errorBody);
|
|
21076
|
-
|
|
21284
|
+
const detail = parsed.errors?.[0]?.detail ?? errorBody;
|
|
21285
|
+
logEvent({
|
|
21286
|
+
event: "http_call",
|
|
21287
|
+
method,
|
|
21288
|
+
path,
|
|
21289
|
+
status: res.status,
|
|
21290
|
+
latency_ms,
|
|
21291
|
+
request_id: requestId,
|
|
21292
|
+
error: detail
|
|
21293
|
+
});
|
|
21294
|
+
return {
|
|
21295
|
+
ok: false,
|
|
21296
|
+
status: res.status,
|
|
21297
|
+
data: parsed,
|
|
21298
|
+
error: decorateError(detail, requestId),
|
|
21299
|
+
requestId
|
|
21300
|
+
};
|
|
21077
21301
|
} catch {
|
|
21078
|
-
|
|
21302
|
+
logEvent({
|
|
21303
|
+
event: "http_call",
|
|
21304
|
+
method,
|
|
21305
|
+
path,
|
|
21306
|
+
status: res.status,
|
|
21307
|
+
latency_ms,
|
|
21308
|
+
request_id: requestId,
|
|
21309
|
+
error: errorBody
|
|
21310
|
+
});
|
|
21311
|
+
return {
|
|
21312
|
+
ok: false,
|
|
21313
|
+
status: res.status,
|
|
21314
|
+
error: decorateError(errorBody, requestId),
|
|
21315
|
+
requestId
|
|
21316
|
+
};
|
|
21079
21317
|
}
|
|
21080
21318
|
}
|
|
21319
|
+
logEvent({
|
|
21320
|
+
event: "http_call",
|
|
21321
|
+
method,
|
|
21322
|
+
path,
|
|
21323
|
+
status: res.status,
|
|
21324
|
+
latency_ms,
|
|
21325
|
+
request_id: requestId
|
|
21326
|
+
});
|
|
21081
21327
|
if (res.status === 204) {
|
|
21082
|
-
return { ok: true, status: res.status };
|
|
21328
|
+
return { ok: true, status: res.status, requestId };
|
|
21083
21329
|
}
|
|
21084
21330
|
const data = await res.json();
|
|
21085
|
-
return { ok: true, status: res.status, data };
|
|
21331
|
+
return { ok: true, status: res.status, data, requestId };
|
|
21086
21332
|
}
|
|
21087
21333
|
async function licenseRequest(path, body) {
|
|
21088
21334
|
const url = `${BASE_URL}${path}`;
|
|
21335
|
+
const start = Date.now();
|
|
21089
21336
|
let res;
|
|
21090
21337
|
try {
|
|
21091
|
-
res = await
|
|
21092
|
-
|
|
21093
|
-
|
|
21094
|
-
|
|
21095
|
-
|
|
21338
|
+
res = await fetchWithRetry(
|
|
21339
|
+
url,
|
|
21340
|
+
{
|
|
21341
|
+
method: "POST",
|
|
21342
|
+
headers: {
|
|
21343
|
+
Accept: "application/json",
|
|
21344
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
21345
|
+
},
|
|
21346
|
+
body: new URLSearchParams(body)
|
|
21096
21347
|
},
|
|
21097
|
-
|
|
21098
|
-
|
|
21099
|
-
});
|
|
21348
|
+
{ idempotent: false }
|
|
21349
|
+
);
|
|
21100
21350
|
} catch (err) {
|
|
21101
|
-
|
|
21102
|
-
|
|
21103
|
-
|
|
21351
|
+
const latency_ms2 = Date.now() - start;
|
|
21352
|
+
if (isAbortTimeoutError(err)) {
|
|
21353
|
+
const error2 = `Request timed out after ${REQUEST_TIMEOUT_MS / 1e3}s`;
|
|
21354
|
+
logEvent({ event: "http_call", method: "POST", path, status: "timeout", latency_ms: latency_ms2, error: error2 });
|
|
21355
|
+
return { ok: false, status: 0, error: error2 };
|
|
21356
|
+
}
|
|
21357
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
21358
|
+
logEvent({
|
|
21359
|
+
event: "http_call",
|
|
21360
|
+
method: "POST",
|
|
21361
|
+
path,
|
|
21362
|
+
status: "network_error",
|
|
21363
|
+
latency_ms: latency_ms2,
|
|
21364
|
+
error: message
|
|
21365
|
+
});
|
|
21104
21366
|
throw err;
|
|
21105
21367
|
}
|
|
21368
|
+
const latency_ms = Date.now() - start;
|
|
21369
|
+
const requestId = res.headers.get("x-request-id") ?? void 0;
|
|
21106
21370
|
if (!res.ok) {
|
|
21107
21371
|
const errorBody = await res.text();
|
|
21108
21372
|
try {
|
|
21109
21373
|
const parsed = JSON.parse(errorBody);
|
|
21374
|
+
const p = parsed;
|
|
21375
|
+
const detail = p.errors?.[0]?.detail ?? p.error ?? errorBody;
|
|
21376
|
+
logEvent({
|
|
21377
|
+
event: "http_call",
|
|
21378
|
+
method: "POST",
|
|
21379
|
+
path,
|
|
21380
|
+
status: res.status,
|
|
21381
|
+
latency_ms,
|
|
21382
|
+
request_id: requestId,
|
|
21383
|
+
error: detail
|
|
21384
|
+
});
|
|
21110
21385
|
return {
|
|
21111
21386
|
ok: false,
|
|
21112
21387
|
status: res.status,
|
|
21113
21388
|
data: parsed,
|
|
21114
|
-
error:
|
|
21389
|
+
error: decorateError(detail, requestId),
|
|
21390
|
+
requestId
|
|
21115
21391
|
};
|
|
21116
21392
|
} catch {
|
|
21117
|
-
|
|
21393
|
+
logEvent({
|
|
21394
|
+
event: "http_call",
|
|
21395
|
+
method: "POST",
|
|
21396
|
+
path,
|
|
21397
|
+
status: res.status,
|
|
21398
|
+
latency_ms,
|
|
21399
|
+
request_id: requestId,
|
|
21400
|
+
error: errorBody
|
|
21401
|
+
});
|
|
21402
|
+
return {
|
|
21403
|
+
ok: false,
|
|
21404
|
+
status: res.status,
|
|
21405
|
+
error: decorateError(errorBody, requestId),
|
|
21406
|
+
requestId
|
|
21407
|
+
};
|
|
21118
21408
|
}
|
|
21119
21409
|
}
|
|
21410
|
+
logEvent({
|
|
21411
|
+
event: "http_call",
|
|
21412
|
+
method: "POST",
|
|
21413
|
+
path,
|
|
21414
|
+
status: res.status,
|
|
21415
|
+
latency_ms,
|
|
21416
|
+
request_id: requestId
|
|
21417
|
+
});
|
|
21120
21418
|
const data = await res.json();
|
|
21121
|
-
return { ok: true, status: res.status, data };
|
|
21419
|
+
return { ok: true, status: res.status, data, requestId };
|
|
21122
21420
|
}
|
|
21123
21421
|
function getHandler(endpoint, idField) {
|
|
21124
21422
|
return async (input) => {
|
|
@@ -21154,6 +21452,44 @@ async function apiDelete(path) {
|
|
|
21154
21452
|
return apiRequest("DELETE", path);
|
|
21155
21453
|
}
|
|
21156
21454
|
|
|
21455
|
+
// src/tools/affiliates.ts
|
|
21456
|
+
var affiliateTools = [
|
|
21457
|
+
{
|
|
21458
|
+
name: "ls_get_affiliate",
|
|
21459
|
+
description: "Get a specific affiliate by ID, including commission rate, status, and earnings.",
|
|
21460
|
+
annotations: {
|
|
21461
|
+
title: "Get affiliate",
|
|
21462
|
+
readOnlyHint: true,
|
|
21463
|
+
destructiveHint: false,
|
|
21464
|
+
idempotentHint: true,
|
|
21465
|
+
openWorldHint: true
|
|
21466
|
+
},
|
|
21467
|
+
inputSchema: external_exports.object({
|
|
21468
|
+
affiliateId: external_exports.string().max(1e4).describe("The affiliate ID"),
|
|
21469
|
+
include: external_exports.string().max(1e4).optional().describe("Comma-separated related resources to include (e.g. 'store,user')")
|
|
21470
|
+
}),
|
|
21471
|
+
handler: getHandler("/affiliates", "affiliateId")
|
|
21472
|
+
},
|
|
21473
|
+
{
|
|
21474
|
+
name: "ls_list_affiliates",
|
|
21475
|
+
description: "List all affiliates for the authenticated user's stores, optionally filtered by user email. Results are paginated \u2014 check meta.page in the response for currentPage, lastPage, and total.",
|
|
21476
|
+
annotations: {
|
|
21477
|
+
title: "List affiliates",
|
|
21478
|
+
readOnlyHint: true,
|
|
21479
|
+
destructiveHint: false,
|
|
21480
|
+
idempotentHint: true,
|
|
21481
|
+
openWorldHint: true
|
|
21482
|
+
},
|
|
21483
|
+
inputSchema: external_exports.object({
|
|
21484
|
+
userEmail: external_exports.string().email().max(320).optional().describe("Filter by affiliate's user email"),
|
|
21485
|
+
include: external_exports.string().max(1e4).optional().describe("Comma-separated related resources to include (e.g. 'store,user')"),
|
|
21486
|
+
pageNumber: external_exports.number().int().min(1).optional().describe("Page number (1-indexed)"),
|
|
21487
|
+
pageSize: external_exports.number().int().min(1).max(100).optional().describe("Results per page (1-100)")
|
|
21488
|
+
}),
|
|
21489
|
+
handler: listHandler("/affiliates", { userEmail: "user_email" })
|
|
21490
|
+
}
|
|
21491
|
+
];
|
|
21492
|
+
|
|
21157
21493
|
// src/tools/checkouts.ts
|
|
21158
21494
|
var checkoutTools = [
|
|
21159
21495
|
{
|
|
@@ -21167,8 +21503,8 @@ var checkoutTools = [
|
|
|
21167
21503
|
openWorldHint: true
|
|
21168
21504
|
},
|
|
21169
21505
|
inputSchema: external_exports.object({
|
|
21170
|
-
checkoutId: external_exports.string().describe("The checkout ID"),
|
|
21171
|
-
include: external_exports.string().optional().describe("Comma-separated related resources to include (e.g. 'store,variant')")
|
|
21506
|
+
checkoutId: external_exports.string().max(1e4).describe("The checkout ID"),
|
|
21507
|
+
include: external_exports.string().max(1e4).optional().describe("Comma-separated related resources to include (e.g. 'store,variant')")
|
|
21172
21508
|
}),
|
|
21173
21509
|
handler: getHandler("/checkouts", "checkoutId")
|
|
21174
21510
|
},
|
|
@@ -21183,9 +21519,9 @@ var checkoutTools = [
|
|
|
21183
21519
|
openWorldHint: true
|
|
21184
21520
|
},
|
|
21185
21521
|
inputSchema: external_exports.object({
|
|
21186
|
-
storeId: external_exports.string().optional().describe("Filter by store ID"),
|
|
21187
|
-
variantId: external_exports.string().optional().describe("Filter by variant ID"),
|
|
21188
|
-
include: external_exports.string().optional().describe("Comma-separated related resources to include (e.g. 'store,variant')"),
|
|
21522
|
+
storeId: external_exports.string().max(1e4).optional().describe("Filter by store ID"),
|
|
21523
|
+
variantId: external_exports.string().max(1e4).optional().describe("Filter by variant ID"),
|
|
21524
|
+
include: external_exports.string().max(1e4).optional().describe("Comma-separated related resources to include (e.g. 'store,variant')"),
|
|
21189
21525
|
pageNumber: external_exports.number().int().min(1).optional().describe("Page number (1-indexed)"),
|
|
21190
21526
|
pageSize: external_exports.number().int().min(1).max(100).optional().describe("Results per page (1-100)")
|
|
21191
21527
|
}),
|
|
@@ -21202,18 +21538,18 @@ var checkoutTools = [
|
|
|
21202
21538
|
openWorldHint: true
|
|
21203
21539
|
},
|
|
21204
21540
|
inputSchema: external_exports.object({
|
|
21205
|
-
storeId: external_exports.string().describe("The store ID"),
|
|
21206
|
-
variantId: external_exports.string().describe("The variant ID for the product being purchased"),
|
|
21541
|
+
storeId: external_exports.string().max(1e4).describe("The store ID"),
|
|
21542
|
+
variantId: external_exports.string().max(1e4).describe("The variant ID for the product being purchased"),
|
|
21207
21543
|
customPrice: external_exports.number().int().min(0).optional().describe("Custom price in cents (overrides the variant price)"),
|
|
21208
21544
|
enabledVariants: external_exports.array(external_exports.string()).optional().describe("Array of variant IDs to show on the checkout (for products with multiple variants)"),
|
|
21209
|
-
email: external_exports.string().optional().describe("Prefill customer email"),
|
|
21210
|
-
name: external_exports.string().optional().describe("Prefill customer name"),
|
|
21211
|
-
billingAddressCountry: external_exports.string().optional().describe("Prefill billing country (ISO 3166-1 alpha-2)"),
|
|
21212
|
-
billingAddressZip: external_exports.string().optional().describe("Prefill billing ZIP/postal code"),
|
|
21213
|
-
taxNumber: external_exports.string().optional().describe("Prefill tax/VAT number"),
|
|
21214
|
-
discountCode: external_exports.string().optional().describe("Pre-apply a discount code"),
|
|
21545
|
+
email: external_exports.string().max(1e4).optional().describe("Prefill customer email"),
|
|
21546
|
+
name: external_exports.string().max(1e4).optional().describe("Prefill customer name"),
|
|
21547
|
+
billingAddressCountry: external_exports.string().max(1e4).optional().describe("Prefill billing country (ISO 3166-1 alpha-2)"),
|
|
21548
|
+
billingAddressZip: external_exports.string().max(1e4).optional().describe("Prefill billing ZIP/postal code"),
|
|
21549
|
+
taxNumber: external_exports.string().max(1e4).optional().describe("Prefill tax/VAT number"),
|
|
21550
|
+
discountCode: external_exports.string().max(1e4).optional().describe("Pre-apply a discount code"),
|
|
21215
21551
|
customData: external_exports.record(external_exports.unknown()).optional().describe("Custom data object to attach to the order"),
|
|
21216
|
-
expiresAt: external_exports.string().optional().describe("Checkout expiry date (ISO 8601 format)")
|
|
21552
|
+
expiresAt: external_exports.string().max(1e4).optional().describe("Checkout expiry date (ISO 8601 format)")
|
|
21217
21553
|
}),
|
|
21218
21554
|
handler: async (input) => {
|
|
21219
21555
|
const attributes = {};
|
|
@@ -21264,8 +21600,8 @@ var customerTools = [
|
|
|
21264
21600
|
openWorldHint: true
|
|
21265
21601
|
},
|
|
21266
21602
|
inputSchema: external_exports.object({
|
|
21267
|
-
customerId: external_exports.string().describe("The customer ID"),
|
|
21268
|
-
include: external_exports.string().optional().describe("Comma-separated related resources to include (e.g. 'store,orders,subscriptions,license-keys')")
|
|
21603
|
+
customerId: external_exports.string().max(1e4).describe("The customer ID"),
|
|
21604
|
+
include: external_exports.string().max(1e4).optional().describe("Comma-separated related resources to include (e.g. 'store,orders,subscriptions,license-keys')")
|
|
21269
21605
|
}),
|
|
21270
21606
|
handler: getHandler("/customers", "customerId")
|
|
21271
21607
|
},
|
|
@@ -21280,9 +21616,9 @@ var customerTools = [
|
|
|
21280
21616
|
openWorldHint: true
|
|
21281
21617
|
},
|
|
21282
21618
|
inputSchema: external_exports.object({
|
|
21283
|
-
storeId: external_exports.string().optional().describe("Filter by store ID"),
|
|
21284
|
-
email: external_exports.string().optional().describe("Filter by customer email"),
|
|
21285
|
-
include: external_exports.string().optional().describe("Comma-separated related resources to include (e.g. 'store,orders,subscriptions,license-keys')"),
|
|
21619
|
+
storeId: external_exports.string().max(1e4).optional().describe("Filter by store ID"),
|
|
21620
|
+
email: external_exports.string().max(1e4).optional().describe("Filter by customer email"),
|
|
21621
|
+
include: external_exports.string().max(1e4).optional().describe("Comma-separated related resources to include (e.g. 'store,orders,subscriptions,license-keys')"),
|
|
21286
21622
|
pageNumber: external_exports.number().int().min(1).optional().describe("Page number (1-indexed)"),
|
|
21287
21623
|
pageSize: external_exports.number().int().min(1).max(100).optional().describe("Results per page (1-100)")
|
|
21288
21624
|
}),
|
|
@@ -21299,12 +21635,12 @@ var customerTools = [
|
|
|
21299
21635
|
openWorldHint: true
|
|
21300
21636
|
},
|
|
21301
21637
|
inputSchema: external_exports.object({
|
|
21302
|
-
storeId: external_exports.string().describe("The store ID to create the customer in"),
|
|
21303
|
-
name: external_exports.string().describe("Customer's full name"),
|
|
21304
|
-
email: external_exports.string().describe("Customer's email address"),
|
|
21305
|
-
city: external_exports.string().optional().describe("Customer's city"),
|
|
21306
|
-
region: external_exports.string().optional().describe("Customer's region/state"),
|
|
21307
|
-
country: external_exports.string().optional().describe("Customer's country (ISO 3166-1 alpha-2 code, e.g. 'US')")
|
|
21638
|
+
storeId: external_exports.string().max(1e4).describe("The store ID to create the customer in"),
|
|
21639
|
+
name: external_exports.string().max(1e4).describe("Customer's full name"),
|
|
21640
|
+
email: external_exports.string().max(1e4).describe("Customer's email address"),
|
|
21641
|
+
city: external_exports.string().max(1e4).optional().describe("Customer's city"),
|
|
21642
|
+
region: external_exports.string().max(1e4).optional().describe("Customer's region/state"),
|
|
21643
|
+
country: external_exports.string().max(1e4).optional().describe("Customer's country (ISO 3166-1 alpha-2 code, e.g. 'US')")
|
|
21308
21644
|
}),
|
|
21309
21645
|
handler: async (input) => {
|
|
21310
21646
|
const attributes = {
|
|
@@ -21336,13 +21672,13 @@ var customerTools = [
|
|
|
21336
21672
|
openWorldHint: true
|
|
21337
21673
|
},
|
|
21338
21674
|
inputSchema: external_exports.object({
|
|
21339
|
-
customerId: external_exports.string().describe("The customer ID to update"),
|
|
21340
|
-
name: external_exports.string().optional().describe("New name"),
|
|
21341
|
-
email: external_exports.string().optional().describe("New email"),
|
|
21342
|
-
city: external_exports.string().optional().describe("New city"),
|
|
21343
|
-
region: external_exports.string().optional().describe("New region/state"),
|
|
21344
|
-
country: external_exports.string().optional().describe("New country (ISO 3166-1 alpha-2 code)"),
|
|
21345
|
-
status: external_exports.string().optional().describe("New status ('archived' to archive the customer)")
|
|
21675
|
+
customerId: external_exports.string().max(1e4).describe("The customer ID to update"),
|
|
21676
|
+
name: external_exports.string().max(1e4).optional().describe("New name"),
|
|
21677
|
+
email: external_exports.string().max(1e4).optional().describe("New email"),
|
|
21678
|
+
city: external_exports.string().max(1e4).optional().describe("New city"),
|
|
21679
|
+
region: external_exports.string().max(1e4).optional().describe("New region/state"),
|
|
21680
|
+
country: external_exports.string().max(1e4).optional().describe("New country (ISO 3166-1 alpha-2 code)"),
|
|
21681
|
+
status: external_exports.string().max(1e4).optional().describe("New status ('archived' to archive the customer)")
|
|
21346
21682
|
}),
|
|
21347
21683
|
handler: async (input) => {
|
|
21348
21684
|
const attributes = {};
|
|
@@ -21372,7 +21708,7 @@ var customerTools = [
|
|
|
21372
21708
|
openWorldHint: true
|
|
21373
21709
|
},
|
|
21374
21710
|
inputSchema: external_exports.object({
|
|
21375
|
-
customerId: external_exports.string().describe("The customer ID to archive")
|
|
21711
|
+
customerId: external_exports.string().max(1e4).describe("The customer ID to archive")
|
|
21376
21712
|
}),
|
|
21377
21713
|
handler: async (input) => {
|
|
21378
21714
|
return apiPatch(`/customers/${input.customerId}`, {
|
|
@@ -21399,8 +21735,8 @@ var discountRedemptionTools = [
|
|
|
21399
21735
|
openWorldHint: true
|
|
21400
21736
|
},
|
|
21401
21737
|
inputSchema: external_exports.object({
|
|
21402
|
-
discountRedemptionId: external_exports.string().describe("The discount redemption ID"),
|
|
21403
|
-
include: external_exports.string().optional().describe("Comma-separated related resources to include (e.g. 'discount,order')")
|
|
21738
|
+
discountRedemptionId: external_exports.string().max(1e4).describe("The discount redemption ID"),
|
|
21739
|
+
include: external_exports.string().max(1e4).optional().describe("Comma-separated related resources to include (e.g. 'discount,order')")
|
|
21404
21740
|
}),
|
|
21405
21741
|
handler: getHandler("/discount-redemptions", "discountRedemptionId")
|
|
21406
21742
|
},
|
|
@@ -21415,9 +21751,9 @@ var discountRedemptionTools = [
|
|
|
21415
21751
|
openWorldHint: true
|
|
21416
21752
|
},
|
|
21417
21753
|
inputSchema: external_exports.object({
|
|
21418
|
-
discountId: external_exports.string().optional().describe("Filter by discount ID"),
|
|
21419
|
-
orderId: external_exports.string().optional().describe("Filter by order ID"),
|
|
21420
|
-
include: external_exports.string().optional().describe("Comma-separated related resources to include (e.g. 'discount,order')"),
|
|
21754
|
+
discountId: external_exports.string().max(1e4).optional().describe("Filter by discount ID"),
|
|
21755
|
+
orderId: external_exports.string().max(1e4).optional().describe("Filter by order ID"),
|
|
21756
|
+
include: external_exports.string().max(1e4).optional().describe("Comma-separated related resources to include (e.g. 'discount,order')"),
|
|
21421
21757
|
pageNumber: external_exports.number().int().min(1).optional().describe("Page number (1-indexed)"),
|
|
21422
21758
|
pageSize: external_exports.number().int().min(1).max(100).optional().describe("Results per page (1-100)")
|
|
21423
21759
|
}),
|
|
@@ -21438,8 +21774,8 @@ var discountTools = [
|
|
|
21438
21774
|
openWorldHint: true
|
|
21439
21775
|
},
|
|
21440
21776
|
inputSchema: external_exports.object({
|
|
21441
|
-
discountId: external_exports.string().describe("The discount ID"),
|
|
21442
|
-
include: external_exports.string().optional().describe("Comma-separated related resources to include (e.g. 'store,variants,discount-redemptions')")
|
|
21777
|
+
discountId: external_exports.string().max(1e4).describe("The discount ID"),
|
|
21778
|
+
include: external_exports.string().max(1e4).optional().describe("Comma-separated related resources to include (e.g. 'store,variants,discount-redemptions')")
|
|
21443
21779
|
}),
|
|
21444
21780
|
handler: getHandler("/discounts", "discountId")
|
|
21445
21781
|
},
|
|
@@ -21454,8 +21790,8 @@ var discountTools = [
|
|
|
21454
21790
|
openWorldHint: true
|
|
21455
21791
|
},
|
|
21456
21792
|
inputSchema: external_exports.object({
|
|
21457
|
-
storeId: external_exports.string().optional().describe("Filter by store ID"),
|
|
21458
|
-
include: external_exports.string().optional().describe("Comma-separated related resources to include (e.g. 'store,variants,discount-redemptions')"),
|
|
21793
|
+
storeId: external_exports.string().max(1e4).optional().describe("Filter by store ID"),
|
|
21794
|
+
include: external_exports.string().max(1e4).optional().describe("Comma-separated related resources to include (e.g. 'store,variants,discount-redemptions')"),
|
|
21459
21795
|
pageNumber: external_exports.number().int().min(1).optional().describe("Page number (1-indexed)"),
|
|
21460
21796
|
pageSize: external_exports.number().int().min(1).max(100).optional().describe("Results per page (1-100)")
|
|
21461
21797
|
}),
|
|
@@ -21472,9 +21808,9 @@ var discountTools = [
|
|
|
21472
21808
|
openWorldHint: true
|
|
21473
21809
|
},
|
|
21474
21810
|
inputSchema: external_exports.object({
|
|
21475
|
-
storeId: external_exports.string().describe("The store ID to create the discount in"),
|
|
21476
|
-
name: external_exports.string().describe("Internal name for the discount"),
|
|
21477
|
-
code: external_exports.string().describe("The discount code customers will enter (e.g. 'SAVE20')"),
|
|
21811
|
+
storeId: external_exports.string().max(1e4).describe("The store ID to create the discount in"),
|
|
21812
|
+
name: external_exports.string().max(1e4).describe("Internal name for the discount"),
|
|
21813
|
+
code: external_exports.string().max(1e4).describe("The discount code customers will enter (e.g. 'SAVE20')"),
|
|
21478
21814
|
amount: external_exports.number().int().min(1).describe(
|
|
21479
21815
|
"Discount amount \u2014 in cents for 'fixed' type (e.g. 1000 = $10.00), or percentage for 'percent' type (e.g. 20 = 20%)"
|
|
21480
21816
|
),
|
|
@@ -21484,8 +21820,8 @@ var discountTools = [
|
|
|
21484
21820
|
),
|
|
21485
21821
|
durationInMonths: external_exports.number().int().min(1).optional().describe("Number of months the discount applies (required when duration is 'repeating')"),
|
|
21486
21822
|
maxRedemptions: external_exports.number().int().min(0).optional().describe("Maximum number of times this discount can be redeemed (0 = unlimited)"),
|
|
21487
|
-
startsAt: external_exports.string().optional().describe("When the discount becomes active (ISO 8601 format)"),
|
|
21488
|
-
expiresAt: external_exports.string().optional().describe("When the discount expires (ISO 8601 format)"),
|
|
21823
|
+
startsAt: external_exports.string().max(1e4).optional().describe("When the discount becomes active (ISO 8601 format)"),
|
|
21824
|
+
expiresAt: external_exports.string().max(1e4).optional().describe("When the discount expires (ISO 8601 format)"),
|
|
21489
21825
|
isLimitedToProducts: external_exports.boolean().optional().describe("If true, the discount only applies to specific variants (set via variantIds)"),
|
|
21490
21826
|
variantIds: external_exports.array(external_exports.string()).optional().describe("Array of variant IDs this discount applies to (requires isLimitedToProducts: true)")
|
|
21491
21827
|
}),
|
|
@@ -21530,7 +21866,7 @@ var discountTools = [
|
|
|
21530
21866
|
openWorldHint: true
|
|
21531
21867
|
},
|
|
21532
21868
|
inputSchema: external_exports.object({
|
|
21533
|
-
discountId: external_exports.string().describe("The discount ID to delete")
|
|
21869
|
+
discountId: external_exports.string().max(1e4).describe("The discount ID to delete")
|
|
21534
21870
|
}),
|
|
21535
21871
|
handler: async (input) => {
|
|
21536
21872
|
return apiDelete(`/discounts/${input.discountId}`);
|
|
@@ -21551,8 +21887,8 @@ var fileTools = [
|
|
|
21551
21887
|
openWorldHint: true
|
|
21552
21888
|
},
|
|
21553
21889
|
inputSchema: external_exports.object({
|
|
21554
|
-
fileId: external_exports.string().describe("The file ID"),
|
|
21555
|
-
include: external_exports.string().optional().describe("Comma-separated related resources to include (e.g. 'variant')")
|
|
21890
|
+
fileId: external_exports.string().max(1e4).describe("The file ID"),
|
|
21891
|
+
include: external_exports.string().max(1e4).optional().describe("Comma-separated related resources to include (e.g. 'variant')")
|
|
21556
21892
|
}),
|
|
21557
21893
|
handler: getHandler("/files", "fileId")
|
|
21558
21894
|
},
|
|
@@ -21567,8 +21903,8 @@ var fileTools = [
|
|
|
21567
21903
|
openWorldHint: true
|
|
21568
21904
|
},
|
|
21569
21905
|
inputSchema: external_exports.object({
|
|
21570
|
-
variantId: external_exports.string().optional().describe("Filter by variant ID"),
|
|
21571
|
-
include: external_exports.string().optional().describe("Comma-separated related resources to include (e.g. 'variant')"),
|
|
21906
|
+
variantId: external_exports.string().max(1e4).optional().describe("Filter by variant ID"),
|
|
21907
|
+
include: external_exports.string().max(1e4).optional().describe("Comma-separated related resources to include (e.g. 'variant')"),
|
|
21572
21908
|
pageNumber: external_exports.number().int().min(1).optional().describe("Page number (1-indexed)"),
|
|
21573
21909
|
pageSize: external_exports.number().int().min(1).max(100).optional().describe("Results per page (1-100)")
|
|
21574
21910
|
}),
|
|
@@ -21589,8 +21925,8 @@ var licenseKeyInstanceTools = [
|
|
|
21589
21925
|
openWorldHint: true
|
|
21590
21926
|
},
|
|
21591
21927
|
inputSchema: external_exports.object({
|
|
21592
|
-
licenseKeyInstanceId: external_exports.string().describe("The license key instance ID"),
|
|
21593
|
-
include: external_exports.string().optional().describe("Comma-separated related resources to include (e.g. 'license-key')")
|
|
21928
|
+
licenseKeyInstanceId: external_exports.string().max(1e4).describe("The license key instance ID"),
|
|
21929
|
+
include: external_exports.string().max(1e4).optional().describe("Comma-separated related resources to include (e.g. 'license-key')")
|
|
21594
21930
|
}),
|
|
21595
21931
|
handler: getHandler("/license-key-instances", "licenseKeyInstanceId")
|
|
21596
21932
|
},
|
|
@@ -21605,8 +21941,8 @@ var licenseKeyInstanceTools = [
|
|
|
21605
21941
|
openWorldHint: true
|
|
21606
21942
|
},
|
|
21607
21943
|
inputSchema: external_exports.object({
|
|
21608
|
-
licenseKeyId: external_exports.string().optional().describe("Filter by license key ID"),
|
|
21609
|
-
include: external_exports.string().optional().describe("Comma-separated related resources to include (e.g. 'license-key')"),
|
|
21944
|
+
licenseKeyId: external_exports.string().max(1e4).optional().describe("Filter by license key ID"),
|
|
21945
|
+
include: external_exports.string().max(1e4).optional().describe("Comma-separated related resources to include (e.g. 'license-key')"),
|
|
21610
21946
|
pageNumber: external_exports.number().int().min(1).optional().describe("Page number (1-indexed)"),
|
|
21611
21947
|
pageSize: external_exports.number().int().min(1).max(100).optional().describe("Results per page (1-100)")
|
|
21612
21948
|
}),
|
|
@@ -21627,8 +21963,8 @@ var licenseKeyTools = [
|
|
|
21627
21963
|
openWorldHint: true
|
|
21628
21964
|
},
|
|
21629
21965
|
inputSchema: external_exports.object({
|
|
21630
|
-
licenseKeyId: external_exports.string().describe("The license key ID"),
|
|
21631
|
-
include: external_exports.string().optional().describe(
|
|
21966
|
+
licenseKeyId: external_exports.string().max(1e4).describe("The license key ID"),
|
|
21967
|
+
include: external_exports.string().max(1e4).optional().describe(
|
|
21632
21968
|
"Comma-separated related resources to include (e.g. 'store,customer,order,order-item,product,license-key-instances')"
|
|
21633
21969
|
)
|
|
21634
21970
|
}),
|
|
@@ -21645,11 +21981,11 @@ var licenseKeyTools = [
|
|
|
21645
21981
|
openWorldHint: true
|
|
21646
21982
|
},
|
|
21647
21983
|
inputSchema: external_exports.object({
|
|
21648
|
-
storeId: external_exports.string().optional().describe("Filter by store ID"),
|
|
21649
|
-
orderId: external_exports.string().optional().describe("Filter by order ID"),
|
|
21650
|
-
orderItemId: external_exports.string().optional().describe("Filter by order item ID"),
|
|
21651
|
-
productId: external_exports.string().optional().describe("Filter by product ID"),
|
|
21652
|
-
include: external_exports.string().optional().describe(
|
|
21984
|
+
storeId: external_exports.string().max(1e4).optional().describe("Filter by store ID"),
|
|
21985
|
+
orderId: external_exports.string().max(1e4).optional().describe("Filter by order ID"),
|
|
21986
|
+
orderItemId: external_exports.string().max(1e4).optional().describe("Filter by order item ID"),
|
|
21987
|
+
productId: external_exports.string().max(1e4).optional().describe("Filter by product ID"),
|
|
21988
|
+
include: external_exports.string().max(1e4).optional().describe(
|
|
21653
21989
|
"Comma-separated related resources to include (e.g. 'store,customer,order,order-item,product,license-key-instances')"
|
|
21654
21990
|
),
|
|
21655
21991
|
pageNumber: external_exports.number().int().min(1).optional().describe("Page number (1-indexed)"),
|
|
@@ -21673,10 +22009,10 @@ var licenseKeyTools = [
|
|
|
21673
22009
|
openWorldHint: true
|
|
21674
22010
|
},
|
|
21675
22011
|
inputSchema: external_exports.object({
|
|
21676
|
-
licenseKeyId: external_exports.string().describe("The license key ID to update"),
|
|
22012
|
+
licenseKeyId: external_exports.string().max(1e4).describe("The license key ID to update"),
|
|
21677
22013
|
activationLimit: external_exports.number().int().min(0).optional().describe("Maximum number of activations allowed (0 = unlimited)"),
|
|
21678
22014
|
disabled: external_exports.boolean().optional().describe("Set to true to disable this license key"),
|
|
21679
|
-
expiresAt: external_exports.string().optional().describe("Expiry date (ISO 8601 format). Set to null to remove expiry.")
|
|
22015
|
+
expiresAt: external_exports.string().max(1e4).optional().describe("Expiry date (ISO 8601 format). Set to null to remove expiry.")
|
|
21680
22016
|
}),
|
|
21681
22017
|
handler: async (input) => {
|
|
21682
22018
|
const attributes = {};
|
|
@@ -21707,8 +22043,8 @@ var licenseTools = [
|
|
|
21707
22043
|
openWorldHint: true
|
|
21708
22044
|
},
|
|
21709
22045
|
inputSchema: external_exports.object({
|
|
21710
|
-
licenseKey: external_exports.string().describe("The license key to activate"),
|
|
21711
|
-
instanceName: external_exports.string().describe("A name for this activation instance (e.g. machine name, user identifier)")
|
|
22046
|
+
licenseKey: external_exports.string().max(1e4).describe("The license key to activate"),
|
|
22047
|
+
instanceName: external_exports.string().max(1e4).describe("A name for this activation instance (e.g. machine name, user identifier)")
|
|
21712
22048
|
}),
|
|
21713
22049
|
handler: async (input) => {
|
|
21714
22050
|
return licenseRequest("/licenses/activate", {
|
|
@@ -21728,8 +22064,8 @@ var licenseTools = [
|
|
|
21728
22064
|
openWorldHint: true
|
|
21729
22065
|
},
|
|
21730
22066
|
inputSchema: external_exports.object({
|
|
21731
|
-
licenseKey: external_exports.string().describe("The license key to validate"),
|
|
21732
|
-
instanceId: external_exports.string().optional().describe("Optional instance ID to validate a specific activation")
|
|
22067
|
+
licenseKey: external_exports.string().max(1e4).describe("The license key to validate"),
|
|
22068
|
+
instanceId: external_exports.string().max(1e4).optional().describe("Optional instance ID to validate a specific activation")
|
|
21733
22069
|
}),
|
|
21734
22070
|
handler: async (input) => {
|
|
21735
22071
|
const body = { license_key: input.licenseKey };
|
|
@@ -21748,8 +22084,8 @@ var licenseTools = [
|
|
|
21748
22084
|
openWorldHint: true
|
|
21749
22085
|
},
|
|
21750
22086
|
inputSchema: external_exports.object({
|
|
21751
|
-
licenseKey: external_exports.string().describe("The license key"),
|
|
21752
|
-
instanceId: external_exports.string().describe("The instance ID to deactivate")
|
|
22087
|
+
licenseKey: external_exports.string().max(1e4).describe("The license key"),
|
|
22088
|
+
instanceId: external_exports.string().max(1e4).describe("The instance ID to deactivate")
|
|
21753
22089
|
}),
|
|
21754
22090
|
handler: async (input) => {
|
|
21755
22091
|
return licenseRequest("/licenses/deactivate", {
|
|
@@ -21773,8 +22109,8 @@ var orderItemTools = [
|
|
|
21773
22109
|
openWorldHint: true
|
|
21774
22110
|
},
|
|
21775
22111
|
inputSchema: external_exports.object({
|
|
21776
|
-
orderItemId: external_exports.string().describe("The order item ID"),
|
|
21777
|
-
include: external_exports.string().optional().describe("Comma-separated related resources to include (e.g. 'order,product,variant')")
|
|
22112
|
+
orderItemId: external_exports.string().max(1e4).describe("The order item ID"),
|
|
22113
|
+
include: external_exports.string().max(1e4).optional().describe("Comma-separated related resources to include (e.g. 'order,product,variant')")
|
|
21778
22114
|
}),
|
|
21779
22115
|
handler: getHandler("/order-items", "orderItemId")
|
|
21780
22116
|
},
|
|
@@ -21789,10 +22125,10 @@ var orderItemTools = [
|
|
|
21789
22125
|
openWorldHint: true
|
|
21790
22126
|
},
|
|
21791
22127
|
inputSchema: external_exports.object({
|
|
21792
|
-
orderId: external_exports.string().optional().describe("Filter by order ID"),
|
|
21793
|
-
productId: external_exports.string().optional().describe("Filter by product ID"),
|
|
21794
|
-
variantId: external_exports.string().optional().describe("Filter by variant ID"),
|
|
21795
|
-
include: external_exports.string().optional().describe("Comma-separated related resources to include (e.g. 'order,product,variant')"),
|
|
22128
|
+
orderId: external_exports.string().max(1e4).optional().describe("Filter by order ID"),
|
|
22129
|
+
productId: external_exports.string().max(1e4).optional().describe("Filter by product ID"),
|
|
22130
|
+
variantId: external_exports.string().max(1e4).optional().describe("Filter by variant ID"),
|
|
22131
|
+
include: external_exports.string().max(1e4).optional().describe("Comma-separated related resources to include (e.g. 'order,product,variant')"),
|
|
21796
22132
|
pageNumber: external_exports.number().int().min(1).optional().describe("Page number (1-indexed)"),
|
|
21797
22133
|
pageSize: external_exports.number().int().min(1).max(100).optional().describe("Results per page (1-100)")
|
|
21798
22134
|
}),
|
|
@@ -21813,8 +22149,8 @@ var orderTools = [
|
|
|
21813
22149
|
openWorldHint: true
|
|
21814
22150
|
},
|
|
21815
22151
|
inputSchema: external_exports.object({
|
|
21816
|
-
orderId: external_exports.string().describe("The order ID"),
|
|
21817
|
-
include: external_exports.string().optional().describe(
|
|
22152
|
+
orderId: external_exports.string().max(1e4).describe("The order ID"),
|
|
22153
|
+
include: external_exports.string().max(1e4).optional().describe(
|
|
21818
22154
|
"Comma-separated related resources to include (e.g. 'store,customer,order-items,subscriptions,license-keys,discount-redemptions')"
|
|
21819
22155
|
)
|
|
21820
22156
|
}),
|
|
@@ -21831,9 +22167,9 @@ var orderTools = [
|
|
|
21831
22167
|
openWorldHint: true
|
|
21832
22168
|
},
|
|
21833
22169
|
inputSchema: external_exports.object({
|
|
21834
|
-
storeId: external_exports.string().optional().describe("Filter by store ID"),
|
|
21835
|
-
userEmail: external_exports.string().optional().describe("Filter by user email"),
|
|
21836
|
-
include: external_exports.string().optional().describe(
|
|
22170
|
+
storeId: external_exports.string().max(1e4).optional().describe("Filter by store ID"),
|
|
22171
|
+
userEmail: external_exports.string().max(1e4).optional().describe("Filter by user email"),
|
|
22172
|
+
include: external_exports.string().max(1e4).optional().describe(
|
|
21837
22173
|
"Comma-separated related resources to include (e.g. 'store,customer,order-items,subscriptions,license-keys,discount-redemptions')"
|
|
21838
22174
|
),
|
|
21839
22175
|
pageNumber: external_exports.number().int().min(1).optional().describe("Page number (1-indexed)"),
|
|
@@ -21852,15 +22188,15 @@ var orderTools = [
|
|
|
21852
22188
|
openWorldHint: true
|
|
21853
22189
|
},
|
|
21854
22190
|
inputSchema: external_exports.object({
|
|
21855
|
-
orderId: external_exports.string().describe("The order ID"),
|
|
21856
|
-
name: external_exports.string().optional().describe("Customer name on the invoice"),
|
|
21857
|
-
address: external_exports.string().optional().describe("Customer address on the invoice"),
|
|
21858
|
-
city: external_exports.string().optional().describe("Customer city"),
|
|
21859
|
-
state: external_exports.string().optional().describe("Customer state/region"),
|
|
21860
|
-
zipCode: external_exports.string().optional().describe("Customer ZIP/postal code"),
|
|
21861
|
-
country: external_exports.string().optional().describe("Customer country"),
|
|
21862
|
-
notes: external_exports.string().optional().describe("Additional notes to include on the invoice"),
|
|
21863
|
-
locale: external_exports.string().optional().describe("Invoice language locale (e.g. 'en', 'fr', 'de')")
|
|
22191
|
+
orderId: external_exports.string().max(1e4).describe("The order ID"),
|
|
22192
|
+
name: external_exports.string().max(1e4).optional().describe("Customer name on the invoice"),
|
|
22193
|
+
address: external_exports.string().max(1e4).optional().describe("Customer address on the invoice"),
|
|
22194
|
+
city: external_exports.string().max(1e4).optional().describe("Customer city"),
|
|
22195
|
+
state: external_exports.string().max(1e4).optional().describe("Customer state/region"),
|
|
22196
|
+
zipCode: external_exports.string().max(1e4).optional().describe("Customer ZIP/postal code"),
|
|
22197
|
+
country: external_exports.string().max(1e4).optional().describe("Customer country"),
|
|
22198
|
+
notes: external_exports.string().max(1e4).optional().describe("Additional notes to include on the invoice"),
|
|
22199
|
+
locale: external_exports.string().max(1e4).optional().describe("Invoice language locale (e.g. 'en', 'fr', 'de')")
|
|
21864
22200
|
}),
|
|
21865
22201
|
handler: async (input) => {
|
|
21866
22202
|
const params = new URLSearchParams();
|
|
@@ -21887,10 +22223,11 @@ var orderTools = [
|
|
|
21887
22223
|
openWorldHint: true
|
|
21888
22224
|
},
|
|
21889
22225
|
inputSchema: external_exports.object({
|
|
21890
|
-
orderId: external_exports.string().describe("The order ID to refund"),
|
|
22226
|
+
orderId: external_exports.string().max(1e4).describe("The order ID to refund"),
|
|
21891
22227
|
amount: external_exports.number().int().min(1).describe("Refund amount in cents (e.g. 1000 = $10.00)")
|
|
21892
22228
|
}),
|
|
21893
22229
|
handler: async (input) => {
|
|
22230
|
+
checkRefundAmount(input.amount);
|
|
21894
22231
|
return apiPost(`/orders/${input.orderId}/refund`, {
|
|
21895
22232
|
data: { type: "orders", id: input.orderId, attributes: { amount: input.amount } }
|
|
21896
22233
|
});
|
|
@@ -21911,8 +22248,8 @@ var priceTools = [
|
|
|
21911
22248
|
openWorldHint: true
|
|
21912
22249
|
},
|
|
21913
22250
|
inputSchema: external_exports.object({
|
|
21914
|
-
priceId: external_exports.string().describe("The price ID"),
|
|
21915
|
-
include: external_exports.string().optional().describe("Comma-separated related resources to include (e.g. 'variant')")
|
|
22251
|
+
priceId: external_exports.string().max(1e4).describe("The price ID"),
|
|
22252
|
+
include: external_exports.string().max(1e4).optional().describe("Comma-separated related resources to include (e.g. 'variant')")
|
|
21916
22253
|
}),
|
|
21917
22254
|
handler: getHandler("/prices", "priceId")
|
|
21918
22255
|
},
|
|
@@ -21927,8 +22264,8 @@ var priceTools = [
|
|
|
21927
22264
|
openWorldHint: true
|
|
21928
22265
|
},
|
|
21929
22266
|
inputSchema: external_exports.object({
|
|
21930
|
-
variantId: external_exports.string().optional().describe("Filter by variant ID"),
|
|
21931
|
-
include: external_exports.string().optional().describe("Comma-separated related resources to include (e.g. 'variant')"),
|
|
22267
|
+
variantId: external_exports.string().max(1e4).optional().describe("Filter by variant ID"),
|
|
22268
|
+
include: external_exports.string().max(1e4).optional().describe("Comma-separated related resources to include (e.g. 'variant')"),
|
|
21932
22269
|
pageNumber: external_exports.number().int().min(1).optional().describe("Page number (1-indexed)"),
|
|
21933
22270
|
pageSize: external_exports.number().int().min(1).max(100).optional().describe("Results per page (1-100)")
|
|
21934
22271
|
}),
|
|
@@ -21949,8 +22286,8 @@ var productTools = [
|
|
|
21949
22286
|
openWorldHint: true
|
|
21950
22287
|
},
|
|
21951
22288
|
inputSchema: external_exports.object({
|
|
21952
|
-
productId: external_exports.string().describe("The product ID"),
|
|
21953
|
-
include: external_exports.string().optional().describe("Comma-separated related resources to include (e.g. 'store,variants')")
|
|
22289
|
+
productId: external_exports.string().max(1e4).describe("The product ID"),
|
|
22290
|
+
include: external_exports.string().max(1e4).optional().describe("Comma-separated related resources to include (e.g. 'store,variants')")
|
|
21954
22291
|
}),
|
|
21955
22292
|
handler: getHandler("/products", "productId")
|
|
21956
22293
|
},
|
|
@@ -21965,8 +22302,8 @@ var productTools = [
|
|
|
21965
22302
|
openWorldHint: true
|
|
21966
22303
|
},
|
|
21967
22304
|
inputSchema: external_exports.object({
|
|
21968
|
-
storeId: external_exports.string().optional().describe("Filter by store ID"),
|
|
21969
|
-
include: external_exports.string().optional().describe("Comma-separated related resources to include (e.g. 'store,variants')"),
|
|
22305
|
+
storeId: external_exports.string().max(1e4).optional().describe("Filter by store ID"),
|
|
22306
|
+
include: external_exports.string().max(1e4).optional().describe("Comma-separated related resources to include (e.g. 'store,variants')"),
|
|
21970
22307
|
pageNumber: external_exports.number().int().min(1).optional().describe("Page number (1-indexed)"),
|
|
21971
22308
|
pageSize: external_exports.number().int().min(1).max(100).optional().describe("Results per page (1-100)")
|
|
21972
22309
|
}),
|
|
@@ -21987,8 +22324,8 @@ var storeTools = [
|
|
|
21987
22324
|
openWorldHint: true
|
|
21988
22325
|
},
|
|
21989
22326
|
inputSchema: external_exports.object({
|
|
21990
|
-
storeId: external_exports.string().describe("The store ID"),
|
|
21991
|
-
include: external_exports.string().optional().describe(
|
|
22327
|
+
storeId: external_exports.string().max(1e4).describe("The store ID"),
|
|
22328
|
+
include: external_exports.string().max(1e4).optional().describe(
|
|
21992
22329
|
"Comma-separated related resources to include (e.g. 'products,discounts,license-keys,subscriptions,webhooks')"
|
|
21993
22330
|
)
|
|
21994
22331
|
}),
|
|
@@ -22005,7 +22342,7 @@ var storeTools = [
|
|
|
22005
22342
|
openWorldHint: true
|
|
22006
22343
|
},
|
|
22007
22344
|
inputSchema: external_exports.object({
|
|
22008
|
-
include: external_exports.string().optional().describe(
|
|
22345
|
+
include: external_exports.string().max(1e4).optional().describe(
|
|
22009
22346
|
"Comma-separated related resources to include (e.g. 'products,discounts,license-keys,subscriptions,webhooks')"
|
|
22010
22347
|
),
|
|
22011
22348
|
pageNumber: external_exports.number().int().min(1).optional().describe("Page number (1-indexed)"),
|
|
@@ -22028,8 +22365,8 @@ var subscriptionInvoiceTools = [
|
|
|
22028
22365
|
openWorldHint: true
|
|
22029
22366
|
},
|
|
22030
22367
|
inputSchema: external_exports.object({
|
|
22031
|
-
subscriptionInvoiceId: external_exports.string().describe("The subscription invoice ID"),
|
|
22032
|
-
include: external_exports.string().optional().describe("Comma-separated related resources to include (e.g. 'store,subscription')")
|
|
22368
|
+
subscriptionInvoiceId: external_exports.string().max(1e4).describe("The subscription invoice ID"),
|
|
22369
|
+
include: external_exports.string().max(1e4).optional().describe("Comma-separated related resources to include (e.g. 'store,subscription')")
|
|
22033
22370
|
}),
|
|
22034
22371
|
handler: getHandler("/subscription-invoices", "subscriptionInvoiceId")
|
|
22035
22372
|
},
|
|
@@ -22044,11 +22381,11 @@ var subscriptionInvoiceTools = [
|
|
|
22044
22381
|
openWorldHint: true
|
|
22045
22382
|
},
|
|
22046
22383
|
inputSchema: external_exports.object({
|
|
22047
|
-
storeId: external_exports.string().optional().describe("Filter by store ID"),
|
|
22048
|
-
subscriptionId: external_exports.string().optional().describe("Filter by subscription ID"),
|
|
22384
|
+
storeId: external_exports.string().max(1e4).optional().describe("Filter by store ID"),
|
|
22385
|
+
subscriptionId: external_exports.string().max(1e4).optional().describe("Filter by subscription ID"),
|
|
22049
22386
|
status: external_exports.enum(["pending", "paid", "void", "refunded"]).optional().describe("Filter by invoice status"),
|
|
22050
22387
|
refunded: external_exports.boolean().optional().describe("Filter by refunded status"),
|
|
22051
|
-
include: external_exports.string().optional().describe("Comma-separated related resources to include (e.g. 'store,subscription')"),
|
|
22388
|
+
include: external_exports.string().max(1e4).optional().describe("Comma-separated related resources to include (e.g. 'store,subscription')"),
|
|
22052
22389
|
pageNumber: external_exports.number().int().min(1).optional().describe("Page number (1-indexed)"),
|
|
22053
22390
|
pageSize: external_exports.number().int().min(1).max(100).optional().describe("Results per page (1-100)")
|
|
22054
22391
|
}),
|
|
@@ -22070,15 +22407,15 @@ var subscriptionInvoiceTools = [
|
|
|
22070
22407
|
openWorldHint: true
|
|
22071
22408
|
},
|
|
22072
22409
|
inputSchema: external_exports.object({
|
|
22073
|
-
subscriptionInvoiceId: external_exports.string().describe("The subscription invoice ID"),
|
|
22074
|
-
name: external_exports.string().optional().describe("Customer name on the invoice"),
|
|
22075
|
-
address: external_exports.string().optional().describe("Customer address on the invoice"),
|
|
22076
|
-
city: external_exports.string().optional().describe("Customer city"),
|
|
22077
|
-
state: external_exports.string().optional().describe("Customer state/region"),
|
|
22078
|
-
zipCode: external_exports.string().optional().describe("Customer ZIP/postal code"),
|
|
22079
|
-
country: external_exports.string().optional().describe("Customer country"),
|
|
22080
|
-
notes: external_exports.string().optional().describe("Additional notes to include on the invoice"),
|
|
22081
|
-
locale: external_exports.string().optional().describe("Invoice language locale (e.g. 'en', 'fr', 'de')")
|
|
22410
|
+
subscriptionInvoiceId: external_exports.string().max(1e4).describe("The subscription invoice ID"),
|
|
22411
|
+
name: external_exports.string().max(1e4).optional().describe("Customer name on the invoice"),
|
|
22412
|
+
address: external_exports.string().max(1e4).optional().describe("Customer address on the invoice"),
|
|
22413
|
+
city: external_exports.string().max(1e4).optional().describe("Customer city"),
|
|
22414
|
+
state: external_exports.string().max(1e4).optional().describe("Customer state/region"),
|
|
22415
|
+
zipCode: external_exports.string().max(1e4).optional().describe("Customer ZIP/postal code"),
|
|
22416
|
+
country: external_exports.string().max(1e4).optional().describe("Customer country"),
|
|
22417
|
+
notes: external_exports.string().max(1e4).optional().describe("Additional notes to include on the invoice"),
|
|
22418
|
+
locale: external_exports.string().max(1e4).optional().describe("Invoice language locale (e.g. 'en', 'fr', 'de')")
|
|
22082
22419
|
}),
|
|
22083
22420
|
handler: async (input) => {
|
|
22084
22421
|
const params = new URLSearchParams();
|
|
@@ -22105,7 +22442,7 @@ var subscriptionInvoiceTools = [
|
|
|
22105
22442
|
openWorldHint: true
|
|
22106
22443
|
},
|
|
22107
22444
|
inputSchema: external_exports.object({
|
|
22108
|
-
subscriptionInvoiceId: external_exports.string().describe("The subscription invoice ID to refund"),
|
|
22445
|
+
subscriptionInvoiceId: external_exports.string().max(1e4).describe("The subscription invoice ID to refund"),
|
|
22109
22446
|
amount: external_exports.number().int().min(1).describe("Refund amount in cents (e.g. 1000 = $10.00)")
|
|
22110
22447
|
}),
|
|
22111
22448
|
handler: async (input) => {
|
|
@@ -22133,8 +22470,8 @@ var subscriptionItemTools = [
|
|
|
22133
22470
|
openWorldHint: true
|
|
22134
22471
|
},
|
|
22135
22472
|
inputSchema: external_exports.object({
|
|
22136
|
-
subscriptionItemId: external_exports.string().describe("The subscription item ID"),
|
|
22137
|
-
include: external_exports.string().optional().describe("Comma-separated related resources to include (e.g. 'subscription,price,usage-records')")
|
|
22473
|
+
subscriptionItemId: external_exports.string().max(1e4).describe("The subscription item ID"),
|
|
22474
|
+
include: external_exports.string().max(1e4).optional().describe("Comma-separated related resources to include (e.g. 'subscription,price,usage-records')")
|
|
22138
22475
|
}),
|
|
22139
22476
|
handler: getHandler("/subscription-items", "subscriptionItemId")
|
|
22140
22477
|
},
|
|
@@ -22149,9 +22486,9 @@ var subscriptionItemTools = [
|
|
|
22149
22486
|
openWorldHint: true
|
|
22150
22487
|
},
|
|
22151
22488
|
inputSchema: external_exports.object({
|
|
22152
|
-
subscriptionId: external_exports.string().optional().describe("Filter by subscription ID"),
|
|
22153
|
-
priceId: external_exports.string().optional().describe("Filter by price ID"),
|
|
22154
|
-
include: external_exports.string().optional().describe("Comma-separated related resources to include (e.g. 'subscription,price,usage-records')"),
|
|
22489
|
+
subscriptionId: external_exports.string().max(1e4).optional().describe("Filter by subscription ID"),
|
|
22490
|
+
priceId: external_exports.string().max(1e4).optional().describe("Filter by price ID"),
|
|
22491
|
+
include: external_exports.string().max(1e4).optional().describe("Comma-separated related resources to include (e.g. 'subscription,price,usage-records')"),
|
|
22155
22492
|
pageNumber: external_exports.number().int().min(1).optional().describe("Page number (1-indexed)"),
|
|
22156
22493
|
pageSize: external_exports.number().int().min(1).max(100).optional().describe("Results per page (1-100)")
|
|
22157
22494
|
}),
|
|
@@ -22168,7 +22505,7 @@ var subscriptionItemTools = [
|
|
|
22168
22505
|
openWorldHint: true
|
|
22169
22506
|
},
|
|
22170
22507
|
inputSchema: external_exports.object({
|
|
22171
|
-
subscriptionItemId: external_exports.string().describe("The subscription item ID to update"),
|
|
22508
|
+
subscriptionItemId: external_exports.string().max(1e4).describe("The subscription item ID to update"),
|
|
22172
22509
|
quantity: external_exports.number().int().min(1).describe("New quantity for the subscription item")
|
|
22173
22510
|
}),
|
|
22174
22511
|
handler: async (input) => {
|
|
@@ -22192,7 +22529,7 @@ var subscriptionItemTools = [
|
|
|
22192
22529
|
openWorldHint: true
|
|
22193
22530
|
},
|
|
22194
22531
|
inputSchema: external_exports.object({
|
|
22195
|
-
subscriptionItemId: external_exports.string().describe("The subscription item ID")
|
|
22532
|
+
subscriptionItemId: external_exports.string().max(1e4).describe("The subscription item ID")
|
|
22196
22533
|
}),
|
|
22197
22534
|
handler: async (input) => {
|
|
22198
22535
|
return apiGet(`/subscription-items/${input.subscriptionItemId}/current-usage`);
|
|
@@ -22213,8 +22550,8 @@ var subscriptionTools = [
|
|
|
22213
22550
|
openWorldHint: true
|
|
22214
22551
|
},
|
|
22215
22552
|
inputSchema: external_exports.object({
|
|
22216
|
-
subscriptionId: external_exports.string().describe("The subscription ID"),
|
|
22217
|
-
include: external_exports.string().optional().describe(
|
|
22553
|
+
subscriptionId: external_exports.string().max(1e4).describe("The subscription ID"),
|
|
22554
|
+
include: external_exports.string().max(1e4).optional().describe(
|
|
22218
22555
|
"Comma-separated related resources to include (e.g. 'store,customer,order,order-item,product,variant,subscription-items,subscription-invoices')"
|
|
22219
22556
|
)
|
|
22220
22557
|
}),
|
|
@@ -22231,14 +22568,14 @@ var subscriptionTools = [
|
|
|
22231
22568
|
openWorldHint: true
|
|
22232
22569
|
},
|
|
22233
22570
|
inputSchema: external_exports.object({
|
|
22234
|
-
storeId: external_exports.string().optional().describe("Filter by store ID"),
|
|
22235
|
-
orderId: external_exports.string().optional().describe("Filter by order ID"),
|
|
22236
|
-
orderItemId: external_exports.string().optional().describe("Filter by order item ID"),
|
|
22237
|
-
productId: external_exports.string().optional().describe("Filter by product ID"),
|
|
22238
|
-
variantId: external_exports.string().optional().describe("Filter by variant ID"),
|
|
22239
|
-
userEmail: external_exports.string().optional().describe("Filter by user email"),
|
|
22571
|
+
storeId: external_exports.string().max(1e4).optional().describe("Filter by store ID"),
|
|
22572
|
+
orderId: external_exports.string().max(1e4).optional().describe("Filter by order ID"),
|
|
22573
|
+
orderItemId: external_exports.string().max(1e4).optional().describe("Filter by order item ID"),
|
|
22574
|
+
productId: external_exports.string().max(1e4).optional().describe("Filter by product ID"),
|
|
22575
|
+
variantId: external_exports.string().max(1e4).optional().describe("Filter by variant ID"),
|
|
22576
|
+
userEmail: external_exports.string().max(1e4).optional().describe("Filter by user email"),
|
|
22240
22577
|
status: external_exports.enum(["on_trial", "active", "paused", "past_due", "unpaid", "cancelled", "expired"]).optional().describe("Filter by subscription status"),
|
|
22241
|
-
include: external_exports.string().optional().describe(
|
|
22578
|
+
include: external_exports.string().max(1e4).optional().describe(
|
|
22242
22579
|
"Comma-separated related resources to include (e.g. 'store,customer,order,order-item,product,variant')"
|
|
22243
22580
|
),
|
|
22244
22581
|
pageNumber: external_exports.number().int().min(1).optional().describe("Page number (1-indexed)"),
|
|
@@ -22265,8 +22602,8 @@ var subscriptionTools = [
|
|
|
22265
22602
|
openWorldHint: true
|
|
22266
22603
|
},
|
|
22267
22604
|
inputSchema: external_exports.object({
|
|
22268
|
-
subscriptionId: external_exports.string().describe("The subscription ID to update"),
|
|
22269
|
-
variantId: external_exports.string().optional().describe("New variant ID for plan switching"),
|
|
22605
|
+
subscriptionId: external_exports.string().max(1e4).describe("The subscription ID to update"),
|
|
22606
|
+
variantId: external_exports.string().max(1e4).optional().describe("New variant ID for plan switching"),
|
|
22270
22607
|
pause: external_exports.enum(["void", "free", "resume"]).optional().describe("Pause mode: 'void' (pause, skip billing), 'free' (pause, keep access free), or 'resume' to unpause"),
|
|
22271
22608
|
cancelled: external_exports.literal(false).optional().describe(
|
|
22272
22609
|
"Set to false to un-cancel a subscription before it expires. To cancel, use ls_cancel_subscription instead."
|
|
@@ -22274,7 +22611,7 @@ var subscriptionTools = [
|
|
|
22274
22611
|
billingAnchor: external_exports.number().int().min(1).max(28).optional().describe("Day of month (1-28) to anchor billing to"),
|
|
22275
22612
|
invoiceImmediately: external_exports.boolean().optional().describe("If true, invoice immediately when updating (default false for prorated changes)"),
|
|
22276
22613
|
disableProrations: external_exports.boolean().optional().describe("If true, disable prorations when changing plans"),
|
|
22277
|
-
trialEndsAt: external_exports.string().optional().describe("Set trial end date (ISO 8601 format). Set to null to end trial immediately.")
|
|
22614
|
+
trialEndsAt: external_exports.string().max(1e4).optional().describe("Set trial end date (ISO 8601 format). Set to null to end trial immediately.")
|
|
22278
22615
|
}),
|
|
22279
22616
|
handler: async (input) => {
|
|
22280
22617
|
const attributes = {};
|
|
@@ -22305,7 +22642,7 @@ var subscriptionTools = [
|
|
|
22305
22642
|
openWorldHint: true
|
|
22306
22643
|
},
|
|
22307
22644
|
inputSchema: external_exports.object({
|
|
22308
|
-
subscriptionId: external_exports.string().describe("The subscription ID to cancel")
|
|
22645
|
+
subscriptionId: external_exports.string().max(1e4).describe("The subscription ID to cancel")
|
|
22309
22646
|
}),
|
|
22310
22647
|
handler: async (input) => {
|
|
22311
22648
|
return apiDelete(`/subscriptions/${input.subscriptionId}`);
|
|
@@ -22326,8 +22663,8 @@ var usageRecordTools = [
|
|
|
22326
22663
|
openWorldHint: true
|
|
22327
22664
|
},
|
|
22328
22665
|
inputSchema: external_exports.object({
|
|
22329
|
-
usageRecordId: external_exports.string().describe("The usage record ID"),
|
|
22330
|
-
include: external_exports.string().optional().describe("Comma-separated related resources to include (e.g. 'subscription-item')")
|
|
22666
|
+
usageRecordId: external_exports.string().max(1e4).describe("The usage record ID"),
|
|
22667
|
+
include: external_exports.string().max(1e4).optional().describe("Comma-separated related resources to include (e.g. 'subscription-item')")
|
|
22331
22668
|
}),
|
|
22332
22669
|
handler: getHandler("/usage-records", "usageRecordId")
|
|
22333
22670
|
},
|
|
@@ -22342,8 +22679,8 @@ var usageRecordTools = [
|
|
|
22342
22679
|
openWorldHint: true
|
|
22343
22680
|
},
|
|
22344
22681
|
inputSchema: external_exports.object({
|
|
22345
|
-
subscriptionItemId: external_exports.string().optional().describe("Filter by subscription item ID"),
|
|
22346
|
-
include: external_exports.string().optional().describe("Comma-separated related resources to include (e.g. 'subscription-item')"),
|
|
22682
|
+
subscriptionItemId: external_exports.string().max(1e4).optional().describe("Filter by subscription item ID"),
|
|
22683
|
+
include: external_exports.string().max(1e4).optional().describe("Comma-separated related resources to include (e.g. 'subscription-item')"),
|
|
22347
22684
|
pageNumber: external_exports.number().int().min(1).optional().describe("Page number (1-indexed)"),
|
|
22348
22685
|
pageSize: external_exports.number().int().min(1).max(100).optional().describe("Results per page (1-100)")
|
|
22349
22686
|
}),
|
|
@@ -22360,7 +22697,7 @@ var usageRecordTools = [
|
|
|
22360
22697
|
openWorldHint: true
|
|
22361
22698
|
},
|
|
22362
22699
|
inputSchema: external_exports.object({
|
|
22363
|
-
subscriptionItemId: external_exports.string().describe("The subscription item ID to report usage for"),
|
|
22700
|
+
subscriptionItemId: external_exports.string().max(1e4).describe("The subscription item ID to report usage for"),
|
|
22364
22701
|
quantity: external_exports.number().int().min(0).describe("The usage quantity to report"),
|
|
22365
22702
|
action: external_exports.enum(["increment", "set"]).optional().describe("How to apply the quantity: 'increment' (add to current, default) or 'set' (replace current)")
|
|
22366
22703
|
}),
|
|
@@ -22416,8 +22753,8 @@ var variantTools = [
|
|
|
22416
22753
|
openWorldHint: true
|
|
22417
22754
|
},
|
|
22418
22755
|
inputSchema: external_exports.object({
|
|
22419
|
-
variantId: external_exports.string().describe("The variant ID"),
|
|
22420
|
-
include: external_exports.string().optional().describe("Comma-separated related resources to include (e.g. 'product,files')")
|
|
22756
|
+
variantId: external_exports.string().max(1e4).describe("The variant ID"),
|
|
22757
|
+
include: external_exports.string().max(1e4).optional().describe("Comma-separated related resources to include (e.g. 'product,files')")
|
|
22421
22758
|
}),
|
|
22422
22759
|
handler: getHandler("/variants", "variantId")
|
|
22423
22760
|
},
|
|
@@ -22432,8 +22769,8 @@ var variantTools = [
|
|
|
22432
22769
|
openWorldHint: true
|
|
22433
22770
|
},
|
|
22434
22771
|
inputSchema: external_exports.object({
|
|
22435
|
-
productId: external_exports.string().optional().describe("Filter by product ID"),
|
|
22436
|
-
include: external_exports.string().optional().describe("Comma-separated related resources to include (e.g. 'product,files')"),
|
|
22772
|
+
productId: external_exports.string().max(1e4).optional().describe("Filter by product ID"),
|
|
22773
|
+
include: external_exports.string().max(1e4).optional().describe("Comma-separated related resources to include (e.g. 'product,files')"),
|
|
22437
22774
|
pageNumber: external_exports.number().int().min(1).optional().describe("Page number (1-indexed)"),
|
|
22438
22775
|
pageSize: external_exports.number().int().min(1).max(100).optional().describe("Results per page (1-100)")
|
|
22439
22776
|
}),
|
|
@@ -22454,8 +22791,8 @@ var webhookTools = [
|
|
|
22454
22791
|
openWorldHint: true
|
|
22455
22792
|
},
|
|
22456
22793
|
inputSchema: external_exports.object({
|
|
22457
|
-
webhookId: external_exports.string().describe("The webhook ID"),
|
|
22458
|
-
include: external_exports.string().optional().describe("Comma-separated related resources to include (e.g. 'store')")
|
|
22794
|
+
webhookId: external_exports.string().max(1e4).describe("The webhook ID"),
|
|
22795
|
+
include: external_exports.string().max(1e4).optional().describe("Comma-separated related resources to include (e.g. 'store')")
|
|
22459
22796
|
}),
|
|
22460
22797
|
handler: getHandler("/webhooks", "webhookId")
|
|
22461
22798
|
},
|
|
@@ -22470,8 +22807,8 @@ var webhookTools = [
|
|
|
22470
22807
|
openWorldHint: true
|
|
22471
22808
|
},
|
|
22472
22809
|
inputSchema: external_exports.object({
|
|
22473
|
-
storeId: external_exports.string().optional().describe("Filter by store ID"),
|
|
22474
|
-
include: external_exports.string().optional().describe("Comma-separated related resources to include (e.g. 'store')"),
|
|
22810
|
+
storeId: external_exports.string().max(1e4).optional().describe("Filter by store ID"),
|
|
22811
|
+
include: external_exports.string().max(1e4).optional().describe("Comma-separated related resources to include (e.g. 'store')"),
|
|
22475
22812
|
pageNumber: external_exports.number().int().min(1).optional().describe("Page number (1-indexed)"),
|
|
22476
22813
|
pageSize: external_exports.number().int().min(1).max(100).optional().describe("Results per page (1-100)")
|
|
22477
22814
|
}),
|
|
@@ -22488,8 +22825,8 @@ var webhookTools = [
|
|
|
22488
22825
|
openWorldHint: true
|
|
22489
22826
|
},
|
|
22490
22827
|
inputSchema: external_exports.object({
|
|
22491
|
-
storeId: external_exports.string().describe("The store ID"),
|
|
22492
|
-
url: external_exports.string().describe("The URL to send webhook events to"),
|
|
22828
|
+
storeId: external_exports.string().max(1e4).describe("The store ID"),
|
|
22829
|
+
url: external_exports.string().max(1e4).describe("The URL to send webhook events to"),
|
|
22493
22830
|
events: external_exports.array(external_exports.string()).describe(
|
|
22494
22831
|
"Event types to subscribe to (e.g. ['order_created', 'subscription_created', 'subscription_updated', 'subscription_cancelled', 'subscription_payment_success', 'subscription_payment_failed', 'license_key_created'])"
|
|
22495
22832
|
),
|
|
@@ -22522,10 +22859,10 @@ var webhookTools = [
|
|
|
22522
22859
|
openWorldHint: true
|
|
22523
22860
|
},
|
|
22524
22861
|
inputSchema: external_exports.object({
|
|
22525
|
-
webhookId: external_exports.string().describe("The webhook ID to update"),
|
|
22526
|
-
url: external_exports.string().optional().describe("New URL to send webhook events to"),
|
|
22862
|
+
webhookId: external_exports.string().max(1e4).describe("The webhook ID to update"),
|
|
22863
|
+
url: external_exports.string().max(1e4).optional().describe("New URL to send webhook events to"),
|
|
22527
22864
|
events: external_exports.array(external_exports.string()).optional().describe("Updated list of event types to subscribe to"),
|
|
22528
|
-
secret: external_exports.string().optional().describe("New signing secret")
|
|
22865
|
+
secret: external_exports.string().max(1e4).optional().describe("New signing secret")
|
|
22529
22866
|
}),
|
|
22530
22867
|
handler: async (input) => {
|
|
22531
22868
|
const attributes = {};
|
|
@@ -22552,7 +22889,7 @@ var webhookTools = [
|
|
|
22552
22889
|
openWorldHint: true
|
|
22553
22890
|
},
|
|
22554
22891
|
inputSchema: external_exports.object({
|
|
22555
|
-
webhookId: external_exports.string().describe("The webhook ID to delete")
|
|
22892
|
+
webhookId: external_exports.string().max(1e4).describe("The webhook ID to delete")
|
|
22556
22893
|
}),
|
|
22557
22894
|
handler: async (input) => {
|
|
22558
22895
|
return apiDelete(`/webhooks/${input.webhookId}`);
|
|
@@ -22561,7 +22898,7 @@ var webhookTools = [
|
|
|
22561
22898
|
];
|
|
22562
22899
|
|
|
22563
22900
|
// src/index.ts
|
|
22564
|
-
var version2 = true ? "0.
|
|
22901
|
+
var version2 = true ? "0.4.0" : (await null).createRequire(import.meta.url)("../package.json").version;
|
|
22565
22902
|
var subcommand = process.argv[2];
|
|
22566
22903
|
if (subcommand === "version" || subcommand === "--version") {
|
|
22567
22904
|
console.log(version2);
|
|
@@ -22587,22 +22924,39 @@ var allTools = [
|
|
|
22587
22924
|
...licenseKeyInstanceTools,
|
|
22588
22925
|
...checkoutTools,
|
|
22589
22926
|
...webhookTools,
|
|
22590
|
-
...licenseTools
|
|
22927
|
+
...licenseTools,
|
|
22928
|
+
...affiliateTools
|
|
22591
22929
|
];
|
|
22592
22930
|
var server = new McpServer({
|
|
22593
22931
|
name: "@yawlabs/lemonsqueezy-mcp",
|
|
22594
22932
|
version: version2
|
|
22595
22933
|
});
|
|
22596
22934
|
for (const tool of allTools) {
|
|
22935
|
+
const isDestructive = tool.annotations?.destructiveHint === true;
|
|
22597
22936
|
server.tool(
|
|
22598
22937
|
tool.name,
|
|
22599
22938
|
tool.description,
|
|
22600
22939
|
tool.inputSchema.shape,
|
|
22601
22940
|
tool.annotations,
|
|
22602
22941
|
async (input) => {
|
|
22942
|
+
const start = Date.now();
|
|
22603
22943
|
try {
|
|
22944
|
+
if (isDestructive) checkDestructiveRateLimit();
|
|
22945
|
+
const storeId = input.storeId;
|
|
22946
|
+
if (typeof storeId === "string") checkStoreAllowed(storeId);
|
|
22604
22947
|
const result = await tool.handler(input);
|
|
22605
22948
|
const response = result;
|
|
22949
|
+
const latency_ms = Date.now() - start;
|
|
22950
|
+
logEvent({
|
|
22951
|
+
event: "tool_call",
|
|
22952
|
+
tool: tool.name,
|
|
22953
|
+
status: response.ok ? "ok" : "error",
|
|
22954
|
+
latency_ms,
|
|
22955
|
+
request_id: response.requestId,
|
|
22956
|
+
error: response.ok ? void 0 : response.error,
|
|
22957
|
+
audit: isDestructive ? true : void 0,
|
|
22958
|
+
inputs: isDestructive ? input : void 0
|
|
22959
|
+
});
|
|
22606
22960
|
if (!response.ok) {
|
|
22607
22961
|
return {
|
|
22608
22962
|
content: [
|
|
@@ -22620,6 +22974,16 @@ for (const tool of allTools) {
|
|
|
22620
22974
|
};
|
|
22621
22975
|
} catch (err) {
|
|
22622
22976
|
const message = err instanceof Error ? err.message : String(err);
|
|
22977
|
+
const latency_ms = Date.now() - start;
|
|
22978
|
+
logEvent({
|
|
22979
|
+
event: "tool_call",
|
|
22980
|
+
tool: tool.name,
|
|
22981
|
+
status: err instanceof GuardrailError ? "guardrail_block" : "exception",
|
|
22982
|
+
latency_ms,
|
|
22983
|
+
error: message,
|
|
22984
|
+
audit: isDestructive ? true : void 0,
|
|
22985
|
+
inputs: isDestructive ? input : void 0
|
|
22986
|
+
});
|
|
22623
22987
|
return {
|
|
22624
22988
|
content: [{ type: "text", text: `Error: ${message}` }],
|
|
22625
22989
|
isError: true
|