cancel_bet
Cancel an existing limit order bet on Manifold Markets by providing its unique bet ID.
Instructions
Cancel a limit order bet
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| betId | Yes | Bet ID to cancel |
Implementation Reference
- src/index.ts:88-90 (schema)Zod schema for cancel_bet tool input validation - requires a betId string
const CancelBetSchema = z.object({ betId: z.string(), }); - src/index.ts:266-276 (registration)Registration of the 'cancel_bet' tool with description and input schema (name, description, inputSchema)
{ name: 'cancel_bet', description: 'Cancel a limit order bet', inputSchema: { type: 'object', properties: { betId: { type: 'string', description: 'Bet ID to cancel' }, }, required: ['betId'], }, }, - src/index.ts:650-681 (handler)Handler for cancel_bet: parses betId, makes POST request to /v0/bet/cancel/{betId} with API key auth, returns success message
case 'cancel_bet': { const { betId } = CancelBetSchema.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/cancel/${betId}`, { method: 'POST', headers: { Authorization: `Key ${apiKey}`, }, }); if (!response.ok) { throw new McpError( ErrorCode.InternalError, `Manifold API error: ${response.statusText}` ); } return { content: [ { type: 'text', text: 'Bet cancelled successfully', }, ], };