position_list
Retrieve all stock position records from the Stock MCP Server to track and manage your investment portfolio across multiple markets.
Instructions
获取所有持仓记录
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:363-373 (handler)Tool handler for position_list that calls position.getAllPositions() and returns the results as JSONif (name === 'position_list') { const result = position.getAllPositions(); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
- src/position.ts:92-94 (handler)Core implementation of getAllPositions() function that loads and returns all position recordsexport function getAllPositions(): Position[] { return loadPositions(); }
- src/position.ts:8-18 (helper)Helper function loadPositions() that reads position data from positions.json filefunction loadPositions(): Position[] { try { if (fs.existsSync(DATA_FILE)) { const data = fs.readFileSync(DATA_FILE, 'utf-8'); return JSON.parse(data); } } catch (error) { console.error('Failed to load positions:', error); } return []; }
- src/types.ts:81-90 (schema)Position interface schema defining the structure of position dataexport interface Position { code: string; name: string; quantity: number; costPrice: number; currency: string; market: Market; createdAt: string; updatedAt: string; }
- src/index.ts:185-191 (registration)Tool registration for position_list in the ListToolsRequestSchema handlername: 'position_list', description: '获取所有持仓记录', inputSchema: { type: 'object', properties: {}, }, },