Skip to main content
Glama
kinmeic

Stock MCP Server

by kinmeic

watch_update

Update stock watchlist entries by modifying codes, markets, names, or reasons for tracking specific securities in real-time market monitoring.

Instructions

更新观察股票(名称或观察理由)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes股票代码
marketYes市场
nameNo股票名称
reasonNo观察理由或目标

Implementation Reference

  • Handler function for watch_update tool that parses arguments and calls watch.updateWatch implementation
    if (name === 'watch_update') {
      const params = UpdateWatchSchema.parse(args);
      const result = watch.updateWatch(
        params.code,
        params.market as Market,
        {
          name: params.name,
          reason: params.reason,
        }
      );
      if (!result) {
        throw new Error('Watch item not found');
      }
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • Core implementation of updateWatch function that loads watch list, finds and updates the specified stock item, then saves the list
    export function updateWatch(
      code: string,
      market: Market,
      updates: Partial<Pick<WatchItem, 'name' | 'reason'>>
    ): WatchItem | null {
      const watchList = loadWatchList();
      const index = watchList.findIndex(item => item.code === code && item.market === market);
    
      if (index === -1) {
        return null;
      }
    
      watchList[index] = {
        ...watchList[index],
        ...updates,
      };
    
      saveWatchList(watchList);
      return watchList[index];
    }
  • Zod schema definition for UpdateWatchSchema that validates watch_update tool parameters
    const UpdateWatchSchema = z.object({
      code: z.string().describe('股票代码'),
      market: z.enum(['sh', 'sz', 'hk', 'us']).describe('市场'),
      name: z.string().optional().describe('股票名称'),
      reason: z.string().optional().describe('观察理由或目标'),
    });
  • src/index.ts:218-231 (registration)
    Tool registration for watch_update in the ListTools handler with description and input schema
    {
      name: 'watch_update',
      description: '更新观察股票(名称或观察理由)',
      inputSchema: {
        type: 'object',
        properties: {
          code: { type: 'string', description: '股票代码' },
          market: { type: 'string', enum: ['sh', 'sz', 'hk', 'us'], description: '市场' },
          name: { type: 'string', description: '股票名称' },
          reason: { type: 'string', description: '观察理由或目标' },
        },
        required: ['code', 'market'],
      },
    },
  • Type definition for WatchItem interface used by watch_update operations
    export interface WatchItem {
      code: string;
      name: string;
      reason: string;
      market: Market;
      createdAt: string;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It mentions updating a watched stock, implying a mutation, but doesn't disclose behavioral traits like whether this requires specific permissions, if changes are reversible, or what happens if the stock isn't already watched. For a mutation tool with zero annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's function. It's appropriately sized and front-loaded with the core action. However, it could be slightly more structured by explicitly mentioning the required parameters, but overall it avoids unnecessary verbosity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given this is a mutation tool with no annotations and no output schema, the description is incomplete. It doesn't explain what the update does (e.g., modifies existing watch entry), potential errors, or return values. For a tool with 4 parameters and complex sibling relationships, more context is needed to guide effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all parameters (code, market, name, reason) with descriptions. The description adds no additional meaning beyond what the schema provides, such as explaining how name and reason interact or their optional nature. Baseline 3 is appropriate when schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool updates a watched stock's name or reason, which is a clear verb+resource combination. However, it doesn't distinguish this from sibling tools like watch_add or watch_update, leaving ambiguity about when to use each. The purpose is understandable but lacks sibling differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like watch_add or watch_remove. There's no mention of prerequisites, such as needing an existing watch entry, or context for when updates are appropriate versus adding/removing. Usage is implied but not explicitly stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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