Skip to main content
Glama

Add order item

add_order_item

Add a line item to an existing order by its externalId. Recomputes the order total. Only allowed while the order is pending or confirmed; on any other status (processing and later, cancelled, refunded) it fails with 409 CONFLICT "Order lines can only be changed while the order is pending or confirmed". Use list_orders or create_order for the order externalId, and search_products to quote a real product. The CRM recalculates shipping eligibility from the saved priced lines; a separate whole-order discount may require source-confirmed amount correction. The result echoes the operating workspace.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "productName": "<productName>",
      "quantity": "<quantity>",
      "unitPrice": "<unitPrice>",
      "externalId": "<externalId>"
    },
    "name": "add_order_item"
  }
}

Input Schema

NameRequiredDescriptionDefault
skuNoProduct SKU snapshot (from search_products). Optional.
discountNoPercentage discount on this line (0-100). Default 0.
quantityYesQuantity ordered (integer, at least 1).
unitPriceYesPrice per unit in the order currency, as a decimal (e.g. 199.99). Snapshotted onto the line.
externalIdYesThe order externalId returned by list_orders or create_order.
productNameYesLine item name, snapshotted onto the order. Use search_products to quote a real catalog product's name. Required.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
  2. Changed5 schema fields changed
    • addedInput schema / properties / discount / description
      Added value: +"Percentage discount on this line (0-100). Default 0."
    • addedInput schema / properties / productName / description
      Added value: +"Line item name, snapshotted onto the order. Use search_products to quote a real catalog product's name. Required."
    • addedInput schema / properties / quantity / description
      Added value: +"Quantity ordered (integer, at least 1)."
    • addedInput schema / properties / sku / description
      Added value: +"Product SKU snapshot (from search_products). Optional."
    • addedInput schema / properties / unitPrice / description
      Added value: +"Price per unit in the order currency, as a decimal (e.g. 199.99). Snapshotted onto the line."
  3. Changed1 schema field changed
    • addedInput schema / properties / externalId / description
      Added value: +"The order externalId returned by list_orders or create_order."
  4. Added

TDQS

A4.5/5.0
Behavior5/5

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

Annotations only establish that this is a non-read-only, non-idempotent, non-destructive write; the description goes well beyond them by disclosing the total recomputation, the status gate with the literal 409 error text, downstream shipping-eligibility recalculation, and a discount/source-confirmation caveat. This is exactly the extra behavioral context a mutation tool needs.

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

Conciseness4/5

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

Front-loads the core action, then constraints, then provenance guidance, with no filler sentences. The shipping-eligibility and 'source-confirmed amount correction' sentence is dense and slightly jargon-heavy, which costs a point but it still carries real 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 6-parameter mutation with no output schema, the description covers failure conditions, side effects, and what the result echoes (operating workspace). It stops short of describing the returned line-item/total shape, so an agent still has some uncertainty about the response payload.

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 description coverage is 100%, so every parameter (sku, discount, quantity, unitPrice, externalId, productName) is already documented in the schema; baseline is therefore 3. The description reinforces provenance ('search_products to quote a real product', externalId from list_orders/create_order) but adds little technical meaning such as discount interaction with price snapshots.

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?

States a specific verb and resource ('Add a line item to an existing order') plus the keying identifier (externalId) and the visible side effect (recomputes the order total). This cleanly separates it from update_order_item, remove_order_item, and create_order without the agent needing to open sibling schemas.

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?

Gives an explicit positive precondition (order must be pending or confirmed) and an explicit negative one (processing and later, cancelled, refunded) with the exact failure mode (409 CONFLICT) and message. It also routes the agent to list_orders/create_order for the externalId and search_products for a real quoted product.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources