Skip to main content
Glama

expected_surplus

Read-only

Estimate how much better Ophis quotes than the open market for a sell: fetches the Ophis orderbook sell-quote and a public all-DEX aggregator (KyberSwap) quote for the same input, and returns beatBps (+ = Ophis returns more of the buy token). Use before build_order to show the expected edge. The reference can reflect thin or manipulated liquidity, so treat beatBps as advisory, not a sole execution signal. Sell-side (exact-in) only. Read-only.

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": {
      "chainId": "<chainId>",
      "sellToken": "<sellToken>",
      "buyToken": "<buyToken>",
      "sellAmount": "<sellAmount>",
      "from": "<from>"
    },
    "name": "expected_surplus"
  }
}

Input Schema

NameRequiredDescriptionDefault
fromYesThe trading account address (quotes are account-aware).
chainIdYesEVM chain id (use a chainId from list_chains `tradeable`).
buyTokenYesBuy token address (0x...).
sellTokenYesSell token address (0x...).
sellAmountYesExact sell amount in atoms (uint256 decimal string).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / properties / chainId / maximum
      Added value: +9007199254740991
    • addedInput schema / properties / chainId / minimum
      Added value: +-9007199254740991
  2. Added

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already declare readOnlyHint and openWorldHint, but the description adds real value: it warns the reference quote can reflect thin or manipulated liquidity and that beatBps is advisory, not a sole execution signal. It also defines the sign convention of beatBps (+ = Ophis returns more). Missing only details like latency or failure modes when the aggregator is unreachable.

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 the core purpose and the returned metric, followed by caveats and scope. Dense and mostly waste-free, though it runs a touch long with three separate caveat sentences.

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?

With no output schema, the description carries the burden of explaining the return value and does so via beatBps sign convention. It also covers scope and safety caveats. An agent has enough to call it correctly; only edge-case behavior (aggregator failure) is unaddressed.

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 coverage is 100%, so the schema already documents all five parameters including the account-aware 'from' and atoms-denominated sellAmount. The description adds only the exact-in framing, which is not per-parameter detail. Baseline 3 is appropriate.

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 (Estimate) and resource (Ophis vs open-market surplus for a sell), and explains exactly what it fetches: the Ophis orderbook sell-quote and a KyberSwap all-DEX quote for the same input, returning beatBps. An agent can distinguish it from get_quote (single quote) and build_order without opening any schema.

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?

'Use before build_order to show the expected edge' gives clear placement in the workflow, and 'Sell-side (exact-in) only' scopes usage. It doesn't explicitly contrast with the sibling get_quote, which is the nearest alternative, so it falls just short of naming when-not/alternatives fully.

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.