watch_get
Retrieve real-time data for a specific stock by entering its code and market to monitor individual positions in A-shares, Hong Kong, or US markets.
Instructions
获取单个观察股票
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | 股票代码 | |
| market | Yes | 市场 |
Implementation Reference
- src/watch.ts:95-99 (handler)The getWatch function implementation that loads the watch list and finds a single watch item by code and market// 获取单个观察股票 export function getWatch(code: string, market: Market): WatchItem | null { const watchList = loadWatchList(); return watchList.find(item => item.code === code && item.market === market) || null; }
- src/index.ts:252-263 (registration)Tool registration in the ListToolsRequestSchema handler, defining watch_get with name, description, and inputSchema{ name: 'watch_get', description: '获取单个观察股票', inputSchema: { type: 'object', properties: { code: { type: 'string', description: '股票代码' }, market: { type: 'string', enum: ['sh', 'sz', 'hk', 'us'], description: '市场' }, }, required: ['code', 'market'], }, },
- src/index.ts:461-475 (handler)The MCP tool request handler for watch_get that parses arguments, calls watch.getWatch(), and returns the resultif (name === 'watch_get') { const params = GetWatchSchema.parse(args); const result = watch.getWatch(params.code, params.market as Market); if (!result) { throw new Error('Watch item not found'); } return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
- src/index.ts:72-75 (schema)Zod schema for validating watch_get input parameters (code and market)const GetWatchSchema = z.object({ code: z.string().describe('股票代码'), market: z.enum(['sh', 'sz', 'hk', 'us']).describe('市场'), });
- src/types.ts:92-99 (schema)WatchItem interface defining the structure of watch list items returned by watch_get// 观察股票信息 export interface WatchItem { code: string; name: string; reason: string; market: Market; createdAt: string; }