|
@@ -264,12 +264,22 @@ async function handleGetOrder(args: Record<string, any>): Promise<ToolCallResult
|
|
|
// The order_id parameter is actually the innerId from the customer's perspective
|
|
// The order_id parameter is actually the innerId from the customer's perspective
|
|
|
console.log('[MCP ShopRenter] Fetching order with innerId:', order_id);
|
|
console.log('[MCP ShopRenter] Fetching order with innerId:', order_id);
|
|
|
const response = await fetchOrders(shop_id, 0, 1, { innerId: order_id });
|
|
const response = await fetchOrders(shop_id, 0, 1, { innerId: order_id });
|
|
|
|
|
+
|
|
|
|
|
+ console.log('[MCP ShopRenter] Raw response type:', typeof response, Array.isArray(response) ? 'array' : '');
|
|
|
|
|
+ console.log('[MCP ShopRenter] Response structure:', {
|
|
|
|
|
+ isArray: Array.isArray(response),
|
|
|
|
|
+ hasData: !!response?.data,
|
|
|
|
|
+ hasOrders: !!response?.orders,
|
|
|
|
|
+ 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.data || response.orders || []);
|
|
|
|
|
|
|
|
console.log('[MCP ShopRenter] API response:', { ordersCount: orders.length });
|
|
console.log('[MCP ShopRenter] API response:', { ordersCount: orders.length });
|
|
|
|
|
|
|
|
if (orders.length === 0) {
|
|
if (orders.length === 0) {
|
|
|
console.warn('[MCP ShopRenter] No order found with innerId:', order_id);
|
|
console.warn('[MCP ShopRenter] No order found with innerId:', order_id);
|
|
|
|
|
+ console.log('[MCP ShopRenter] Full response for debugging:', JSON.stringify(response).substring(0, 500));
|
|
|
return {
|
|
return {
|
|
|
content: [{
|
|
content: [{
|
|
|
type: 'text',
|
|
type: 'text',
|
|
@@ -278,7 +288,9 @@ async function handleGetOrder(args: Record<string, any>): Promise<ToolCallResult
|
|
|
debug: {
|
|
debug: {
|
|
|
shop_id,
|
|
shop_id,
|
|
|
store_name: store.store_name,
|
|
store_name: store.store_name,
|
|
|
- searched_innerId: order_id
|
|
|
|
|
|
|
+ searched_innerId: order_id,
|
|
|
|
|
+ responseType: typeof response,
|
|
|
|
|
+ responseKeys: response && typeof response === 'object' ? Object.keys(response) : []
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
}],
|
|
}],
|