clishop 1.1.0 → 1.2.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/LICENSE +1 -196
- package/README.md +181 -640
- package/dist/index.js +22 -16
- package/dist/mcp.js +562 -4
- package/package.json +65 -65
package/dist/index.js
CHANGED
|
@@ -831,7 +831,7 @@ Addresses for agent "${agent.name}":
|
|
|
831
831
|
country: countryInfo.code,
|
|
832
832
|
instructions: instructionsInput || void 0
|
|
833
833
|
});
|
|
834
|
-
if (setDefault) {
|
|
834
|
+
if (setDefault || !agent.defaultAddressId) {
|
|
835
835
|
updateAgent(agent.name, { defaultAddressId: res.data.address.id });
|
|
836
836
|
}
|
|
837
837
|
spinner.succeed(chalk3.green(`Address "${answers.label}" added.`));
|
|
@@ -858,6 +858,11 @@ Addresses for agent "${agent.name}":
|
|
|
858
858
|
if (agent.defaultAddressId === id) {
|
|
859
859
|
updateAgent(agent.name, { defaultAddressId: void 0 });
|
|
860
860
|
}
|
|
861
|
+
const remainingRes = await api.get("/addresses", { params: { agent: agent.name } });
|
|
862
|
+
const remaining = remainingRes.data.addresses || [];
|
|
863
|
+
if (remaining.length === 1) {
|
|
864
|
+
updateAgent(agent.name, { defaultAddressId: remaining[0].id });
|
|
865
|
+
}
|
|
861
866
|
} catch (error) {
|
|
862
867
|
handleApiError(error);
|
|
863
868
|
}
|
|
@@ -927,7 +932,7 @@ async function runSetupWizard() {
|
|
|
927
932
|
console.log();
|
|
928
933
|
console.log(chalk4.bold.cyan(" W E L C O M E T O C L I S H O P"));
|
|
929
934
|
console.log(chalk4.dim(" Order anything from your terminal."));
|
|
930
|
-
console.log(chalk4.dim(` Build: ${"2026-03-
|
|
935
|
+
console.log(chalk4.dim(` Build: ${"2026-03-03T18:27:22.112Z"}`));
|
|
931
936
|
console.log();
|
|
932
937
|
divider(chalk4.cyan);
|
|
933
938
|
console.log();
|
|
@@ -2108,21 +2113,22 @@ function registerSearchCommands(program2) {
|
|
|
2108
2113
|
}
|
|
2109
2114
|
if (!shipToCountry && !shipToCity && !shipToPostalCode && !opts.shipTo) {
|
|
2110
2115
|
const agent = getActiveAgent();
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2116
|
+
try {
|
|
2117
|
+
spinner.text = `Resolving default address...`;
|
|
2118
|
+
const addrRes = await api.get("/addresses");
|
|
2119
|
+
const addresses = addrRes.data.addresses || [];
|
|
2120
|
+
const resolved = agent.defaultAddressId && addresses.find((a) => a.id === agent.defaultAddressId) || addresses[0];
|
|
2121
|
+
if (resolved) {
|
|
2122
|
+
shipToCountry = resolved.country;
|
|
2123
|
+
shipToCity = resolved.city;
|
|
2124
|
+
shipToPostalCode = resolved.postalCode;
|
|
2125
|
+
shipToRegion = resolved.region || void 0;
|
|
2126
|
+
if (!agent.defaultAddressId) {
|
|
2127
|
+
updateAgent(agent.name, { defaultAddressId: resolved.id });
|
|
2123
2128
|
}
|
|
2124
|
-
|
|
2129
|
+
spinner.text = `Searching for "${query}" (delivering to: ${[shipToCity, shipToCountry].filter(Boolean).join(", ")})...`;
|
|
2125
2130
|
}
|
|
2131
|
+
} catch {
|
|
2126
2132
|
}
|
|
2127
2133
|
}
|
|
2128
2134
|
if (!shipToCountry) {
|
|
@@ -4581,7 +4587,7 @@ function registerFeedbackCommands(program2) {
|
|
|
4581
4587
|
|
|
4582
4588
|
// src/index.ts
|
|
4583
4589
|
var program = new Command();
|
|
4584
|
-
program.name("clishop").version("
|
|
4590
|
+
program.name("clishop").version("1.1.0").description(
|
|
4585
4591
|
chalk15.bold("CLISHOP") + ' \u2014 Order anything from your terminal.\n\n Use agents to set safety limits, addresses, and payment methods.\n The "default" agent is used when no agent is specified.'
|
|
4586
4592
|
).option("--agent <name>", "Use a specific agent for this command").hook("preAction", (thisCommand) => {
|
|
4587
4593
|
const agentOpt = thisCommand.opts().agent;
|
package/dist/mcp.js
CHANGED
|
@@ -13810,7 +13810,7 @@ function safeCall(fn) {
|
|
|
13810
13810
|
var server = new McpServer(
|
|
13811
13811
|
{
|
|
13812
13812
|
name: "clishop",
|
|
13813
|
-
version: "
|
|
13813
|
+
version: "1.2.0"
|
|
13814
13814
|
},
|
|
13815
13815
|
{
|
|
13816
13816
|
capabilities: {
|
|
@@ -14101,9 +14101,12 @@ server.registerTool("add_address", {
|
|
|
14101
14101
|
taxId: args.taxId || void 0,
|
|
14102
14102
|
instructions: args.instructions || void 0
|
|
14103
14103
|
});
|
|
14104
|
-
if (
|
|
14105
|
-
const
|
|
14106
|
-
|
|
14104
|
+
if (res.data.address?.id) {
|
|
14105
|
+
const shouldSetDefault = args.setDefault || !agent.defaultAddressId;
|
|
14106
|
+
if (shouldSetDefault) {
|
|
14107
|
+
const { updateAgent } = await import("./config-WZBIQWME.js");
|
|
14108
|
+
updateAgent(agent.name, { defaultAddressId: res.data.address.id });
|
|
14109
|
+
}
|
|
14107
14110
|
}
|
|
14108
14111
|
return res.data;
|
|
14109
14112
|
});
|
|
@@ -14123,8 +14126,18 @@ server.registerTool("remove_address", {
|
|
|
14123
14126
|
}
|
|
14124
14127
|
}, async (args) => {
|
|
14125
14128
|
return safeCall(async () => {
|
|
14129
|
+
const agent = getActiveAgent();
|
|
14126
14130
|
const api = getApiClient();
|
|
14127
14131
|
await api.delete(`/addresses/${args.addressId}`);
|
|
14132
|
+
const { updateAgent } = await import("./config-WZBIQWME.js");
|
|
14133
|
+
if (agent.defaultAddressId === args.addressId) {
|
|
14134
|
+
updateAgent(agent.name, { defaultAddressId: void 0 });
|
|
14135
|
+
}
|
|
14136
|
+
const remaining = await api.get("/addresses", { params: { agent: agent.name } });
|
|
14137
|
+
const addresses = remaining.data.addresses || [];
|
|
14138
|
+
if (addresses.length === 1) {
|
|
14139
|
+
updateAgent(agent.name, { defaultAddressId: addresses[0].id });
|
|
14140
|
+
}
|
|
14128
14141
|
return { success: true, message: "Address removed." };
|
|
14129
14142
|
});
|
|
14130
14143
|
});
|
|
@@ -14415,6 +14428,551 @@ server.registerTool("submit_feedback", {
|
|
|
14415
14428
|
return res.data;
|
|
14416
14429
|
});
|
|
14417
14430
|
});
|
|
14431
|
+
server.registerTool("add_product_review", {
|
|
14432
|
+
title: "Add Product Review",
|
|
14433
|
+
description: "Write a review for a product. Rating is on a 1-10 scale.",
|
|
14434
|
+
inputSchema: {
|
|
14435
|
+
productId: external_exports.string().describe("Product ID to review"),
|
|
14436
|
+
rating: external_exports.number().min(1).max(10).describe("Rating from 1 (terrible) to 10 (perfect)"),
|
|
14437
|
+
title: external_exports.string().describe("Review title"),
|
|
14438
|
+
body: external_exports.string().describe("Review body text"),
|
|
14439
|
+
orderId: external_exports.string().optional().describe("Associated order ID (optional)")
|
|
14440
|
+
},
|
|
14441
|
+
annotations: {
|
|
14442
|
+
title: "Add Product Review",
|
|
14443
|
+
readOnlyHint: false,
|
|
14444
|
+
destructiveHint: false,
|
|
14445
|
+
idempotentHint: false,
|
|
14446
|
+
openWorldHint: false
|
|
14447
|
+
}
|
|
14448
|
+
}, async (args) => {
|
|
14449
|
+
return safeCall(async () => {
|
|
14450
|
+
const api = getApiClient();
|
|
14451
|
+
const res = await api.post(`/products/${args.productId}/reviews`, {
|
|
14452
|
+
rating: args.rating,
|
|
14453
|
+
title: args.title,
|
|
14454
|
+
body: args.body,
|
|
14455
|
+
orderId: args.orderId || void 0
|
|
14456
|
+
});
|
|
14457
|
+
return res.data;
|
|
14458
|
+
});
|
|
14459
|
+
});
|
|
14460
|
+
server.registerTool("add_store_review", {
|
|
14461
|
+
title: "Add Store Review",
|
|
14462
|
+
description: "Write a review for a store. Rating is on a 1-10 scale.",
|
|
14463
|
+
inputSchema: {
|
|
14464
|
+
storeId: external_exports.string().describe("Store ID to review"),
|
|
14465
|
+
rating: external_exports.number().min(1).max(10).describe("Rating from 1 (terrible) to 10 (perfect)"),
|
|
14466
|
+
title: external_exports.string().describe("Review title"),
|
|
14467
|
+
body: external_exports.string().describe("Review body text"),
|
|
14468
|
+
orderId: external_exports.string().optional().describe("Associated order ID (optional)")
|
|
14469
|
+
},
|
|
14470
|
+
annotations: {
|
|
14471
|
+
title: "Add Store Review",
|
|
14472
|
+
readOnlyHint: false,
|
|
14473
|
+
destructiveHint: false,
|
|
14474
|
+
idempotentHint: false,
|
|
14475
|
+
openWorldHint: false
|
|
14476
|
+
}
|
|
14477
|
+
}, async (args) => {
|
|
14478
|
+
return safeCall(async () => {
|
|
14479
|
+
const api = getApiClient();
|
|
14480
|
+
const res = await api.post(`/stores/${args.storeId}/reviews`, {
|
|
14481
|
+
rating: args.rating,
|
|
14482
|
+
title: args.title,
|
|
14483
|
+
body: args.body,
|
|
14484
|
+
orderId: args.orderId || void 0
|
|
14485
|
+
});
|
|
14486
|
+
return res.data;
|
|
14487
|
+
});
|
|
14488
|
+
});
|
|
14489
|
+
server.registerTool("list_reviews", {
|
|
14490
|
+
title: "List My Reviews",
|
|
14491
|
+
description: "List all product and store reviews you have written.",
|
|
14492
|
+
inputSchema: {},
|
|
14493
|
+
annotations: {
|
|
14494
|
+
title: "List My Reviews",
|
|
14495
|
+
readOnlyHint: true,
|
|
14496
|
+
openWorldHint: false
|
|
14497
|
+
}
|
|
14498
|
+
}, async () => {
|
|
14499
|
+
return safeCall(async () => {
|
|
14500
|
+
const api = getApiClient();
|
|
14501
|
+
const res = await api.get("/reviews/mine");
|
|
14502
|
+
return res.data;
|
|
14503
|
+
});
|
|
14504
|
+
});
|
|
14505
|
+
server.registerTool("get_product_rating", {
|
|
14506
|
+
title: "Get Product Rating",
|
|
14507
|
+
description: "View rating details for a product including review count, Bayesian average, and effective cap.",
|
|
14508
|
+
inputSchema: {
|
|
14509
|
+
productId: external_exports.string().describe("Product ID")
|
|
14510
|
+
},
|
|
14511
|
+
annotations: {
|
|
14512
|
+
title: "Get Product Rating",
|
|
14513
|
+
readOnlyHint: true,
|
|
14514
|
+
openWorldHint: true
|
|
14515
|
+
}
|
|
14516
|
+
}, async (args) => {
|
|
14517
|
+
return safeCall(async () => {
|
|
14518
|
+
const api = getApiClient();
|
|
14519
|
+
const res = await api.get(`/products/${args.productId}/rating`);
|
|
14520
|
+
return res.data;
|
|
14521
|
+
});
|
|
14522
|
+
});
|
|
14523
|
+
server.registerTool("get_store_rating", {
|
|
14524
|
+
title: "Get Store Rating",
|
|
14525
|
+
description: "View rating details for a store including review count, Bayesian average, and effective cap.",
|
|
14526
|
+
inputSchema: {
|
|
14527
|
+
storeId: external_exports.string().describe("Store ID")
|
|
14528
|
+
},
|
|
14529
|
+
annotations: {
|
|
14530
|
+
title: "Get Store Rating",
|
|
14531
|
+
readOnlyHint: true,
|
|
14532
|
+
openWorldHint: true
|
|
14533
|
+
}
|
|
14534
|
+
}, async (args) => {
|
|
14535
|
+
return safeCall(async () => {
|
|
14536
|
+
const api = getApiClient();
|
|
14537
|
+
const res = await api.get(`/stores/${args.storeId}/rating`);
|
|
14538
|
+
return res.data;
|
|
14539
|
+
});
|
|
14540
|
+
});
|
|
14541
|
+
server.registerTool("delete_review", {
|
|
14542
|
+
title: "Delete Review",
|
|
14543
|
+
description: "Delete one of your reviews (product or store).",
|
|
14544
|
+
inputSchema: {
|
|
14545
|
+
reviewId: external_exports.string().describe("Review ID to delete"),
|
|
14546
|
+
isStoreReview: external_exports.boolean().optional().describe("Set to true if this is a store review (default: product review)")
|
|
14547
|
+
},
|
|
14548
|
+
annotations: {
|
|
14549
|
+
title: "Delete Review",
|
|
14550
|
+
readOnlyHint: false,
|
|
14551
|
+
destructiveHint: true,
|
|
14552
|
+
idempotentHint: true,
|
|
14553
|
+
openWorldHint: false
|
|
14554
|
+
}
|
|
14555
|
+
}, async (args) => {
|
|
14556
|
+
return safeCall(async () => {
|
|
14557
|
+
const api = getApiClient();
|
|
14558
|
+
const endpoint = args.isStoreReview ? `/stores/reviews/${args.reviewId}` : `/products/reviews/${args.reviewId}`;
|
|
14559
|
+
await api.delete(endpoint);
|
|
14560
|
+
return { success: true, message: "Review deleted." };
|
|
14561
|
+
});
|
|
14562
|
+
});
|
|
14563
|
+
server.registerTool("list_advertise_requests", {
|
|
14564
|
+
title: "List Advertise Requests",
|
|
14565
|
+
description: "List your advertised requests where vendors can bid to fulfill them.",
|
|
14566
|
+
inputSchema: {
|
|
14567
|
+
status: external_exports.enum(["open", "closed", "accepted", "cancelled", "expired"]).optional().describe("Filter by status"),
|
|
14568
|
+
page: external_exports.number().optional().describe("Page number")
|
|
14569
|
+
},
|
|
14570
|
+
annotations: {
|
|
14571
|
+
title: "List Advertise Requests",
|
|
14572
|
+
readOnlyHint: true,
|
|
14573
|
+
openWorldHint: false
|
|
14574
|
+
}
|
|
14575
|
+
}, async (args) => {
|
|
14576
|
+
return safeCall(async () => {
|
|
14577
|
+
const api = getApiClient();
|
|
14578
|
+
const res = await api.get("/advertise", {
|
|
14579
|
+
params: { status: args.status, page: args.page }
|
|
14580
|
+
});
|
|
14581
|
+
return res.data;
|
|
14582
|
+
});
|
|
14583
|
+
});
|
|
14584
|
+
server.registerTool("get_advertise_request", {
|
|
14585
|
+
title: "Get Advertise Request",
|
|
14586
|
+
description: "View an advertised request and its vendor bids.",
|
|
14587
|
+
inputSchema: {
|
|
14588
|
+
advertiseId: external_exports.string().describe("Advertise request ID")
|
|
14589
|
+
},
|
|
14590
|
+
annotations: {
|
|
14591
|
+
title: "Get Advertise Request",
|
|
14592
|
+
readOnlyHint: true,
|
|
14593
|
+
openWorldHint: false
|
|
14594
|
+
}
|
|
14595
|
+
}, async (args) => {
|
|
14596
|
+
return safeCall(async () => {
|
|
14597
|
+
const api = getApiClient();
|
|
14598
|
+
const res = await api.get(`/advertise/${args.advertiseId}`);
|
|
14599
|
+
return res.data;
|
|
14600
|
+
});
|
|
14601
|
+
});
|
|
14602
|
+
server.registerTool("accept_advertise_bid", {
|
|
14603
|
+
title: "Accept Advertise Bid",
|
|
14604
|
+
description: "Accept a vendor's bid on your advertised request. All other bids will be automatically rejected.",
|
|
14605
|
+
inputSchema: {
|
|
14606
|
+
advertiseId: external_exports.string().describe("Advertise request ID"),
|
|
14607
|
+
bidId: external_exports.string().describe("Bid ID to accept")
|
|
14608
|
+
},
|
|
14609
|
+
annotations: {
|
|
14610
|
+
title: "Accept Advertise Bid",
|
|
14611
|
+
readOnlyHint: false,
|
|
14612
|
+
destructiveHint: false,
|
|
14613
|
+
idempotentHint: false,
|
|
14614
|
+
openWorldHint: false
|
|
14615
|
+
}
|
|
14616
|
+
}, async (args) => {
|
|
14617
|
+
return safeCall(async () => {
|
|
14618
|
+
const api = getApiClient();
|
|
14619
|
+
const res = await api.post(`/advertise/${args.advertiseId}/bids/${args.bidId}/accept`);
|
|
14620
|
+
return res.data;
|
|
14621
|
+
});
|
|
14622
|
+
});
|
|
14623
|
+
server.registerTool("reject_advertise_bid", {
|
|
14624
|
+
title: "Reject Advertise Bid",
|
|
14625
|
+
description: "Reject a vendor's bid on your advertised request.",
|
|
14626
|
+
inputSchema: {
|
|
14627
|
+
advertiseId: external_exports.string().describe("Advertise request ID"),
|
|
14628
|
+
bidId: external_exports.string().describe("Bid ID to reject")
|
|
14629
|
+
},
|
|
14630
|
+
annotations: {
|
|
14631
|
+
title: "Reject Advertise Bid",
|
|
14632
|
+
readOnlyHint: false,
|
|
14633
|
+
destructiveHint: false,
|
|
14634
|
+
idempotentHint: false,
|
|
14635
|
+
openWorldHint: false
|
|
14636
|
+
}
|
|
14637
|
+
}, async (args) => {
|
|
14638
|
+
return safeCall(async () => {
|
|
14639
|
+
const api = getApiClient();
|
|
14640
|
+
const res = await api.post(`/advertise/${args.advertiseId}/bids/${args.bidId}/reject`);
|
|
14641
|
+
return res.data;
|
|
14642
|
+
});
|
|
14643
|
+
});
|
|
14644
|
+
server.registerTool("cancel_advertise_request", {
|
|
14645
|
+
title: "Cancel Advertise Request",
|
|
14646
|
+
description: "Cancel an open advertised request.",
|
|
14647
|
+
inputSchema: {
|
|
14648
|
+
advertiseId: external_exports.string().describe("Advertise request ID to cancel")
|
|
14649
|
+
},
|
|
14650
|
+
annotations: {
|
|
14651
|
+
title: "Cancel Advertise Request",
|
|
14652
|
+
readOnlyHint: false,
|
|
14653
|
+
destructiveHint: true,
|
|
14654
|
+
idempotentHint: false,
|
|
14655
|
+
openWorldHint: false
|
|
14656
|
+
}
|
|
14657
|
+
}, async (args) => {
|
|
14658
|
+
return safeCall(async () => {
|
|
14659
|
+
const api = getApiClient();
|
|
14660
|
+
const res = await api.post(`/advertise/${args.advertiseId}/cancel`);
|
|
14661
|
+
return res.data;
|
|
14662
|
+
});
|
|
14663
|
+
});
|
|
14664
|
+
server.registerTool("get_support_ticket", {
|
|
14665
|
+
title: "Get Support Ticket",
|
|
14666
|
+
description: "View a support ticket and its full message history.",
|
|
14667
|
+
inputSchema: {
|
|
14668
|
+
ticketId: external_exports.string().describe("Support ticket ID")
|
|
14669
|
+
},
|
|
14670
|
+
annotations: {
|
|
14671
|
+
title: "Get Support Ticket",
|
|
14672
|
+
readOnlyHint: true,
|
|
14673
|
+
openWorldHint: false
|
|
14674
|
+
}
|
|
14675
|
+
}, async (args) => {
|
|
14676
|
+
return safeCall(async () => {
|
|
14677
|
+
const api = getApiClient();
|
|
14678
|
+
const res = await api.get(`/support/${args.ticketId}`);
|
|
14679
|
+
return res.data;
|
|
14680
|
+
});
|
|
14681
|
+
});
|
|
14682
|
+
server.registerTool("reply_to_support_ticket", {
|
|
14683
|
+
title: "Reply to Support Ticket",
|
|
14684
|
+
description: "Send a reply message to an existing support ticket.",
|
|
14685
|
+
inputSchema: {
|
|
14686
|
+
ticketId: external_exports.string().describe("Support ticket ID"),
|
|
14687
|
+
message: external_exports.string().describe("Reply message text")
|
|
14688
|
+
},
|
|
14689
|
+
annotations: {
|
|
14690
|
+
title: "Reply to Support Ticket",
|
|
14691
|
+
readOnlyHint: false,
|
|
14692
|
+
destructiveHint: false,
|
|
14693
|
+
idempotentHint: false,
|
|
14694
|
+
openWorldHint: false
|
|
14695
|
+
}
|
|
14696
|
+
}, async (args) => {
|
|
14697
|
+
return safeCall(async () => {
|
|
14698
|
+
const api = getApiClient();
|
|
14699
|
+
const res = await api.post(`/support/${args.ticketId}/reply`, {
|
|
14700
|
+
message: args.message
|
|
14701
|
+
});
|
|
14702
|
+
return res.data;
|
|
14703
|
+
});
|
|
14704
|
+
});
|
|
14705
|
+
server.registerTool("close_support_ticket", {
|
|
14706
|
+
title: "Close Support Ticket",
|
|
14707
|
+
description: "Close a resolved support ticket.",
|
|
14708
|
+
inputSchema: {
|
|
14709
|
+
ticketId: external_exports.string().describe("Support ticket ID to close")
|
|
14710
|
+
},
|
|
14711
|
+
annotations: {
|
|
14712
|
+
title: "Close Support Ticket",
|
|
14713
|
+
readOnlyHint: false,
|
|
14714
|
+
destructiveHint: false,
|
|
14715
|
+
idempotentHint: true,
|
|
14716
|
+
openWorldHint: false
|
|
14717
|
+
}
|
|
14718
|
+
}, async (args) => {
|
|
14719
|
+
return safeCall(async () => {
|
|
14720
|
+
const api = getApiClient();
|
|
14721
|
+
const res = await api.patch(`/support/${args.ticketId}/status`, { status: "closed" });
|
|
14722
|
+
return res.data;
|
|
14723
|
+
});
|
|
14724
|
+
});
|
|
14725
|
+
server.registerTool("create_agent", {
|
|
14726
|
+
title: "Create Agent",
|
|
14727
|
+
description: "Create a new agent (safety profile) with spending limits and category restrictions.",
|
|
14728
|
+
inputSchema: {
|
|
14729
|
+
name: external_exports.string().describe("Agent name (e.g. 'work', 'personal', 'gifts')"),
|
|
14730
|
+
maxOrderAmount: external_exports.number().optional().describe("Max order amount in dollars (e.g. 100)"),
|
|
14731
|
+
requireConfirmation: external_exports.boolean().optional().describe("Require confirmation before ordering (default: true)"),
|
|
14732
|
+
allowedCategories: external_exports.array(external_exports.string()).optional().describe("Only allow these categories"),
|
|
14733
|
+
blockedCategories: external_exports.array(external_exports.string()).optional().describe("Block these categories")
|
|
14734
|
+
},
|
|
14735
|
+
annotations: {
|
|
14736
|
+
title: "Create Agent",
|
|
14737
|
+
readOnlyHint: false,
|
|
14738
|
+
destructiveHint: false,
|
|
14739
|
+
idempotentHint: false,
|
|
14740
|
+
openWorldHint: false
|
|
14741
|
+
}
|
|
14742
|
+
}, async (args) => {
|
|
14743
|
+
return safeCall(async () => {
|
|
14744
|
+
const { createAgent } = await import("./config-WZBIQWME.js");
|
|
14745
|
+
const agent = createAgent(args.name, {
|
|
14746
|
+
maxOrderAmount: args.maxOrderAmount,
|
|
14747
|
+
requireConfirmation: args.requireConfirmation ?? true,
|
|
14748
|
+
allowedCategories: args.allowedCategories,
|
|
14749
|
+
blockedCategories: args.blockedCategories
|
|
14750
|
+
});
|
|
14751
|
+
return { success: true, agent };
|
|
14752
|
+
});
|
|
14753
|
+
});
|
|
14754
|
+
server.registerTool("switch_agent", {
|
|
14755
|
+
title: "Switch Active Agent",
|
|
14756
|
+
description: "Switch which agent (safety profile) is active. The active agent controls spending limits and defaults.",
|
|
14757
|
+
inputSchema: {
|
|
14758
|
+
name: external_exports.string().describe("Agent name to switch to")
|
|
14759
|
+
},
|
|
14760
|
+
annotations: {
|
|
14761
|
+
title: "Switch Active Agent",
|
|
14762
|
+
readOnlyHint: false,
|
|
14763
|
+
destructiveHint: false,
|
|
14764
|
+
idempotentHint: true,
|
|
14765
|
+
openWorldHint: false
|
|
14766
|
+
}
|
|
14767
|
+
}, async (args) => {
|
|
14768
|
+
return safeCall(async () => {
|
|
14769
|
+
const { setActiveAgent } = await import("./config-WZBIQWME.js");
|
|
14770
|
+
setActiveAgent(args.name);
|
|
14771
|
+
return { success: true, activeAgent: args.name };
|
|
14772
|
+
});
|
|
14773
|
+
});
|
|
14774
|
+
server.registerTool("get_agent", {
|
|
14775
|
+
title: "Get Agent Details",
|
|
14776
|
+
description: "Show details of a specific agent (safety profile) including limits, categories, and defaults.",
|
|
14777
|
+
inputSchema: {
|
|
14778
|
+
name: external_exports.string().optional().describe("Agent name (defaults to active agent)")
|
|
14779
|
+
},
|
|
14780
|
+
annotations: {
|
|
14781
|
+
title: "Get Agent Details",
|
|
14782
|
+
readOnlyHint: true,
|
|
14783
|
+
openWorldHint: false
|
|
14784
|
+
}
|
|
14785
|
+
}, async (args) => {
|
|
14786
|
+
return safeCall(async () => {
|
|
14787
|
+
const { getAgent, getConfig: getConfig2 } = await import("./config-WZBIQWME.js");
|
|
14788
|
+
const agentName = args.name || getConfig2().get("activeAgent");
|
|
14789
|
+
const agent = getAgent(agentName);
|
|
14790
|
+
if (!agent) throw new Error(`Agent "${agentName}" not found.`);
|
|
14791
|
+
return { agent, isActive: agentName === getConfig2().get("activeAgent") };
|
|
14792
|
+
});
|
|
14793
|
+
});
|
|
14794
|
+
server.registerTool("update_agent", {
|
|
14795
|
+
title: "Update Agent",
|
|
14796
|
+
description: "Update an agent's settings (spending limits, category restrictions, confirmation preference).",
|
|
14797
|
+
inputSchema: {
|
|
14798
|
+
name: external_exports.string().optional().describe("Agent name (defaults to active agent)"),
|
|
14799
|
+
maxOrderAmount: external_exports.number().optional().describe("Max order amount in dollars"),
|
|
14800
|
+
requireConfirmation: external_exports.boolean().optional().describe("Require confirmation before ordering"),
|
|
14801
|
+
allowedCategories: external_exports.array(external_exports.string()).optional().describe("Only allow these categories (empty = all)"),
|
|
14802
|
+
blockedCategories: external_exports.array(external_exports.string()).optional().describe("Block these categories (empty = none)"),
|
|
14803
|
+
defaultAddressId: external_exports.string().optional().describe("Default shipping address ID"),
|
|
14804
|
+
defaultPaymentMethodId: external_exports.string().optional().describe("Default payment method ID")
|
|
14805
|
+
},
|
|
14806
|
+
annotations: {
|
|
14807
|
+
title: "Update Agent",
|
|
14808
|
+
readOnlyHint: false,
|
|
14809
|
+
destructiveHint: false,
|
|
14810
|
+
idempotentHint: true,
|
|
14811
|
+
openWorldHint: false
|
|
14812
|
+
}
|
|
14813
|
+
}, async (args) => {
|
|
14814
|
+
return safeCall(async () => {
|
|
14815
|
+
const { updateAgent, getAgent, getConfig: getConfig2 } = await import("./config-WZBIQWME.js");
|
|
14816
|
+
const agentName = args.name || getConfig2().get("activeAgent");
|
|
14817
|
+
const existing = getAgent(agentName);
|
|
14818
|
+
if (!existing) throw new Error(`Agent "${agentName}" not found.`);
|
|
14819
|
+
const updates = {};
|
|
14820
|
+
if (args.maxOrderAmount !== void 0) updates.maxOrderAmount = args.maxOrderAmount;
|
|
14821
|
+
if (args.requireConfirmation !== void 0) updates.requireConfirmation = args.requireConfirmation;
|
|
14822
|
+
if (args.allowedCategories !== void 0) updates.allowedCategories = args.allowedCategories;
|
|
14823
|
+
if (args.blockedCategories !== void 0) updates.blockedCategories = args.blockedCategories;
|
|
14824
|
+
if (args.defaultAddressId !== void 0) updates.defaultAddressId = args.defaultAddressId;
|
|
14825
|
+
if (args.defaultPaymentMethodId !== void 0) updates.defaultPaymentMethodId = args.defaultPaymentMethodId;
|
|
14826
|
+
const updated = updateAgent(agentName, updates);
|
|
14827
|
+
return { success: true, agent: updated };
|
|
14828
|
+
});
|
|
14829
|
+
});
|
|
14830
|
+
server.registerTool("get_spending_limit", {
|
|
14831
|
+
title: "Get Spending Limit",
|
|
14832
|
+
description: "View the current monthly spending limit.",
|
|
14833
|
+
inputSchema: {},
|
|
14834
|
+
annotations: {
|
|
14835
|
+
title: "Get Spending Limit",
|
|
14836
|
+
readOnlyHint: true,
|
|
14837
|
+
openWorldHint: false
|
|
14838
|
+
}
|
|
14839
|
+
}, async () => {
|
|
14840
|
+
return safeCall(async () => {
|
|
14841
|
+
const api = getApiClient();
|
|
14842
|
+
const res = await api.get("/spending-limit");
|
|
14843
|
+
return res.data;
|
|
14844
|
+
});
|
|
14845
|
+
});
|
|
14846
|
+
server.registerTool("set_spending_limit", {
|
|
14847
|
+
title: "Set Spending Limit",
|
|
14848
|
+
description: "Change your monthly spending limit. May require email confirmation for security.",
|
|
14849
|
+
inputSchema: {
|
|
14850
|
+
amountInDollars: external_exports.number().min(1).describe("New monthly spending limit in dollars (minimum $1)")
|
|
14851
|
+
},
|
|
14852
|
+
annotations: {
|
|
14853
|
+
title: "Set Spending Limit",
|
|
14854
|
+
readOnlyHint: false,
|
|
14855
|
+
destructiveHint: false,
|
|
14856
|
+
idempotentHint: true,
|
|
14857
|
+
openWorldHint: false
|
|
14858
|
+
}
|
|
14859
|
+
}, async (args) => {
|
|
14860
|
+
return safeCall(async () => {
|
|
14861
|
+
const api = getApiClient();
|
|
14862
|
+
const limitInCents = Math.round(args.amountInDollars * 100);
|
|
14863
|
+
const res = await api.patch("/spending-limit", { limitInCents });
|
|
14864
|
+
return res.data;
|
|
14865
|
+
});
|
|
14866
|
+
});
|
|
14867
|
+
server.registerTool("remove_payment_method", {
|
|
14868
|
+
title: "Remove Payment Method",
|
|
14869
|
+
description: "Remove a saved payment method by its ID.",
|
|
14870
|
+
inputSchema: {
|
|
14871
|
+
paymentMethodId: external_exports.string().describe("Payment method ID to remove")
|
|
14872
|
+
},
|
|
14873
|
+
annotations: {
|
|
14874
|
+
title: "Remove Payment Method",
|
|
14875
|
+
readOnlyHint: false,
|
|
14876
|
+
destructiveHint: true,
|
|
14877
|
+
idempotentHint: true,
|
|
14878
|
+
openWorldHint: false
|
|
14879
|
+
}
|
|
14880
|
+
}, async (args) => {
|
|
14881
|
+
return safeCall(async () => {
|
|
14882
|
+
const api = getApiClient();
|
|
14883
|
+
await api.delete(`/payment-methods/${args.paymentMethodId}`);
|
|
14884
|
+
const { getActiveAgent: getActiveAgent2, updateAgent } = await import("./config-WZBIQWME.js");
|
|
14885
|
+
const agent = getActiveAgent2();
|
|
14886
|
+
if (agent.defaultPaymentMethodId === args.paymentMethodId) {
|
|
14887
|
+
updateAgent(agent.name, { defaultPaymentMethodId: void 0 });
|
|
14888
|
+
}
|
|
14889
|
+
return { success: true, message: "Payment method removed." };
|
|
14890
|
+
});
|
|
14891
|
+
});
|
|
14892
|
+
server.registerTool("set_default_payment_method", {
|
|
14893
|
+
title: "Set Default Payment Method",
|
|
14894
|
+
description: "Set the default payment method for the active agent.",
|
|
14895
|
+
inputSchema: {
|
|
14896
|
+
paymentMethodId: external_exports.string().describe("Payment method ID to set as default")
|
|
14897
|
+
},
|
|
14898
|
+
annotations: {
|
|
14899
|
+
title: "Set Default Payment Method",
|
|
14900
|
+
readOnlyHint: false,
|
|
14901
|
+
destructiveHint: false,
|
|
14902
|
+
idempotentHint: true,
|
|
14903
|
+
openWorldHint: false
|
|
14904
|
+
}
|
|
14905
|
+
}, async (args) => {
|
|
14906
|
+
return safeCall(async () => {
|
|
14907
|
+
const { getActiveAgent: getActiveAgent2, updateAgent } = await import("./config-WZBIQWME.js");
|
|
14908
|
+
const agent = getActiveAgent2();
|
|
14909
|
+
updateAgent(agent.name, { defaultPaymentMethodId: args.paymentMethodId });
|
|
14910
|
+
return { success: true, message: `Default payment for agent "${agent.name}" set to ${args.paymentMethodId}.` };
|
|
14911
|
+
});
|
|
14912
|
+
});
|
|
14913
|
+
server.registerTool("set_default_address", {
|
|
14914
|
+
title: "Set Default Address",
|
|
14915
|
+
description: "Set the default shipping address for the active agent.",
|
|
14916
|
+
inputSchema: {
|
|
14917
|
+
addressId: external_exports.string().describe("Address ID to set as default")
|
|
14918
|
+
},
|
|
14919
|
+
annotations: {
|
|
14920
|
+
title: "Set Default Address",
|
|
14921
|
+
readOnlyHint: false,
|
|
14922
|
+
destructiveHint: false,
|
|
14923
|
+
idempotentHint: true,
|
|
14924
|
+
openWorldHint: false
|
|
14925
|
+
}
|
|
14926
|
+
}, async (args) => {
|
|
14927
|
+
return safeCall(async () => {
|
|
14928
|
+
const { getActiveAgent: getActiveAgent2, updateAgent } = await import("./config-WZBIQWME.js");
|
|
14929
|
+
const agent = getActiveAgent2();
|
|
14930
|
+
updateAgent(agent.name, { defaultAddressId: args.addressId });
|
|
14931
|
+
return { success: true, message: `Default address for agent "${agent.name}" set to ${args.addressId}.` };
|
|
14932
|
+
});
|
|
14933
|
+
});
|
|
14934
|
+
server.registerTool("list_feedback", {
|
|
14935
|
+
title: "List Feedback",
|
|
14936
|
+
description: "List your submitted bug reports and suggestions.",
|
|
14937
|
+
inputSchema: {
|
|
14938
|
+
type: external_exports.enum(["bug", "suggestion"]).optional().describe("Filter by feedback type"),
|
|
14939
|
+
status: external_exports.string().optional().describe("Filter by status (open, acknowledged, in_progress, fixed, wont_fix, closed)")
|
|
14940
|
+
},
|
|
14941
|
+
annotations: {
|
|
14942
|
+
title: "List Feedback",
|
|
14943
|
+
readOnlyHint: true,
|
|
14944
|
+
openWorldHint: false
|
|
14945
|
+
}
|
|
14946
|
+
}, async (args) => {
|
|
14947
|
+
return safeCall(async () => {
|
|
14948
|
+
const api = getApiClient();
|
|
14949
|
+
const res = await api.get("/feedback", {
|
|
14950
|
+
params: {
|
|
14951
|
+
...args.type ? { type: args.type } : {},
|
|
14952
|
+
...args.status ? { status: args.status } : {}
|
|
14953
|
+
}
|
|
14954
|
+
});
|
|
14955
|
+
return res.data;
|
|
14956
|
+
});
|
|
14957
|
+
});
|
|
14958
|
+
server.registerTool("get_feedback", {
|
|
14959
|
+
title: "Get Feedback Details",
|
|
14960
|
+
description: "View details of a specific bug report or suggestion by ID.",
|
|
14961
|
+
inputSchema: {
|
|
14962
|
+
feedbackId: external_exports.string().describe("Feedback ID")
|
|
14963
|
+
},
|
|
14964
|
+
annotations: {
|
|
14965
|
+
title: "Get Feedback Details",
|
|
14966
|
+
readOnlyHint: true,
|
|
14967
|
+
openWorldHint: false
|
|
14968
|
+
}
|
|
14969
|
+
}, async (args) => {
|
|
14970
|
+
return safeCall(async () => {
|
|
14971
|
+
const api = getApiClient();
|
|
14972
|
+
const res = await api.get(`/feedback/${args.feedbackId}`);
|
|
14973
|
+
return res.data;
|
|
14974
|
+
});
|
|
14975
|
+
});
|
|
14418
14976
|
async function startMcpServer() {
|
|
14419
14977
|
const transport = new StdioServerTransport();
|
|
14420
14978
|
await server.connect(transport);
|