Skip to main content
Glama

Last Price

compute_price

Compute a price for a product/context via the Last Price Pricing Compute Network. Returns the computed price, the function that produced it, token metering/cost, and a trace listing each stage the request passed through (cache, route, execute, fallback, constrain, meter). For a competitor offer, put competitor_price, competitor_currency and competitive_action in metadata, then supply min_price or unit_cost with target_margin_pct. Missing business inputs return an error naming them. To pay for this one call with x402 instead of a key or a balance, pass payment: a signed payment for the price it asks (call it without payment to read what it asks). Where quote expiry is switched on for the workspace, the result carries valid_until (RFC 3339): quote or charge the price only before then, and compute again after. Pass intent (the limit the buyer approved) to learn whether the price fits it.

Input Schema

NameRequiredDescriptionDefault
geoNoOptional geography hint, e.g. US.
payerNoOptional. Who pays, as distinct from who calls: the agent from its own wallet, a person by card, or a company billed later. Where this is switched on it reaches buyer-aware pricing as metadata.payer and the answer echoes it.
intentNoOptional. The spending limit the buyer approved, such as a card network or payment rail mandate. Where this is switched on for the workspace, the result says whether the price fits it, with the reasons when not, and a signed quote binds the same so an issuer or buyer can check it.
channelNoOptional. The sales channel the price is for, such as a shopping agent or an agent marketplace. When your workspace saved a rate for it with set_channel_rates and channel pricing is on, the price is raised so you keep the same amount after the channel's cut.
paymentNoOptional. The signed x402 payment, base64, as sent in an X-PAYMENT or PAYMENT-SIGNATURE header; or, where the answer offers MPP tempo, the whole Payment-Authorization value ("Payment " and the credential). Omit it to read what the call costs and how to pay; nothing is charged until you send it.
routingNoOptional. Which functions may answer this one call, by UUID from list_functions. A call these leave with no function is refused, naming why, before anything runs or is charged. Where routing preferences are not yet on for your workspace they are ignored.
currencyYesThree-letter ISO currency code, e.g. USD.
metadataNoOptional context. For competitive pricing: competitor_price, competitor_currency and competitive_action (match or undercut); undercut requires undercut_pct. Confirm product comparability before calling. Or send market_query (the job, in plain words) instead of competitor_price: where market prices are switched on, the market is looked up first and the answer carries market_prices (low, median, high and the pages); with competitive_action and no competitor_price, the lowest market price is used to undercut and the median to match (market_reference: low, median or high chooses).
max_priceNoOptional maximum acceptable price.
min_priceNoOptional minimum acceptable price. A competitive offer needs this or a declared unit_cost and target_margin_pct.
unit_costNoWhat the work costs you. It lets lastprice/cost-plus price with no current_price, which is the usual case when pricing a task you are about to run. Routing picks a function that can use it; to require cost-plus, pass its UUID from list_functions as function_id.
buyer_typeNoOptional. Who the price is for: an AI agent or a person. Recorded with the quote only.
no_exploreNoIf true, give this price exactly as computed, without the small per-call variation a workspace may run so learned pricing can learn what buyers will pay (see get_price_exploration).
product_idNoOptional identifier of what is being priced.
buyer_agentNoOptional. The buying agent, e.g. chatgpt or agent.example.com. A label recorded with the quote only (while its release flag is on); never sent to the pricing function.
function_idNoOptional explicit pricing function UUID to use.
product_typeNoOptional category. Defaults to "custom".
current_priceNoThe current or reference price. Optional: functions that price relative to an incumbent need it, but lastprice/cost-plus prices from unit_cost instead.
outcome_termsNoOptional, for a price charged per outcome. When the outcome counts as failed and what is owed then. Where outcome terms are switched on for the workspace, the result carries outcome_terms: these terms normalised, the deadline as a time, the amount owed on timeout, and which terms are missing (complete is false without success_definition, resolve_by and on_timeout). Sending it marks the price as an outcome price; so does metadata.unit "outcome".
idempotency_keyNoOptional. A new value (e.g. a UUID) for each call you mean to make; send the SAME value if you retry after a timeout or error you cannot interpret, and the call is computed and charged once. Ignored without a credential.
learned_routingNoOptional. With routing_preference cheapest, fastest, round robin or weighted, let the router learn which of the functions that strategy chooses from serves your workspace best (from your own routed calls), falling back to the strategy while there is too little data. Ignored for any other preference or a function_id, and until learned routing is released for your workspace. get_learned_routing with strategy shows what it learned.
customer_segmentNoOptional segment, e.g. enterprise.
target_margin_pctNoMargin on price for cost-plus, not markup on cost: price = unit_cost / (1 - margin). Defaults to 30.
routing_preferenceNoHow to route across pricing functions. Defaults to "default".
include_explanationNoIf true, ask for an explanation and confidence with the price.
include_buyer_envelopeNoIf true, and metadata.category names a category, the result carries buyer_envelope: what buyers' own spend checks allowed in that category (p25 to p75, the median, and how often checks were refused over a limit, pooled over 5 or more buyer workspaces; no numbers below 5) and where this price sits. A limit, not a valuation: it never changes the price. Where it is not switched on for the workspace it is ignored.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changed
    • addedInput schema / properties / intent
      Added value: +{
      +  "description": "Optional. The spending limit the buyer approved, such as a card network or payment rail mandate. Where this is switched on for the workspace, the result says whether the price fits it, with the reasons when not, and a signed quote binds the same so an issuer or buyer can check it.",
      +  "properties": {
      +    "currency": {
      +      "description": "Three-letter ISO code. Defaults to the price currency.",
      +      "maxLength": 3,
      +      "minLength": 3,
      +      "type": "string"
      +    },
      +    "expires_at": {
      +      "description": "When the approval stops being valid (RFC 3339).",
      +      "format": "date-time",
      +      "type": "string"
      +    },
      +    "id": {
      +      "description": "The approval id from the rail or issuer.",
      +      "maxLength": 200,
      +      "minLength": 1,
      +      "type": "string"
      +    },
      +    "max_amount": {
      +      "description": "The most the buyer approved.",
      +      "minimum": 0,
      +      "type": "number"
      +    },
      +    "merchant": {
      +      "description": "The merchant the approval names. Carried into the quote as sent.",
      +      "maxLength": 253,
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "id",
      +    "max_amount"
      +  ],
      +  "type": "object"
      +}
    • changedInput schema / properties / metadata / description
      Previous value: -"Optional context. For competitive pricing: competitor_price, competitor_currency and competitive_action (match or undercut); undercut requires undercut_pct. Confirm product comparability before calling."New value: +"Optional context. For competitive pricing: competitor_price, competitor_currency and competitive_action (match or undercut); undercut requires undercut_pct. Confirm product comparability before calling. Or send market_query (the job, in plain words) instead of competitor_price: where market prices are switched on, the market is looked up first and the answer carries market_prices (low, median, high and the pages); with competitive_action and no competitor_price, the lowest market price is used to undercut and the median to match (market_reference: low, median or high chooses)."
    • addedInput schema / properties / payer
      Added value: +{
      +  "description": "Optional. Who pays, as distinct from who calls: the agent from its own wallet, a person by card, or a company billed later. Where this is switched on it reaches buyer-aware pricing as metadata.payer and the answer echoes it.",
      +  "enum": [
      +    "agent_wallet",
      +    "person_card",
      +    "company_invoice",
      +    null
      +  ],
      +  "type": [
      +    "string",
      +    "null"
      +  ]
      +}
    • changedInput schema / properties / payment / description
      Previous value: -"Optional. The signed x402 payment, base64, as sent in an X-PAYMENT or PAYMENT-SIGNATURE header. Omit it to read what the call costs and how to pay; nothing is charged until you send it."New value: +"Optional. The signed x402 payment, base64, as sent in an X-PAYMENT or PAYMENT-SIGNATURE header; or, where the answer offers MPP tempo, the whole Payment-Authorization value (\"Payment \" and the credential). Omit it to read what the call costs and how to pay; nothing is charged until you send it."
    • addedInput schema / properties / routing
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "Optional. Which functions may answer this one call, by UUID from list_functions. A call these leave with no function is refused, naming why, before anything runs or is charged. Where routing preferences are not yet on for your workspace they are ignored.",
      +  "properties": {
      +    "allow_fallbacks": {
      +      "description": "false: fail instead of trying another function when the chosen one fails.",
      +      "type": "boolean"
      +    },
      +    "excluded_functions": {
      +      "description": "These may not answer, not even as a fallback.",
      +      "items": {
      +        "format": "uuid",
      +        "type": "string"
      +      },
      +      "maxItems": 50,
      +      "type": "array"
      +    },
      +    "max_cost_per_unit": {
      +      "description": "Most you will pay per metered unit (rate x multiplier).",
      +      "minimum": 0,
      +      "type": "number"
      +    },
      +    "max_latency_ms": {
      +      "description": "Skip functions slower than this on average, and stop waiting after it.",
      +      "minimum": 1,
      +      "type": "integer"
      +    },
      +    "only_functions": {
      +      "description": "Only these may answer.",
      +      "items": {
      +        "format": "uuid",
      +        "type": "string"
      +      },
      +      "maxItems": 50,
      +      "minItems": 1,
      +      "type": "array"
      +    },
      +    "preferred_functions": {
      +      "description": "Tried first, in this order.",
      +      "items": {
      +        "format": "uuid",
      +        "type": "string"
      +      },
      +      "maxItems": 50,
      +      "type": "array"
      +    }
      +  },
      +  "type": "object"
      +}
  2. Changed1 schema field changed
    • addedInput schema / properties / include_buyer_envelope
      Added value: +{
      +  "description": "If true, and metadata.category names a category, the result carries buyer_envelope: what buyers' own spend checks allowed in that category (p25 to p75, the median, and how often checks were refused over a limit, pooled over 5 or more buyer workspaces; no numbers below 5) and where this price sits. A limit, not a valuation: it never changes the price. Where it is not switched on for the workspace it is ignored.",
      +  "type": "boolean"
      +}
  3. Changed8 schema fields changed
    • addedInput schema / properties / buyer_agent
      Added value: +{
      +  "description": "Optional. The buying agent, e.g. chatgpt or agent.example.com. A label recorded with the quote only (while its release flag is on); never sent to the pricing function.",
      +  "maxLength": 100,
      +  "type": [
      +    "string",
      +    "null"
      +  ]
      +}
    • addedInput schema / properties / buyer_type
      Added value: +{
      +  "description": "Optional. Who the price is for: an AI agent or a person. Recorded with the quote only.",
      +  "enum": [
      +    "agent",
      +    "person",
      +    null
      +  ],
      +  "type": [
      +    "string",
      +    "null"
      +  ]
      +}
    • addedInput schema / properties / channel
      Added value: +{
      +  "description": "Optional. The sales channel the price is for, such as a shopping agent or an agent marketplace. When your workspace saved a rate for it with set_channel_rates and channel pricing is on, the price is raised so you keep the same amount after the channel's cut.",
      +  "maxLength": 64,
      +  "type": "string"
      +}
    • addedInput schema / properties / idempotency_key
      Added value: +{
      +  "description": "Optional. A new value (e.g. a UUID) for each call you mean to make; send the SAME value if you retry after a timeout or error you cannot interpret, and the call is computed and charged once. Ignored without a credential.",
      +  "maxLength": 255,
      +  "minLength": 8,
      +  "type": "string"
      +}
    • addedInput schema / properties / learned_routing
      Added value: +{
      +  "description": "Optional. With routing_preference cheapest, fastest, round robin or weighted, let the router learn which of the functions that strategy chooses from serves your workspace best (from your own routed calls), falling back to the strategy while there is too little data. Ignored for any other preference or a function_id, and until learned routing is released for your workspace. get_learned_routing with strategy shows what it learned.",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / no_explore
      Added value: +{
      +  "description": "If true, give this price exactly as computed, without the small per-call variation a workspace may run so learned pricing can learn what buyers will pay (see get_price_exploration).",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / outcome_terms
      Added value: +{
      +  "description": "Optional, for a price charged per outcome. When the outcome counts as failed and what is owed then. Where outcome terms are switched on for the workspace, the result carries outcome_terms: these terms normalised, the deadline as a time, the amount owed on timeout, and which terms are missing (complete is false without success_definition, resolve_by and on_timeout). Sending it marks the price as an outcome price; so does metadata.unit \"outcome\".",
      +  "properties": {
      +    "evidence": {
      +      "description": "What proves the outcome, e.g. [\"delivery_receipt\"].",
      +      "items": {
      +        "type": "string"
      +      },
      +      "maxItems": 10,
      +      "type": "array"
      +    },
      +    "on_timeout": {
      +      "description": "What is owed when the deadline passes without success.",
      +      "enum": [
      +        "no_charge",
      +        "partial",
      +        "full"
      +      ],
      +      "type": "string"
      +    },
      +    "resolve_by": {
      +      "description": "The deadline: an ISO 8601 duration from the quote (P30D, PT48H) or an RFC 3339 time. After it, with no success, the outcome has failed.",
      +      "type": "string"
      +    },
      +    "success_definition": {
      +      "description": "What the buyer must see for the outcome to count.",
      +      "maxLength": 500,
      +      "type": "string"
      +    },
      +    "timeout_share": {
      +      "description": "With on_timeout \"partial\": the fraction of the price owed, e.g. 0.3 for 30%.",
      +      "exclusiveMaximum": 1,
      +      "exclusiveMinimum": 0,
      +      "type": "number"
      +    }
      +  },
      +  "type": "object"
      +}
    • addedInput schema / properties / payment
      Added value: +{
      +  "description": "Optional. The signed x402 payment, base64, as sent in an X-PAYMENT or PAYMENT-SIGNATURE header. Omit it to read what the call costs and how to pay; nothing is charged until you send it.",
      +  "maxLength": 8192,
      +  "minLength": 20,
      +  "type": "string"
      +}
  4. First observed

TDQS

A4.3/5.0
Behavior5/5

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

Goes well past the annotations (readOnlyHint=false, destructiveHint=false, openWorldHint=true) by disclosing that nothing is charged until payment is sent, that missing business inputs produce a named-input error, that quote expiry yields valid_until after which the price must be recomputed, and that buyer_envelope pools over 5+ workspaces with no numbers below 5. It also flags that channel rates, learned routing and outcome terms are silently ignored when not enabled — exactly the unknown-unknowns 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.

Conciseness4/5

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

Front-loaded with what the tool does and returns, and every sentence carries operational content for a 26-parameter tool. Some sentences are run-on and stack several conditions together, so structure could be tighter, but nothing is padded.

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?

Absent an output schema, the description still tells the agent what the response contains (price, producing function, metering, trace stages, valid_until, outcome_terms, buyer_envelope) and how failures surface. For a tool of this complexity that is sufficient to call it 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?

Schema coverage is 100%, so the baseline is 3; the description earns an extra point by adding cross-parameter semantics the schema cannot express — which inputs must be supplied together (unit_cost + target_margin_pct for cost-plus, competitive_action requiring undercut_pct), and the read-then-pay flow for payment. It does not document the top-level fields individually, which keeps it at 4 rather than 5.

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

Purpose4/5

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

States a specific verb and resource — compute a price for a product/context — and names the backing system (Last Price Pricing Compute Network), then enumerates what comes back (price, function, metering, trace stages). It never names the nearest siblings (compute_prices_batch, estimate_task_cost, price_from_capture), so the single-call vs batch boundary must be inferred from the name.

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?

Gives concrete conditional guidance: competitor pricing requires competitor_price/competitor_currency/competitive_action plus min_price or unit_cost with target_margin_pct; call without payment first to read what is asked; recompute after valid_until when quote expiry is on. It lacks explicit 'use sibling X instead when…' routing, which keeps it off a 5.

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