rr_get_slow_movers
Identify slow-moving inventory items by analyzing SKU performance over a specified period, helping optimize stock levels and reduce excess inventory.
Instructions
Get slow-moving SKUs
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| days | No | ||
| limit | No | ||
| store_id | No |
Implementation Reference
- src/index.ts:40-40 (registration)Tool registration for 'rr_get_slow_movers' including its schema.
{ name: 'rr_get_slow_movers', description: 'Get slow-moving SKUs', inputSchema: { type: 'object' as const, properties: { days: { type: 'number', default: 30 }, limit: { type: 'number', default: 20 }, store_id: { type: 'string' } } } }, - src/index.ts:86-100 (handler)Generic handler that routes the tool call 'rr_get_slow_movers' to the 'callApi' function.
server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; try { const result = await callApi(name, (args as Record<string, unknown>) || {}); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } catch (error) { const message = error instanceof Error ? error.message : String(error); return { content: [{ type: 'text', text: `Error: ${message}` }], isError: true, }; } }); - src/index.ts:57-74 (helper)The 'callApi' helper function, which proxies the request to the backend REST API for all tool executions, including 'rr_get_slow_movers'.
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; }