rr_get_alerts
Retrieve active inventory alerts for Shopify and Amazon sellers to monitor stockout risks, demand forecasts, and purchase order issues with configurable filters.
Instructions
Get active alerts
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status | No | ||
| alert_type | No | ||
| severity | No | ||
| sku | No | ||
| store_id | No | ||
| limit | No | ||
| offset | No |
Implementation Reference
- src/index.ts:86-100 (handler)Generic handler for all tools, including rr_get_alerts, which dispatches requests to the external REST API via callApi.
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:30-30 (registration)Registration of the rr_get_alerts tool within the TOOLS array.
{ name: 'rr_get_alerts', description: 'Get active alerts', inputSchema: { type: 'object' as const, properties: { status: { type: 'string' }, alert_type: { type: 'string' }, severity: { type: 'string' }, sku: { type: 'string' }, store_id: { type: 'string' }, limit: { type: 'number' }, offset: { type: 'number' } } } }, - src/index.ts:57-74 (helper)Helper function that executes the actual API call for tools by sending the request to the backend.
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; }