Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ai_docs/write-plugin-tool-justifications.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
| -------------------------------- | -------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
Expand All @@ -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. |
Expand Down
4 changes: 2 additions & 2 deletions docs/connect/claude.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 9 additions & 3 deletions docs/predictions-mcp/features-trading.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 1 addition & 1 deletion docs/predictions-mcp/introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<CardGroup cols={3}>
<Card title="Discover" icon="magnifying-glass">
Expand Down
26 changes: 14 additions & 12 deletions docs/predictions-mcp/tools.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions docs/product-guide/predictions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
Loading
Loading