add_liquidity
Add mana to a market's liquidity pool on Manifold Markets to facilitate trading and improve market stability.
Instructions
Add mana to market liquidity pool
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| marketId | Yes | Market ID | |
| amount | Yes | Amount of mana to add |
Implementation Reference
- src/index.ts:724-760 (handler)Handler for the 'add_liquidity' tool. Validates input using AddLiquiditySchema, requires MANIFOLD_API_KEY, sends POST request to Manifold Markets API to add liquidity to the specified market, and returns a 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', }, ], }; }
- src/index.ts:83-86 (schema)Zod schema defining the input parameters for the add_liquidity tool: marketId (string) and amount (positive number).const AddLiquiditySchema = z.object({ marketId: z.string(), amount: z.number().positive(), });
- src/index.ts:290-301 (registration)Tool registration in the listTools handler, specifying name, description, and inputSchema for the MCP client.{ 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'], }, },