Skip to main content
Glama

update_variation_quantity

Set the exact inventory quantity for a specific product variation. Use after inventory counts or for manual restocking to update stock levels immediately.

Instructions

[WRITE] 更新商品變體庫存數量。

【用途】 直接設定特定變體的庫存數量。適用於盤點後調整庫存或手動補貨場景。 若要批次更新多個 SKU 庫存,可改用 bulk_update_quantities。

【呼叫的 Shopline API】

  • PUT /v1/products/{product_id}/variations/{variation_id}/quantity

【回傳結構】 dict 含 success: bool, resource_id: str, message: str。

【副作用】

  • 庫存數量立即更新,影響前台可購買數量

  • 若設為 0 且商品設定不允許超賣,前台將顯示缺貨

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
product_idYes商品內部 ID
variation_idYes變體內部 ID
quantityYes新庫存數量(絕對值,非增減量)
Behavior5/5

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

No annotations are provided, but the description fully compensates by detailing side effects (immediate update, frontend impact, out-of-stock behavior) and the API endpoint. This covers all behavioral aspects an agent needs.

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?

The description is well-structured with labeled sections (title, usage, API, return structure, side effects). It is concise yet comprehensive, with no unnecessary words.

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

Completeness5/5

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

Given no output schema, the description includes the return structure (dict with success, resource_id, message) and side effects. Combined with full schema parameter coverage, the description is complete for an agent to use the tool correctly.

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?

While schema coverage is 100%, the description adds value by clarifying that quantity is an absolute value ('新庫存數量(絕對值,非增減量)') and by explaining the return structure. This provides extra meaning beyond the schema.

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?

The description starts with a clear verb and resource ('[WRITE] 更新商品變體庫存數量'), explicitly stating it updates a variation's quantity. It distinguishes from sibling tool bulk_update_quantities, making the purpose specific.

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

Usage Guidelines5/5

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

The '用途' section states when to use (after stocktaking or manual restock) and explicitly mentions the alternative for batch updates (bulk_update_quantities), providing clear usage guidance.

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/asgard-ai-platform/mcp-shopline'

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