Skip to main content
Glama
kinmeic

Stock MCP Server

by kinmeic

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Tool handler for position_list that calls position.getAllPositions() and returns the results as JSON
    if (name === 'position_list') { const result = position.getAllPositions(); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
  • Core implementation of getAllPositions() function that loads and returns all position records
    export function getAllPositions(): Position[] { return loadPositions(); }
  • Helper function loadPositions() that reads position data from positions.json file
    function 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 []; }
  • Position interface schema defining the structure of position data
    export 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 handler
    name: 'position_list', description: '获取所有持仓记录', inputSchema: { type: 'object', properties: {}, }, },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kinmeic/stock-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server