rr_get_lost_sales
Estimate lost sales due to stockouts by analyzing historical data to identify revenue opportunities from inventory gaps.
Instructions
Estimate lost sales from stockouts
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| days | No |
Implementation Reference
- src/index.ts:43-43 (registration)The tool 'rr_get_lost_sales' is registered in the TOOLS array within src/index.ts. The logic is delegated to the callApi function which forwards requests to a remote REST API.
{ name: 'rr_get_lost_sales', description: 'Estimate lost sales from stockouts', inputSchema: { type: 'object' as const, properties: { days: { type: 'number', default: 30 } } } }, - src/index.ts:57-74 (handler)The 'callApi' function serves as the handler for all tool calls, including 'rr_get_lost_sales'. It sends the tool request to a remote API endpoint.
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; }