Skip to main content
Glama

Preview Cost

preview_cost
Read-onlyIdempotent

Price a what-if on a priced calculation without saving anything: move cost factors (a rate, a time allowance, the material price) or the lot size, and get the new cost sheet with the change per cost category. Use it to test a cheaper option before deciding. Free: it uses no calculation of the quota and changes nothing, not this calculation and not its costing environment. The part is re-priced by the same engine, so the answer is a price, not an estimate. A factor outside its allowed range is refused by name. By default it answers with a summary: the headline before and after, the change per cost category and only the cost lines that moved; pass detail='full' for the whole previewed cost sheet. To price the part for real, use quote_part. Read-only.

Input Schema

NameRequiredDescriptionDefault
detailNo'summary' (the default): the headline before and after, the change per cost category and only the cost lines that moved. 'full': the whole previewed cost sheet in cost_lines instead.summary
lot_sizeNoLot size to price the what-if at. Omit to keep the calculation's own lot size.
adjustmentsNoThe factors to move, as {factor_key: new_value}. The keys are the ones get_cost_breakdown shows on each cost line. Omit to re-price at another lot_size only.
calculation_idYesId of a calculation, as upload_and_quote, quote_part or list_calculations return it.

Output Schema

NameRequiredDescriptionDefault
afterNodetail='summary' only: the headline under the what-if.
deltaNoChange per top-level cost category, new minus current. A category on only one side carries its whole amount, so a line that appears or disappears is visible rather than skipped.
beforeNodetail='summary' only: the priced calculation's headline.
currencyNo
guidanceYes
lot_sizeNoLot size this preview was priced at.
unit_costNoCost per part under the adjustments — the manufacturing cost, on the same basis as the calculation's own unit cost, so the two are directly comparable. The offer price with your surcharges and mark-up on top is the sum of every top-level line in ``cost_lines``.
cost_linesNoThe previewed cost sheet as a tree, same shape as get_cost_breakdown's. Empty under detail='summary'.
reconciledNoWhether every tier of the previewed sheet added up to the line above it. False means a tier was dropped rather than shown not adding up — read the amounts, not the missing tier.
adjustmentsNoThe factor values this preview was priced at, echoed back.
moved_linesNodetail='summary' only: every cost line, at any depth, whose amount moved, each with its path in the tree. Top-level lines only when the calculation recorded no itemised sheet to compare.
total_deltaNoChange in the cost per part against the priced calculation: new minus current, in the currency above.
calculation_idYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedOutput schema / $defs / CostSheetNode / properties / amount / description
      Previous value: -"What this line costs per unit, in the calculation's currency."New value: +"What this line costs per unit, in the calculation's currency, as shown: a tier adds up exactly to the line above it."
    • addedOutput schema / $defs / CostSheetNode / properties / exact
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "number"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "This line's amount before it was rounded for display; a per-lot figure is it times the lot, rounded once."
      +}
  2. Changed1 schema field changed
    • addedInput schema / properties / calculation_id / format
      Added value: +"uuid"
  3. Changed8 schema fields changed
    • addedInput schema / properties / detail
      Added value: +{
      +  "default": "summary",
      +  "description": "'summary' (the default): the headline before and after, the change per cost category and only the cost lines that moved. 'full': the whole previewed cost sheet in cost_lines instead.",
      +  "enum": [
      +    "summary",
      +    "full"
      +  ],
      +  "type": "string"
      +}
    • addedOutput schema / $defs / CostLineMove
      Added value: +{
      +  "description": "One cost line whose amount the what-if moved.",
      +  "properties": {
      +    "after": {
      +      "anyOf": [
      +        {
      +          "type": "number"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null,
      +      "description": "Amount per part under the what-if; null when the line is gone."
      +    },
      +    "before": {
      +      "anyOf": [
      +        {
      +          "type": "number"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null,
      +      "description": "Amount per part in the priced calculation; null when the line is new."
      +    },
      +    "delta": {
      +      "default": 0,
      +      "description": "after minus before.",
      +      "type": "number"
      +    },
      +    "label_id": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null,
      +      "description": "Message id for this line's name."
      +    },
      +    "label_params": {
      +      "additionalProperties": true,
      +      "description": "Values the label refers to, e.g. the machine name.",
      +      "type": "object"
      +    },
      +    "path": {
      +      "description": "Bucket slugs from the top-level category down to this line, so the line can be found in get_cost_breakdown's tree.",
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    }
      +  },
      +  "type": "object"
      +}
    • addedOutput schema / $defs / CostPreviewHeadline
      Added value: +{
      +  "description": "One side of a what-if's headline, in the calculation's currency.",
      +  "properties": {
      +    "lot_size": {
      +      "anyOf": [
      +        {
      +          "type": "integer"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null,
      +      "description": "Lot size this side is priced at."
      +    },
      +    "offer_price": {
      +      "anyOf": [
      +        {
      +          "type": "number"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null,
      +      "description": "Offer price per part: every top-level cost line, the surcharges and mark-up included."
      +    },
      +    "total_cost": {
      +      "anyOf": [
      +        {
      +          "type": "number"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null,
      +      "description": "unit_cost times lot_size."
      +    },
      +    "unit_cost": {
      +      "anyOf": [
      +        {
      +          "type": "number"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null,
      +      "description": "Manufacturing cost per part, on the basis of the calculation's own unit cost."
      +    }
      +  },
      +  "type": "object"
      +}
    • addedOutput schema / $defs / CostSheetNode / properties / children_hidden
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "integer"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "How many lines sit beneath this one that `max_depth` left out: ask again with a larger `max_depth`, or null, to see them. Absent when nothing beneath this line was left out."
      +}
    • addedOutput schema / properties / after
      Added value: +{
      +  "anyOf": [
      +    {
      +      "$ref": "#/$defs/CostPreviewHeadline"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "detail='summary' only: the headline under the what-if."
      +}
    • addedOutput schema / properties / before
      Added value: +{
      +  "anyOf": [
      +    {
      +      "$ref": "#/$defs/CostPreviewHeadline"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "detail='summary' only: the priced calculation's headline."
      +}
    • changedOutput schema / properties / cost_lines / description
      Previous value: -"The previewed cost sheet as a tree, same shape as get_cost_breakdown's."New value: +"The previewed cost sheet as a tree, same shape as get_cost_breakdown's. Empty under detail='summary'."
    • addedOutput schema / properties / moved_lines
      Added value: +{
      +  "anyOf": [
      +    {
      +      "items": {
      +        "$ref": "#/$defs/CostLineMove"
      +      },
      +      "type": "array"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "detail='summary' only: every cost line, at any depth, whose amount moved, each with its path in the tree. Top-level lines only when the calculation recorded no itemised sheet to compare."
      +}
  4. Changed4 schema fields changed
    • addedInput schema / properties / adjustments / description
      Added value: +"The factors to move, as {factor_key: new_value}. The keys are the ones get_cost_breakdown shows on each cost line. Omit to re-price at another lot_size only."
    • addedInput schema / properties / calculation_id / description
      Added value: +"Id of a calculation, as upload_and_quote, quote_part or list_calculations return it."
    • addedInput schema / properties / lot_size / description
      Added value: +"Lot size to price the what-if at. Omit to keep the calculation's own lot size."
    • changedOutput schema / $defs / CostSheetNode / properties / factors / description
      Previous value: -"Adjustable factors that move this line, by name — the keys get_cost_factors publishes and preview_cost accepts. A factor is listed only where this line carries what is needed to work it out, so an empty list does not mean the line is fixed."New value: +"Adjustable factors that move this line, by name: the keys preview_cost accepts. A factor is listed only where this line carries what is needed to work it out, so an empty list does not mean the line is fixed."
  5. Added

TDQS

A4.6/5.0
Behavior5/5

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

Beyond the read-only annotations, the description discloses important behavior: nothing is saved, no quota is consumed, neither the calculation nor its costing environment changes, invalid factors are refused by name, and the result is a real re-priced answer rather than an estimate. It also explains the default summary output versus detail='full'.

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?

The core purpose and usage are front-loaded in the first two sentences, and the rest adds useful behavioral context. It is slightly longer than necessary, with some repetition around 'without saving anything' and 'changes nothing', plus a trailing 'Read-only' that restates the annotation.

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?

With annotations covering safety and an output schema covering return shape, the description supplies all additional context an agent needs: what the tool previews, what changes, quota impact, validation behavior, and when to use quote_part instead.

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 parameter meanings are already well documented. The description reinforces the concepts of cost factors, lot size, and detail levels, but does not add syntax or format details 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?

The description states a specific verb and resource — pricing a what-if on a priced calculation — and explains exactly what can be moved: cost factors or lot size. It distinguishes the tool from quote_part, which prices the part for real, so an agent can tell the two apart without opening either schema.

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?

It explicitly says to use this tool to test a cheaper option before deciding, and names quote_part as the alternative for real pricing. It also clarifies that the tool is free, uses no quota, and changes nothing, which gives clear conditions for choosing it.

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.