|
|
@@ -197,7 +197,7 @@ async function fetchAllOrdersPages(
|
|
|
|
|
|
while (hasMore && page < maxPages) {
|
|
|
const response = await fetchOrders(shop_id, page, 100, filters);
|
|
|
- const orders = Array.isArray(response) ? response : (response.data || response.orders || []);
|
|
|
+ const orders = Array.isArray(response) ? response : (response.items || response.data || response.orders || []);
|
|
|
|
|
|
if (orders.length === 0) {
|
|
|
hasMore = false;
|
|
|
@@ -273,7 +273,7 @@ async function handleGetOrder(args: Record<string, any>): Promise<ToolCallResult
|
|
|
responseKeys: response && typeof response === 'object' ? Object.keys(response) : []
|
|
|
});
|
|
|
|
|
|
- const orders = Array.isArray(response) ? response : (response.data || response.orders || []);
|
|
|
+ const orders = Array.isArray(response) ? response : (response.items || response.data || response.orders || []);
|
|
|
|
|
|
console.log('[MCP ShopRenter] API response:', { ordersCount: orders.length });
|
|
|
|
|
|
@@ -398,7 +398,7 @@ async function handleListOrders(args: Record<string, any>): Promise<ToolCallResu
|
|
|
|
|
|
// Fetch orders from ShopRenter API
|
|
|
const response = await fetchOrders(shop_id, 0, actualLimit, filters);
|
|
|
- const orders = Array.isArray(response) ? response : (response.data || response.orders || []);
|
|
|
+ const orders = Array.isArray(response) ? response : (response.items || response.data || response.orders || []);
|
|
|
|
|
|
// Apply limit
|
|
|
const limitedOrders = orders.slice(0, actualLimit);
|