Skip to main content
Glama

Submit a signed side bet

submit_bet

Use this when you have signed the transaction prepare_bet answered: transaction, base64, as your wallet signed it, clearance, the clearance string of prepare_bet's answer, unchanged (that one string, never the whole answer, never quoted again), and slug, the competition's (POST /api/competitions//market/trades/submit). The server holds it to what it cleared (the same instructions, accounts, fee payer and signers; a wallet's own Lighthouse assertions aside, at most 8, every account they name keeping the role the cleared trade gives it or a new one, read-only and no signer, the operator named only where the Lighthouse program is frozen on the cluster; its recent blockhash the cleared one or a newer one your wallet set when it signed, nothing else differing), checks that blockhash is valid on the cluster, signs it as the operator, the last signature, relays it, waits for its confirmation and records the trade: answers signature, commitment, trade (side, action, shares, cash, fee, average price, via mcp, its explorer link), position (that outcome's after the trade, with its value and PnL; null when you sold every share), first_trade and explorer. A clearance carries one trade: submitting it again, as it was or re-signed, is refused. A refusal is the route's RFC 9457 problem whole: 409 clearance_used (it was submitted once already, and a clearance carries one trade: the trade may have landed, so read get_positions first, and prepare and sign another trade only if it shows the first did not land; never submit the same clearance again), 409 clearance_expired (it lapsed before anything was sent under it, so it never landed: prepare it again), 409 blockhash_invalid (your wallet signed on a newer blockhash than the cleared one and the cluster does not hold it valid, unknown or expired, so it could never land: prepare it again and sign the new transaction), 409 tx_mismatch (not the transaction cleared, or not prepare_bet's clearance: the detail says what differs), 422 not_signed (your wallet's signature is missing or does not verify), 403 house or staff (a buy from a wallet not on your account that a house or staff account holds: told only now, once your wallet's signature verified; nothing was signed or sent, and a sell is never refused so), 409 outcome_scratched (a buy of an entry being scratched: the market stopped listing it, rejected, withdrawn or replaced, since the trade was cleared, and its scratch has not landed on chain; nothing was signed or sent, and a sell still lands), 409 chain_refused (the program refused it, the detail naming its error: nothing changed), 409 guard_failed (one of your wallet's own guard instructions failed when the trade ran, so the transaction failed whole and nothing was traded, landed or not: prepare it again and sign the new transaction), 409 guard_unverified (one of your wallet's own guard instructions names the operator, which the server co-signs only where the Lighthouse program is frozen on the cluster, and it could not read that just now: nothing was signed or sent and the clearance is not used, so call submit_bet again with the same transaction and clearance after its Retry-After, a few seconds), 502 relay_failed (it was sent to the chain and its outcome is not known, so it may have landed: read get_positions first, and prepare and sign another trade only if it shows it did not land; never submit that clearance again). Only 409 clearance_expired (that clearance lapsed before anything was sent under it), 409 blockhash_invalid (your wallet signed on a blockhash the cluster does not hold valid, so it could never land) and 409 guard_unverified (the server could not confirm just now that your wallet's safety-check program, Lighthouse, is frozen, so it signed and sent nothing) mean the trade never left: after either of the first two, prepare it again and sign the new transaction; after guard_unverified, wait its Retry-After (a few seconds) and submit the same signed transaction with the same clearance again, unchanged. Three answers mean it may have landed: 409 clearance_used (that clearance was submitted once already, at any age: read your positions first), 502 relay_failed (it was sent to the chain and its outcome is not known: read your positions first) and a submit that got no answer at all (a timeout, a lost connection: read your positions first). After any of them, prepare and sign another trade only if your positions (get_positions, or GET .../market/me) show it did not land, and never submit that clearance again. Next: get_positions for every position and its P&L (the answer's position is this outcome's). Signed in only: working for a person with an account here, run makefun login (or POST /api/agents/connect) and have them approve it, for a key on their account; otherwise sign in with your keypair (POST /api/auth/solana/key mints a key from its signed sign-in message); either way, as /skill.md step 1 shows, send that API key (an af_ key) as the x-api-key header of the MCP connection; without one it answers 401.

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": {
      "slug": "<slug>",
      "transaction": "<transaction>",
      "clearance": "<clearance>"
    },
    "name": "submit_bet"
  }
}

Input Schema

NameRequiredDescriptionDefault
slugYesThe competition slug, e.g. chess-engine-01 (list_competitions lists them)
clearanceYesThe clearance string of prepare_bet's answer, unchanged: that one string, never the whole answer
transactionYesprepare_bet's transaction, base64, as your wallet signed it

Output Schema

NameRequiredDescriptionDefault
tradeYes
explorerYes
positionYes
signatureYes
commitmentYes
first_tradeYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / clearance / maxLength
      Previous value: -8192New value: +65536
  2. Changed1 schema field changed
    • changedInput schema / properties / clearance / description
      Previous value: -"prepare_bet's clearance, unchanged"New value: +"The clearance string of prepare_bet's answer, unchanged: that one string, never the whole answer"
  3. Changed1 schema field changed
    • changedOutput schema / properties / position / anyOf
      Previous value: -[
      -  {
      -    "additionalProperties": {},
      -    "properties": {
      -      "avg_price_ppm": {
      -        "type": "number"
      -      },
      -      "cost_base_units": {
      -        "type": "string"
      -      },
      -      "label": {
      -        "type": "string"
      -      },
      -      "outcome_id": {
      -        "type": "number"
      -      },
      -      "pnl_base_units": {
      -        "type": "string"
      -      },
      -      "pnl_pct": {
      -        "type": [
      -          "number",
      -          "null"
      -        ]
      -      },
      -      "price_ppm": {
      -        "type": "number"
      -      },
      -      "realized_base_units": {
      -        "type": "string"
      -      },
      -      "shares_base_units": {
      -        "type": "string"
      -      },
      -      "side": {
      -        "enum": [
      -          "yes",
      -          "no"
      -        ],
      -        "type": "string"
      -      },
      -      "status": {
      -        "enum": [
      -          "open",
      -          "scratched",
      -          "won",
      -          "lost",
      -          "void"
      -        ],
      -        "type": "string"
      -      },
      -      "to_win_base_units": {
      -        "type": "string"
      -      },
      -      "value_base_units": {
      -        "type": "string"
      -      },
      -      "value_kind": {
      -        "enum": [
      -          "cash_out",
      -          "mark"
      -        ],
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "outcome_id",
      -      "label",
      -      "side",
      -      "shares_base_units",
      -      "cost_base_units",
      -      "avg_price_ppm",
      -      "price_ppm",
      -      "value_base_units",
      -      "value_kind",
      -      "pnl_base_units",
      -      "pnl_pct",
      -      "realized_base_units",
      -      "to_win_base_units",
      -      "status"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "additionalProperties": {},
      +    "properties": {
      +      "avg_price_ppm": {
      +        "type": "number"
      +      },
      +      "cost_base_units": {
      +        "type": "string"
      +      },
      +      "label": {
      +        "type": "string"
      +      },
      +      "outcome_id": {
      +        "type": "number"
      +      },
      +      "pnl_base_units": {
      +        "type": "string"
      +      },
      +      "pnl_pct": {
      +        "type": [
      +          "number",
      +          "null"
      +        ]
      +      },
      +      "price_ppm": {
      +        "type": "number"
      +      },
      +      "realized_base_units": {
      +        "type": "string"
      +      },
      +      "replaced": {
      +        "type": "boolean"
      +      },
      +      "replaced_by_outcome_id": {
      +        "type": [
      +          "number",
      +          "null"
      +        ]
      +      },
      +      "shares_base_units": {
      +        "type": "string"
      +      },
      +      "side": {
      +        "enum": [
      +          "yes",
      +          "no"
      +        ],
      +        "type": "string"
      +      },
      +      "status": {
      +        "enum": [
      +          "open",
      +          "scratched",
      +          "won",
      +          "lost",
      +          "void"
      +        ],
      +        "type": "string"
      +      },
      +      "to_win_base_units": {
      +        "type": "string"
      +      },
      +      "value_base_units": {
      +        "type": "string"
      +      },
      +      "value_kind": {
      +        "enum": [
      +          "cash_out",
      +          "mark"
      +        ],
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "outcome_id",
      +      "label",
      +      "side",
      +      "shares_base_units",
      +      "cost_base_units",
      +      "avg_price_ppm",
      +      "price_ppm",
      +      "value_base_units",
      +      "value_kind",
      +      "pnl_base_units",
      +      "pnl_pct",
      +      "realized_base_units",
      +      "to_win_base_units",
      +      "status"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
  4. Changed3 schema fields changed
    • addedInput schema / properties / clearance
      Added value: +{
      +  "description": "prepare_bet's clearance, unchanged",
      +  "maxLength": 8192,
      +  "minLength": 1,
      +  "type": "string"
      +}
    • changedInput schema / properties / transaction / description
      Previous value: -"prepare_bet's transaction, base64, signed by your wallet"New value: +"prepare_bet's transaction, base64, as your wallet signed it"
    • changedInput schema / required
      Previous value: -[
      -  "slug",
      -  "transaction"
      -]New value: +[
      +  "slug",
      +  "transaction",
      +  "clearance"
      +]
  5. Added

TDQS

A4.5/5.0
Behavior5/5

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

Annotations already declare this is a non-read-only, non-idempotent mutation, and the description adds substantial context beyond them: the server enforces the cleared trade's instructions, signs as operator, relays, waits for confirmation, and records the trade. It also discloses the one-clearance-one-trade rule, the full refusal taxonomy, which failures may have landed, and the x-api-key auth requirement. This is far richer than the annotations alone.

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

Conciseness3/5

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

The description is comprehensive but extremely dense and repetitive: the same error codes (clearance_used, blockhash_invalid, guard_unverified, relay_failed) are explained, then re-explained in separate categorization paragraphs. It is front-loaded with usage but would benefit from tighter grouping and less duplicated wording.

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?

For a high-stakes mutation tool with an output schema, the description covers the critical gaps: authentication requirements, one-shot clearance semantics, failure recovery, and the distinction between failures that definitely did not land versus those that may have. Nothing an agent needs in order to invoke and recover correctly appears to be missing.

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 three parameters, including that clearance is the unchanged string and transaction is the base64 signed payload. The description reinforces those constraints but adds little parameter-level meaning beyond what the schema already states; most of its added value is behavioral rather than parameter semantics.

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: it submits the signed transaction that prepare_bet produced, relays it, and records the trade. It clearly distinguishes itself from prepare_bet (which prepares the unsigned transaction) and from get_positions (the read-only follow-up), so an agent can route correctly without opening another 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 gives explicit when-to-use guidance (after your wallet has signed prepare_bet's transaction) and detailed when-not/alternative behavior: read get_positions first after ambiguous failures, re-prepare only after definitive non-landing failures, and never resubmit the same clearance. The recovery routing by error code is unusually complete.

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.