From 7053e06e5ea5cdab1021fdf03845e3b2616a6143 Mon Sep 17 00:00:00 2001 From: Eric Juta Date: Tue, 27 Oct 2026 13:56:25 +0000 Subject: [PATCH] docs(predictions): document position conversion --- ai_docs/write-plugin-tool-justifications.md | 3 ++- docs/connect/claude.mdx | 4 ++-- docs/predictions-mcp/features-trading.mdx | 12 +++++++--- docs/predictions-mcp/introduction.mdx | 2 +- docs/predictions-mcp/tools.mdx | 26 +++++++++++---------- docs/product-guide/predictions.mdx | 2 ++ plugins/ask-gina-predictions/README.md | 17 ++++++++++---- tools/docs/venue-tools.json | 9 +++++++ 8 files changed, 51 insertions(+), 24 deletions(-) diff --git a/ai_docs/write-plugin-tool-justifications.md b/ai_docs/write-plugin-tool-justifications.md index a7f7078c..6f566fc8 100644 --- a/ai_docs/write-plugin-tool-justifications.md +++ b/ai_docs/write-plugin-tool-justifications.md @@ -123,7 +123,7 @@ Only `createHyperliquidTable`, `executeSqlQuery` and `captureAnalysisDataset` ar Endpoint: `https://askgina.ai/ai/predictions/mcp`. The server lists `bash` and every native tool in the table below. `fetchPolymarketData` and `fetchPolymarketHistory` are `bash`-only, because they load rows into sandbox SQL tables. -A `splitMergePredictionPosition` split preview returns a typed `next` suggestion for the same split with `authorized: true`. When the market has already resolved, it returns one for `redeemPredictionMarket` on that condition id instead. `getPolymarketPositions` returns a `redeemPredictionMarket` suggestion when a position is redeemable. The server never executes a suggestion. The host shows the call and asks first. +Split and conversion previews return a typed `next` suggestion for the same action with `authorized: true` and an editable amount. For a closed source market they can suggest `redeemPredictionMarket` instead. `getPolymarketPositions` suggests redemption for redeemable positions. The server never executes a suggestion. The host shows the call and asks first. | Tool | readOnlyHint, destructiveHint, openWorldHint | Reviewer justification | | -------------------------------- | -------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | @@ -146,6 +146,7 @@ A `splitMergePredictionPosition` split preview returns a typed `next` suggestion | `managePredictionOrders` | false, true, true | Creates, replaces or cancels Polymarket orders that commit real funds, so it is destructive and open world and needs host confirmation. Its list action only reads. | | `redeemPredictionMarket` | false, true, true | Redeems winning positions of resolved markets into your balance on chain. It moves real funds and cannot be undone, so it is destructive and needs host confirmation. | | `splitMergePredictionPosition` | false, true, true | Splits pUSD into YES and NO sets or merges them back on one market. It moves real funds and a split needs explicit authorization, so it is destructive and needs host confirmation. It suggests redeemPredictionMarket when the market has resolved. | +| `convertPredictionPosition` | false, true, true | Converts held NO shares into YES on other outcomes of an eligible event. It changes real positions, so it is destructive and open world and requires host confirmation. | | `topUpPredictionsBalance` | false, true, true | Tops up your Predictions balance from a source asset. It moves real funds, so it is destructive and open world and needs host confirmation. | | `withdrawPredictionsBalance` | false, true, true | Withdraws ready Predictions balance to your own wallet. It moves real funds and cannot be undone, so it is destructive and open world and needs host confirmation. | | `createScheduledPrompt` | false, false, false | Creates a scheduled prompt in Gina account state. It writes only Gina held settings and moves no funds, so it is not destructive and closed world. | diff --git a/docs/connect/claude.mdx b/docs/connect/claude.mdx index deeaa2a3..6d04c63d 100644 --- a/docs/connect/claude.mdx +++ b/docs/connect/claude.mdx @@ -104,8 +104,8 @@ You need a Claude plan with Claude Code on the web (Pro, Max, Team or Enterprise 2. **Choose its connectors.** A new routine includes every connector on your Claude account. Remove the ones it does not need. Keep the Predictions connector out unless the routine must read your account, because that connector also carries the trading tools. See [Safety](#safety-for-routine-push). 3. **Add an API trigger.** Edit the routine, click **+** in the **Trigger** row and choose **API**. Copy the **Fire URL**. Click **Generate token** and copy the token straight away. Claude shows it once and cannot show it again. 4. **Register it with Ask Gina.** On the [settings page](https://askgina.ai/profile/webhooks), choose **Add destination** and enter a label. **Receiver type** offers **Detect from the address** by default, **Webhook**, or **Claude routine**. Leave detection on or choose **Claude routine**, paste the Fire URL into **Webhook or routine URL**, and paste the token into **Routine API trigger token**. The Fire URL looks like `https://api.anthropic.com/v1/claude_code/routines/trig_.../fire` and the token starts with `sk-ant-oat01-`. After saving, look for the **Claude routine** badge on the destination row to identify it for testing or token replacement. The settings page is the better path because the token goes from you to Ask Gina without passing through a chat. A Claude agent can instead call `createWebhookDestination` with the same URL as `url` and the token as `secret`. Its optional `kind` is `webhook` or `claude_routine`. If omitted, the URL decides: the exact routine fire URL pattern selects `claude_routine`, and any other `api.anthropic.com` URL is refused. A `kind` that contradicts the URL fails with `INVALID_ARGUMENTS` on `kind`. Passing the token through a Claude agent puts it in that conversation's transcript, and anyone who can read it can start your routine until you regenerate the token. Ask Gina cannot generate this token for you, so a create call with no `secret` is refused. -5. **Subscribe.** Ask Claude to call `createPredictionEventSubscription` with the `destinationId` from step 4. Add a filter if the routine should only hear about some markets or orders. -6. **Send a test.** Press **Send test event** on the settings page or ask Claude to call `sendWebhookTestEvent`. This sends a short test message, not a signed event. It starts a real session, uses the routine's fire quota, and takes the destination's shared 150-second fire slot. Expect a new run in the routine's history. If the routine was fired less than 150 seconds ago, nothing is sent: `sendWebhookTestEvent` refuses with `WEBHOOK_ROUTINE_NOT_READY` and `details.retryAfterSeconds`. The settings page tells you to wait N seconds before trying again. +5. **Send a test before subscribing.** Press **Send test event** on the settings page or ask Claude to call `sendWebhookTestEvent` with the `destinationId` from step 4. This sends a short test message, not a signed event. It starts a real session, uses the routine's fire quota, and takes the destination's shared 150-second fire slot. Expect a new run in the routine's history. Testing before you subscribe keeps a real event from taking that slot first. If the routine was fired less than 150 seconds ago, nothing is sent: `sendWebhookTestEvent` refuses with `WEBHOOK_ROUTINE_NOT_READY` and `details.retryAfterSeconds`. The settings page tells you to wait N seconds before trying again. +6. **Subscribe after the test succeeds.** Ask Claude to call `createPredictionEventSubscription` with the same `destinationId`. Add a filter if the routine should only hear about some markets or orders. The first real delivery may wait for the test's shared fire slot to clear. ### What the routine receives diff --git a/docs/predictions-mcp/features-trading.mdx b/docs/predictions-mcp/features-trading.mdx index cf6e09e8..d8da7042 100644 --- a/docs/predictions-mcp/features-trading.mdx +++ b/docs/predictions-mcp/features-trading.mdx @@ -63,8 +63,14 @@ Check the trade tools without placing a trade. Call the native `splitMergePredic Expected: a preview that sends nothing and carries a `next` suggestion for the confirmed split. A native `tradePredictionMarket` call places an order only after you give an explicit instruction. Prices use real USDC on Polygon. -## Split previews +## Split, merge, and convert positions -`splitMergePredictionPosition` previews a split before it moves funds. The preview returns a typed `next` suggestion: the same split with `authorized: true`. You can edit the amount before you approve it. The server never runs the suggestion. Merges need no confirmation. +- **Split** uses `splitMergePredictionPosition` to turn pUSD into equal YES and NO shares on one market. A split without `authorized` previews the action and sends nothing. +- **Merge** uses the same tool to turn equal YES and NO shares on one market back into pUSD. A direct merge request is execution intent; it does not have the split's `authorized` preview requirement. The tool is destructive and host approval still applies. +- **Convert** uses `convertPredictionPosition` to turn NO shares on one market of an eligible negative-risk, one-winner event into YES shares on every other market in that event. Each receives the converted amount less any event fee; this is not a merge into pUSD. -If the market has already resolved, the tool refuses the split with `POLYMARKET_MARKET_RESOLVED`. The result then carries a typed `next` suggestion for `redeemPredictionMarket` on that `conditionId`. +For conversion, use the source market's `conditionId` from `getPolymarketPositions` and an `amount` as a decimal string or `"max"` for all held NO shares. Call without `authorized` to preview without sending. Review the source, each output, the fee and any included approvals. After confirmation, call again with `authorized: true`. The preview carries a typed `next` suggestion for that call with an editable amount and host approval. A split preview similarly suggests the authorized split. The server never executes a suggestion. + +The tool checks eligibility rather than assuming every multi-outcome event qualifies. Conversion requires held NO shares and a supported negative-risk position system; Polymarket V2 markets are not supported. It refuses closed or resolved source markets and events whose outcomes cannot all be verified as named, active, open and matching their onchain tokens, including placeholders. If the source market is closed, the result can suggest `redeemPredictionMarket` for its condition instead. Redemption is for eligible winning shares, not a conversion. + +If an operation reports an unknown outcome, it may have landed: check `getPolymarketPositions` before trying again. Also check positions before acting again if conversion succeeds but reports `verified: false`. When retrying after a timeout or error, use the same `idempotencyKey` as the original attempt. diff --git a/docs/predictions-mcp/introduction.mdx b/docs/predictions-mcp/introduction.mdx index eaf01b0a..17ab9b0b 100644 --- a/docs/predictions-mcp/introduction.mdx +++ b/docs/predictions-mcp/introduction.mdx @@ -11,7 +11,7 @@ For Ask Gina's broader user-facing capabilities, including wallets, market resea The server exposes native tools for prediction-market discovery, pricing, trading, portfolio and schedule operations, alongside a `bash` tool. Your client calls the native tools from your prompt. Inside the `bash` sandbox, `host-tools` commands reach the same host tools and add SQL over fetched market data. Two loaders, `fetchPolymarketData` and `fetchPolymarketHistory`, fill sandbox SQL tables and work only inside `bash`. [Native tools](/predictions-mcp/tools) lists every native tool by annotation class. -Some results carry a typed `next` suggestion. On a split preview, `splitMergePredictionPosition` suggests the confirmed split with `authorized: true`. When the market has already resolved, it suggests `redeemPredictionMarket` instead. `getPolymarketPositions` also suggests `redeemPredictionMarket` when a position is redeemable. The server never runs a suggestion. Your client shows the call and waits for your approval. +Some results carry a typed `next` suggestion. Split and conversion previews suggest their respective calls with `authorized: true` and an editable amount. For a closed source market they can suggest `redeemPredictionMarket` instead; `getPolymarketPositions` also suggests redemption for redeemable positions. The server never runs a suggestion. Your client shows the call and waits for your approval. See [Trading](/predictions-mcp/features-trading) for the differences and eligibility. diff --git a/docs/predictions-mcp/tools.mdx b/docs/predictions-mcp/tools.mdx index db0664fc..2639d7d2 100644 --- a/docs/predictions-mcp/tools.mdx +++ b/docs/predictions-mcp/tools.mdx @@ -61,14 +61,15 @@ Reads only state Gina stores for your account. It calls no outside provider and Places, changes, cancels or settles an order, trade or fund movement. It acts at once, repeating it can repeat the effect, and it cannot always be undone. -| Tool | Use it for | -| ------------------------------ | --------------------------------------------------------------------------------------- | -| `tradePredictionMarket` | Execute an immediate Polymarket trade | -| `managePredictionOrders` | List, create, replace and cancel orders | -| `redeemPredictionMarket` | Redeem winning positions of resolved markets | -| `splitMergePredictionPosition` | Split pUSD into YES and NO sets, or merge sets back into pUSD, on one Polymarket market | -| `topUpPredictionsBalance` | Top up your Predictions balance from a source asset | -| `withdrawPredictionsBalance` | Withdraw ready Predictions balance to your own wallet | +| Tool | Use it for | +| ------------------------------ | ------------------------------------------------------------------------------------------ | +| `tradePredictionMarket` | Execute an immediate Polymarket trade | +| `managePredictionOrders` | List, create, replace and cancel orders | +| `redeemPredictionMarket` | Redeem winning positions of resolved markets | +| `splitMergePredictionPosition` | Split pUSD into YES and NO sets, or merge sets back into pUSD, on one Polymarket market | +| `convertPredictionPosition` | Convert NO shares into YES shares on the other outcomes of an eligible negative-risk event | +| `topUpPredictionsBalance` | Top up your Predictions balance from a source asset | +| `withdrawPredictionsBalance` | Withdraw ready Predictions balance to your own wallet | ## Change a schedule @@ -152,10 +153,11 @@ These host tools are not native tools. Sandbox-only tools run inside `bash` with These tools return a typed `next` list beside their result. Each entry names a tool and arguments your client can offer as a button. Your client still shows the call and waits for your approval before it runs. -| Tool | Suggests | When | -| ------------------------------ | ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `getPolymarketPositions` | `redeemPredictionMarket` | You hold redeemable winning positions. With one, it fills that position's condition and token ids. With several, it redeems all of them. | -| `splitMergePredictionPosition` | `splitMergePredictionPosition` | A split preview needs confirmation. It suggests the same split with `authorized: true`, and you can edit the amount. If the market has already resolved, it suggests `redeemPredictionMarket` for that condition id instead. | +| Tool | Suggests | When | +| ------------------------------ | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `getPolymarketPositions` | `redeemPredictionMarket` | You hold redeemable winning positions. With one, it fills that position's condition and token ids. With several, it redeems all of them. | +| `splitMergePredictionPosition` | `splitMergePredictionPosition` | A split preview needs confirmation. It suggests the same split with `authorized: true`, and you can edit the amount. If the market has already resolved, it suggests `redeemPredictionMarket` for that condition id instead. | +| `convertPredictionPosition` | `convertPredictionPosition` | A conversion preview suggests the same conversion with `authorized: true`; the amount is editable and host approval is required. If the source market is closed, it can suggest `redeemPredictionMarket` for that condition instead. | ## Check that it works diff --git a/docs/product-guide/predictions.mdx b/docs/product-guide/predictions.mdx index f6c2e0e3..c117c116 100644 --- a/docs/product-guide/predictions.mdx +++ b/docs/product-guide/predictions.mdx @@ -35,6 +35,8 @@ Open the Predictions account view in the wallet, or ask **“Show my Polymarket Use a preparation-only request when you want to inspect terms: **“Explain the cost and outcome of buying Yes in this market; do not trade.”** Give an explicit execution instruction only when you intend to place an order. +For an eligible one-winner event, Gina can preview converting held NO shares into YES shares on the other outcomes. Review the outcomes and fee before confirming; conversion differs from merging YES and NO on one market back into pUSD. See [Trading](/predictions-mcp/features-trading) for eligibility and recovery. + For tool-level workflows, see [Predictions capabilities](/predictions-mcp/features). For an external assistant without execution, use [prediction-market research](/read-only/predictions). Related: [Wallet](/product-guide/wallet-and-account), [Transactions](/product-guide/transactions-and-portfolio), [Product Guide](/product-guide). diff --git a/plugins/ask-gina-predictions/README.md b/plugins/ask-gina-predictions/README.md index c4ee4d7b..b2cb4640 100644 --- a/plugins/ask-gina-predictions/README.md +++ b/plugins/ask-gina-predictions/README.md @@ -3,7 +3,7 @@ **What this is:** the Ask Gina Predictions MCP server for agents. Use it to search Polymarket markets, read order books, positions and order history and, with your approval, to place trades, manage orders, redeem winning positions, -split or merge positions, and top up or withdraw your prediction balance from +split, merge or convert positions, and top up or withdraw your prediction balance from your Gina wallet. It can move real funds, so review every action before you approve it. @@ -57,18 +57,25 @@ the same `https://askgina.ai/ai/predictions/mcp` endpoint. | Group | Tools | | ---------- | ---------------------------------------------------------------------------------------------------------------------------------- | | Reads | Market search, expiring markets, sports events, subject markets, exact market lookup, order book, series, positions, order history | -| Execution | Trade, manage orders, redeem, split and merge positions, top up and withdraw | +| Execution | Trade, manage orders, redeem, split, merge and convert positions, top up and withdraw | | Scheduling | Create, list, toggle, update and delete scheduled prompts | | Context | Cross-chain portfolio, wallet addresses, web search and URL fetch | | Sandbox | `bash`, for scripts, SQL over fetched market data and composed workflows | The server exposes native Predictions tools and `bash`. `fetchPolymarketData` and `fetchPolymarketHistory` fill sandbox SQL tables, so they work only inside `bash`. -A `splitMergePredictionPosition` split preview suggests the same split with -`authorized: true`, or `redeemPredictionMarket` when the market has already resolved. +A `splitMergePredictionPosition` split preview and a `convertPredictionPosition` +preview suggest the same action with `authorized: true` and an editable amount. +For a closed source market they can suggest `redeemPredictionMarket` instead. `getPolymarketPositions` suggests `redeemPredictionMarket` for redeemable positions. The server never runs a suggestion. Your host asks first. +Splitting turns pUSD into YES and NO on one market; merging turns a complete +set back into pUSD. Conversion instead turns held NO on an eligible negative-risk +one-winner event into YES on its other outcomes, less any event fee. Conversion +previews send nothing; review the outcomes, fee and approvals before confirming. +Eligibility and recovery are described in [Trading](https://docs.askgina.ai/predictions-mcp/features-trading). + The [native tools page](https://docs.askgina.ai/predictions-mcp/tools) lists every tool and its annotation class. @@ -80,7 +87,7 @@ Try: ## Money-moving actions -Trade, order-management, redeem, split-and-merge, top-up and withdraw tools are marked +Trade, order-management, redeem, split-and-merge, conversion, top-up and withdraw tools are marked destructive. They act at once and cannot always be undone. Your agent must show you the exact action and wait for your approval in chat before it calls one. Prediction markets can resolve against you, and you can lose the whole stake. diff --git a/tools/docs/venue-tools.json b/tools/docs/venue-tools.json index ebf0a68c..b3836800 100644 --- a/tools/docs/venue-tools.json +++ b/tools/docs/venue-tools.json @@ -441,6 +441,15 @@ "when": "A split preview needs confirmation. It suggests the same split with `authorized: true`, and you can edit the amount. If the market has already resolved, it suggests `redeemPredictionMarket` for that condition id instead." } }, + { + "name": "convertPredictionPosition", + "class": "execute", + "purpose": "Convert NO shares into YES shares on the other outcomes of an eligible negative-risk event", + "next": { + "tool": "convertPredictionPosition", + "when": "A conversion preview suggests the same conversion with `authorized: true`; the amount is editable and host approval is required. If the source market is closed, it can suggest `redeemPredictionMarket` for that condition instead." + } + }, { "name": "topUpPredictionsBalance", "class": "execute",