Skip to main content
Glama
ilhankilic

YaparAI MCP Server

by ilhankilic

update_product_stock

Update product stock status to in_stock, out_of_stock, or preorder. Quickly manage inventory changes using product ID.

Instructions

Update a product's stock status.

Use this to quickly mark products as out of stock when inventory runs out, or to flip back to in_stock after restocking. For variant-level stock counts, see v0.6.0 roadmap.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
product_idYesUUID from list_org_products results
stock_statusYesin_stock | out_of_stock | preorder
org_idNoOptional — override the org bound to the API key

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Main handler function for the update_product_stock tool. Accepts product_id, stock_status (Literal["in_stock","out_of_stock","preorder"]), and optional org_id. Validates stock_status, then delegates to the client method enterprise_update_product_stock.
    async def update_product_stock(
        product_id: str,
        stock_status: Literal["in_stock", "out_of_stock", "preorder"],
        org_id: str | None = None,
    ) -> dict:
        """
        Update a product's stock status.
    
        Use this to quickly mark products as out of stock when inventory
        runs out, or to flip back to in_stock after restocking. For
        variant-level stock counts, see v0.6.0 roadmap.
    
        Args:
            product_id: UUID from list_org_products results
            stock_status: in_stock | out_of_stock | preorder
            org_id: Optional — override the org bound to the API key
    
        Returns:
            Updated product record.
        """
        if stock_status not in ("in_stock", "out_of_stock", "preorder"):
            raise ValueError("stock_status must be in_stock | out_of_stock | preorder")
        client = YaparAIClient()
        return await client.enterprise_update_product_stock(
            product_id, stock_status, org_id=org_id
        )
  • Input schema is defined via the function signature: product_id (str), stock_status (Literal["in_stock","out_of_stock","preorder"]), org_id (str | None). The return type is dict.
    async def update_product_stock(
        product_id: str,
        stock_status: Literal["in_stock", "out_of_stock", "preorder"],
        org_id: str | None = None,
  • Registration of update_product_stock as an MCP tool via mcp.tool(update_product_stock).
    mcp.tool(update_product_stock)
  • Import of update_product_stock from yaparai.tools.enterprise into server.py where it is registered.
    update_product_stock,
  • Client helper method enterprise_update_product_stock that makes the actual PATCH HTTP request to /v1/public/enterprise/products/{product_id}/stock with the stock_status payload.
    async def enterprise_update_product_stock(
        self, product_id: str, stock_status: str, org_id: str | None = None
    ) -> dict:
        headers = {"X-Organization-Id": org_id} if org_id else {}
        return await self._request(
            "PATCH",
            f"/v1/public/enterprise/products/{product_id}/stock",
            json={"stock_status": stock_status},
            headers=headers,
        )
Behavior2/5

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

No annotations provided, so description carries full burden. It says 'update' implying mutation, but doesn't disclose permissions, side effects, or whether changes are immediately visible. Lack of behavioral details reduces transparency.

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, no redundant information. Purpose is upfront, usage guidance and roadmap reference are concise. Every sentence earns its place.

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

Completeness3/5

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

For a simple update tool with output schema, description covers basic usage. However, lacks behavioral transparency (e.g., reversibility, side effects) and doesn't elaborate on org_id usage, making it adequate but not fully complete.

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

Parameters4/5

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

Input schema covers 100% of parameters, providing baseline. Description adds context for product_id ('UUID from list_org_products results') and stock_status enum values. However, org_id is not mentioned beyond schema, so some extra value but not complete.

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?

Description clearly states the tool updates a product's stock status with specific verbs and resources. It distinguishes from siblings like create_org_product by focusing on stock updates, not product creation.

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

Usage Guidelines4/5

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

Explicitly guides when to use: 'mark products as out of stock when inventory runs out, or flip back to in_stock after restocking.' Mentions roadmap for variant-level counts, providing context, but doesn't compare to other tools on the server.

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/ilhankilic/yaparai-mcp'

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