remove_liquidity
Withdraw funds from a prediction market liquidity pool to retrieve your stake and reduce market exposure.
Instructions
Remove liquidity from market pool
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| contractId | Yes | Market ID | |
| amount | Yes | Amount of liquidity to remove |
Implementation Reference
- src/index.ts:1016-1052 (handler)Handler for remove_liquidity tool: validates params with schema, checks API key, POSTs to Manifold API to remove liquidity from market, returns success message.case 'remove_liquidity': { const params = RemoveLiquiditySchema.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.contractId}/remove-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 removed successfully', }, ], }; }
- src/index.ts:123-126 (schema)Zod input schema for remove_liquidity tool defining contractId (string) and amount (positive finite number).const RemoveLiquiditySchema = z.object({ contractId: z.string(), amount: z.number().positive().finite(), });
- src/index.ts:386-397 (registration)Registration of remove_liquidity tool in the ListTools response, including name, description, and input schema definition.{ name: 'remove_liquidity', description: 'Remove liquidity from market pool', inputSchema: { type: 'object', properties: { contractId: { type: 'string', description: 'Market ID' }, amount: { type: 'number', description: 'Amount of liquidity to remove' } }, required: ['contractId', 'amount'] } },