remove_liquidity
Enable users to withdraw specified liquidity amounts from market pools on Manifold Markets by providing the market ID and desired amount.
Instructions
Remove liquidity from market pool
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| amount | Yes | Amount of liquidity to remove | |
| contractId | Yes | Market ID |
Input Schema (JSON Schema)
{
"properties": {
"amount": {
"description": "Amount of liquidity to remove",
"type": "number"
},
"contractId": {
"description": "Market ID",
"type": "string"
}
},
"required": [
"contractId",
"amount"
],
"type": "object"
}
Implementation Reference
- src/index.ts:1016-1052 (handler)Handler for remove_liquidity tool: parses params with RemoveLiquiditySchema, authenticates with MANIFOLD_API_KEY, POSTs to Manifold API /v0/market/{contractId}/remove-liquidity with amount, 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 schema for remove_liquidity input: requires 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)MCP tool registration for remove_liquidity, including name, description, and inputSchema matching the Zod schema.{ 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'] } },