Skip to main content
Glama

rr_get_inventory_value

Calculate total inventory value with breakdown for Shopify and Amazon stores to support purchase order management and stockout risk assessment.

Instructions

Get total inventory value breakdown

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
store_idNo

Implementation Reference

  • The handler that executes the rr_get_inventory_value tool. It extracts the tool name and arguments from the request, calls the callApi helper to make the HTTP request, and returns the result as JSON text content.
    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,
        };
      }
    });
  • The input schema for rr_get_inventory_value tool. Defines it accepts an optional store_id parameter of type string.
    { name: 'rr_get_inventory_value', description: 'Get total inventory value breakdown', inputSchema: { type: 'object' as const, properties: { store_id: { type: 'string' } } } },
  • src/index.ts:41-41 (registration)
    Registration of the rr_get_inventory_value tool in the TOOLS array, which is exposed via the ListToolsRequestSchema handler.
    { name: 'rr_get_inventory_value', description: 'Get total inventory value breakdown', inputSchema: { type: 'object' as const, properties: { store_id: { type: 'string' } } } },
  • The callApi helper function that makes the actual HTTP POST request to the ReplenishRadar API endpoint. It sends the tool name and input arguments, handles authentication with Bearer token, and returns the API result.
    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;
    }

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