Skip to main content
Glama
bmorphism

Manifold Markets MCP Server

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
NameRequiredDescriptionDefault
marketIdYesMarket ID
amountYesAmount to bet in mana
outcomeYes
limitProbNoOptional limit order probability (0.01-0.99)

Implementation Reference

  • 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),
          },
        ],
      };
    }
  • 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'],
      },
    },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bmorphism/manifold-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server