place_bet
Place bets on Manifold Markets prediction platform by specifying market ID, amount, and outcome. Optionally set a limit probability for precise trading decisions.
Instructions
Place a bet on a market
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| amount | Yes | Amount to bet in mana | |
| limitProb | No | Optional limit order probability (0.01-0.99) | |
| marketId | Yes | Market ID | |
| outcome | Yes |
Input Schema (JSON Schema)
{
"properties": {
"amount": {
"description": "Amount to bet in mana",
"type": "number"
},
"limitProb": {
"description": "Optional limit order probability (0.01-0.99)",
"type": "number"
},
"marketId": {
"description": "Market ID",
"type": "string"
},
"outcome": {
"enum": [
"YES",
"NO"
],
"type": "string"
}
},
"required": [
"marketId",
"amount",
"outcome"
],
"type": "object"
}
Implementation Reference
- src/index.ts:608-648 (handler)Handler function for 'place_bet' tool: parses arguments using PlaceBetSchema, checks for MANIFOLD_API_KEY, sends POST request to Manifold Markets /v0/bet API, handles errors, and returns the bet result as JSON.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 place_bet: marketId (string), amount (positive number), outcome (YES/NO), optional limitProb (0.01-0.99).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 handler: defines name, description, and inputSchema matching the Zod schema for MCP tool discovery.{ 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'], }, },