watch_list
Retrieve all stocks in your watchlist to monitor real-time market positions across A-shares, Hong Kong, and US markets.
Instructions
获取所有观察股票
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/watch.ts:91-93 (handler)The actual implementation of watch_list tool - getAllWatch() function that loads and returns all watch items from the JSON fileexport function getAllWatch(): WatchItem[] { return loadWatchList(); }
- src/index.ts:449-459 (registration)The request handler for watch_list tool that calls watch.getAllWatch() and returns the result as JSONif (name === 'watch_list') { const result = watch.getAllWatch(); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
- src/index.ts:244-251 (schema)Tool registration schema for watch_list in the ListToolsRequestSchema handler, defining the tool's name and input schema (empty object) with description{ name: 'watch_list', description: '获取所有观察股票', inputSchema: { type: 'object', properties: {}, }, },
- src/watch.ts:8-18 (helper)Helper function loadWatchList() that reads and parses the watch.json file, returns empty array if file doesn't exist or on errorfunction loadWatchList(): WatchItem[] { 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 watch list:', error); } return []; }
- src/types.ts:93-99 (schema)Type definition for WatchItem interface defining the structure of watch list items (code, name, reason, market, createdAt)export interface WatchItem { code: string; name: string; reason: string; market: Market; createdAt: string; }