place_bet
Place a bet on prediction market outcomes using market ID, amount, and outcome selection to participate in forecasting events.
Instructions
Place a bet on a market
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| marketId | Yes | Market ID | |
| amount | Yes | Amount to bet in mana | |
| outcome | Yes | ||
| limitProb | No | Optional limit order probability (0.01-0.99) |
Implementation Reference
- src/index.ts:608-648 (handler)Handler for place_bet tool: parses input with PlaceBetSchema, calls Manifold Markets /v0/bet API to place the bet, returns the result.case 'place_bet': { const params = PlaceBetSchema.parse(args); const apiKey = process.env.MANIFOLD_API_KEY; if (!apiKey) { throw new McpError( ErrorCode.InternalError, 'MANIFOLD_API_KEY environment variable is required' ); } const response = await fetch(`${API_BASE}/v0/bet`, { method: 'POST', headers: { 'Content-Type': 'application/json', Authorization: `Key ${apiKey}`, }, body: JSON.stringify({ contractId: params.marketId, amount: params.amount, outcome: params.outcome, limitProb: params.limitProb, }), }); if (!response.ok) { throw new McpError( ErrorCode.InternalError, `Manifold API error: ${response.statusText}` ); } const result = await response.json(); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
- src/index.ts:58-63 (schema)Zod schema defining input parameters for the place_bet tool: marketId, amount, outcome (YES/NO), optional limitProb.const PlaceBetSchema = z.object({ marketId: z.string(), amount: z.number().positive(), outcome: z.enum(['YES', 'NO']), limitProb: z.number().min(0.01).max(0.99).optional(), });
- src/index.ts:249-265 (registration)Tool registration in listTools response: defines name, description, and inputSchema for place_bet.{ name: 'place_bet', description: 'Place a bet on a market', inputSchema: { type: 'object', properties: { marketId: { type: 'string', description: 'Market ID' }, amount: { type: 'number', description: 'Amount to bet in mana' }, outcome: { type: 'string', enum: ['YES', 'NO'] }, limitProb: { type: 'number', description: 'Optional limit order probability (0.01-0.99)', }, }, required: ['marketId', 'amount', 'outcome'], }, },