get_positions
Retrieve a user’s positions across all markets on Manifold Markets. Input a user ID to access detailed market participation and investment data.
Instructions
Get user positions across markets
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| userId | Yes | User ID |
Input Schema (JSON Schema)
{
"properties": {
"userId": {
"description": "User ID",
"type": "string"
}
},
"required": [
"userId"
],
"type": "object"
}
Implementation Reference
- src/index.ts:762-785 (handler)Handler for the 'get_positions' tool. Parses userId from arguments, fetches user's bets/positions from Manifold API /v0/bets endpoint, handles errors, and returns JSON stringified positions.case 'get_positions': { const { userId } = GetUserPositionsSchema.parse(args); const response = await fetch( `${API_BASE}/v0/bets?userId=${userId}`, { headers: { Accept: 'application/json' } } ); if (!response.ok) { throw new McpError( ErrorCode.InternalError, `Manifold API error: ${response.statusText}` ); } const positions = await response.json(); return { content: [ { type: 'text', text: JSON.stringify(positions, null, 2), }, ], }; }
- src/index.ts:73-75 (schema)Zod input validation schema for 'get_positions' tool requiring a 'userId' string.const GetUserPositionsSchema = z.object({ userId: z.string(), });
- src/index.ts:302-312 (registration)Tool registration in listTools handler, defining name, description, and input schema for 'get_positions'.{ name: 'get_positions', description: 'Get user positions across markets', inputSchema: { type: 'object', properties: { userId: { type: 'string', description: 'User ID' }, }, required: ['userId'], }, },