Skip to main content
Glama
kinmeic

Stock MCP Server

by kinmeic

position_get

Retrieve a specific stock position record by providing the stock code and market identifier. Use this tool to access individual holding details for portfolio management.

Instructions

获取单个持仓记录

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes股票代码
marketYes市场

Implementation Reference

  • Main handler for position_get tool that parses arguments, calls position.getPosition(), and returns the result
    if (name === 'position_get') {
      const params = GetPositionSchema.parse(args);
      const result = position.getPosition(params.code, params.market as Market);
      if (!result) {
        throw new Error('Position not found');
      }
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • Implementation of getPosition function that loads positions from file and finds a single position by code and market
    // 获取单个持仓
    export function getPosition(code: string, market: Market): Position | null {
      const positions = loadPositions();
      return positions.find(p => p.code === code && p.market === market) || null;
    }
  • src/index.ts:192-203 (registration)
    Tool registration for position_get in the ListToolsRequestSchema handler, defining the tool's name, description, and input schema
    {
      name: 'position_get',
      description: '获取单个持仓记录',
      inputSchema: {
        type: 'object',
        properties: {
          code: { type: 'string', description: '股票代码' },
          market: { type: 'string', enum: ['sh', 'sz', 'hk', 'us'], description: '市场' },
        },
        required: ['code', 'market'],
      },
    },
  • Zod validation schema for position_get tool parameters (code and market)
    const GetPositionSchema = z.object({
      code: z.string().describe('股票代码'),
      market: z.enum(['sh', 'sz', 'hk', 'us']).describe('市场'),
    });
  • Type definition for Position interface that defines the structure of position data returned by position_get
    export interface Position {
      code: string;
      name: string;
      quantity: number;
      costPrice: number;
      currency: string;
      market: Market;
      createdAt: string;
      updatedAt: string;
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states this is a read operation ('获取' - get), implying it's likely non-destructive, but doesn't address permissions, rate limits, error conditions, or what the return format looks like (especially critical since there's no output schema). This leaves significant gaps for a tool with no annotation coverage.

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

Conciseness5/5

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

The description is a single, efficient phrase ('获取单个持仓记录') that directly states the tool's purpose with zero wasted words. It's appropriately sized and front-loaded, making it easy to parse quickly.

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 the lack of annotations and output schema, the description is incomplete. It doesn't explain what a 'position record' contains, how results are structured, or any behavioral aspects like error handling. For a read operation with no structured output documentation, this leaves too many unknowns for 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?

The description adds no parameter information beyond what's already in the schema, which has 100% coverage with clear descriptions ('股票代码' - stock code, '市场' - market) and an enum for the market parameter. Since the schema does the heavy lifting, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

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

Purpose4/5

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

The description '获取单个持仓记录' (Get single position record) clearly states the verb ('获取' - get) and resource ('持仓记录' - position record), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'position_list' (which presumably lists multiple positions) or 'stock_get' (which gets stock information rather than position records), keeping it from a perfect score.

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. It doesn't mention when to choose 'position_get' over 'position_list' (for multiple positions) or 'stock_get' (for stock data rather than position data), nor does it specify prerequisites or exclusions for usage.

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