rr_get_stockout_risk
Identify stockout risk levels for specific SKUs to prevent inventory shortages and optimize replenishment planning.
Instructions
Get stockout risk levels for SKUs
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| risk_level | No | ||
| sku | No | ||
| store_id | No | ||
| limit | No |
Implementation Reference
- src/index.ts:57-74 (handler)The generic handler function that dispatches tool calls to the ReplenishRadar API. All tools, including 'rr_get_stockout_risk', are handled through this function.
async function callApi(toolName: string, input: Record<string, unknown>): Promise<unknown> { const resp = await fetch(`${BASE_URL}/api/mcp/call`, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${API_KEY}`, }, body: JSON.stringify({ tool: toolName, input }), }); if (!resp.ok) { const errorBody = await resp.text(); throw new Error(`API error ${resp.status}: ${errorBody}`); } const data = await resp.json(); return data.result; } - src/index.ts:26-26 (registration)Registration of the 'rr_get_stockout_risk' tool in the TOOLS array.
{ name: 'rr_get_stockout_risk', description: 'Get stockout risk levels for SKUs', inputSchema: { type: 'object' as const, properties: { risk_level: { type: 'string', enum: ['critical', 'high', 'medium', 'low'] }, sku: { type: 'string' }, store_id: { type: 'string' }, limit: { type: 'number', default: 100 } } } },