add_liquidity
Add mana to a prediction market's liquidity pool to improve trading conditions and earn fees.
Instructions
Add mana to market liquidity pool
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| marketId | Yes | Market ID | |
| amount | Yes | Amount of mana to add |
Implementation Reference
- src/index.ts:83-86 (schema)Zod schema for add_liquidity tool input validation: marketId (string) and amount (positive number).
const AddLiquiditySchema = z.object({ marketId: z.string(), amount: z.number().positive(), }); - src/index.ts:291-301 (registration)Tool registration entry for 'add_liquidity' with name, description, and inputSchema (marketId required string, amount required number).
name: 'add_liquidity', description: 'Add mana to market liquidity pool', inputSchema: { type: 'object', properties: { marketId: { type: 'string', description: 'Market ID' }, amount: { type: 'number', description: 'Amount of mana to add' }, }, required: ['marketId', 'amount'], }, }, - src/index.ts:724-760 (handler)Handler for 'add_liquidity': parses args with AddLiquiditySchema, validates MANIFOLD_API_KEY, POSTs to /v0/market/{marketId}/add-liquidity with amount in body, returns success message.
case 'add_liquidity': { const params = AddLiquiditySchema.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/market/${params.marketId}/add-liquidity`, { method: 'POST', headers: { 'Content-Type': 'application/json', Authorization: `Key ${apiKey}`, }, body: JSON.stringify({ amount: params.amount, }), }); if (!response.ok) { throw new McpError( ErrorCode.InternalError, `Manifold API error: ${response.statusText}` ); } return { content: [ { type: 'text', text: 'Liquidity added successfully', }, ], }; }