Skip to main content
Glama

rr_get_alerts

Retrieve active inventory alerts for Shopify and Amazon sellers to monitor stockout risks and manage purchase orders with human oversight.

Instructions

Get active alerts

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
statusNo
alert_typeNo
severityNo
skuNo
store_idNo
limitNo
offsetNo

Implementation Reference

  • src/index.ts:30-30 (registration)
    Tool registration: Defines the 'rr_get_alerts' tool with its name, description, and input schema including optional parameters for status, alert_type, severity, sku, store_id, limit, and offset
    { 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' } } } },
  • Handler: Processes all tool calls including 'rr_get_alerts' by extracting the tool name and arguments, calling the API, and returning the result or error message
    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,
        };
      }
    });
  • Helper function: Makes HTTP POST request to the ReplenishRadar API endpoint with the tool name and input parameters, handles authentication, and returns the API response or throws an error
    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;
    }
  • Input schema: Defines the validation schema for 'rr_get_alerts' with optional string parameters (status, alert_type, severity, sku, store_id) and optional number parameters (limit, offset)
    { 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' } } } },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ReplenishRadar/MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server