Skip to main content
Glama
OFODevelopment

cerebrochain-mcp-server

check_stock_levels

Retrieve current stock levels for inventory items, showing quantity on hand, reserved, and available to manage warehouse inventory effectively.

Instructions

Get current stock levels for a specific inventory item by ID. Returns quantity on hand, reserved, available. Requires API key.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
item_idYesInventory item ID

Implementation Reference

  • The handler function for check_stock_levels tool. Validates authentication, calls client.get() to fetch stock levels from /inventory/items/{item_id}/stock endpoint, and returns formatted JSON response.
    server.tool(
      'check_stock_levels',
      'Get current stock levels for a specific inventory item by ID. Returns quantity on hand, reserved, available. Requires API key.',
      {
        item_id: z.string().describe('Inventory item ID'),
      },
      async (params) => {
        if (!client.isAuthenticated) {
          return { content: [{ type: 'text' as const, text: 'Error: API key required.' }] };
        }
        const response = await client.get(`/inventory/items/${params.item_id}/stock`);
        if (!response.ok) return { content: [{ type: 'text' as const, text: `Error: ${response.error}` }] };
        return { content: [{ type: 'text' as const, text: JSON.stringify(response.data, null, 2) }] };
      },
    );
  • src/index.ts:111-125 (registration)
    Registration of the check_stock_levels tool with MCP server using server.tool(). Includes name, description, input schema (item_id), and inline handler function.
    server.tool(
      'check_stock_levels',
      'Get current stock levels for a specific inventory item by ID. Returns quantity on hand, reserved, available. Requires API key.',
      {
        item_id: z.string().describe('Inventory item ID'),
      },
      async (params) => {
        if (!client.isAuthenticated) {
          return { content: [{ type: 'text' as const, text: 'Error: API key required.' }] };
        }
        const response = await client.get(`/inventory/items/${params.item_id}/stock`);
        if (!response.ok) return { content: [{ type: 'text' as const, text: `Error: ${response.error}` }] };
        return { content: [{ type: 'text' as const, text: JSON.stringify(response.data, null, 2) }] };
      },
    );
  • Zod schema definition for check_stock_levels tool input validation. Defines item_id as a required string parameter.
    {
      item_id: z.string().describe('Inventory item ID'),
    },
  • CerebroChainClient.get() helper method used by the handler to make authenticated GET requests to the inventory API. Wraps the generic request() method.
    async get<T = unknown>(path: string, query?: Record<string, string>): Promise<ApiResponse<T>> {
      return this.request<T>({ method: 'GET', path, query });
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full disclosure burden. Compensates well by detailing return values ('quantity on hand, reserved, available') absent from output schema, and notes 'Requires API key' auth constraint. Could improve by mentioning if data is real-time or cached.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences with zero waste: (1) purpose and target, (2) return value disclosure, (3) auth requirement. Each sentence adds distinct value not present in structured fields. Front-loaded with the most critical information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single-parameter read operation, description is nearly complete. Successfully compensates for missing output schema by enumerating return fields. Lacks only minor behavioral details like error conditions or rate limiting to achieve completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema has 100% description coverage ('Inventory item ID'), establishing baseline 3. Description reinforces 'by ID' usage but doesn't add syntax details, format examples, or validation rules beyond what the schema already provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clear specific verb ('Get') + resource ('stock levels') + scope ('by ID'). Effectively distinguishes from sibling 'search_inventory' (which implies broad querying) and 'lookup_sku' (which focuses on SKU mapping rather than stock quantities).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides implied usage context through 'by ID' phrasing, suggesting specific item lookup rather than search. However, lacks explicit guidance on when to use this versus 'search_inventory' or 'lookup_sku', or prerequisites like needing the item_id beforehand.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/OFODevelopment/cerebrochain-mcp-server'

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