Skip to main content
Glama
kinmeic

Stock MCP Server

by kinmeic

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The actual implementation of watch_list tool - getAllWatch() function that loads and returns all watch items from the JSON file
    export 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 JSON
    if (name === 'watch_list') {
      const result = watch.getAllWatch();
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • 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: {},
      },
    },
  • Helper function loadWatchList() that reads and parses the watch.json file, returns empty array if file doesn't exist or on error
    function 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 [];
    }
  • 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;
    }

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