Skip to content

MCP Tool Table ​

stock-sdk derives read-only MCP tools from the same MethodSpec definitions used by the CLI. Each tool provides a name, description, and inputSchema through tools/list.

Exact tools follow the implementation. The table below is an overview of tools derived from read-only namespace methods; tool names and input fields follow the final manifest. Write operations and debug-only *Raw methods are not exposed as tools.

Tool overview ​

Tool (derived from)Namespace methodsDescription
Quotessdk.quotes.cn / cnSimple / hk / us / fundA-share full/simple, HK, US, fund quotes
Intraday & order booksdk.quotes.timeline / largeOrder / fundFlowIntraday timeline, large orders, simple fund flow
Batch quotessdk.batch.cn / hk / us / byCodesWhole-market or by-code batch quotes
K-linesdk.kline.cn / hk / us / cnMinute / hkMinute / usMinuteHistorical and minute K-lines
K-line with indicatorssdk.kline.withIndicatorsK-line plus built-in technical indicators
Indicator signalssdk.kline.signalsGolden/death crosses, overbought/oversold, breakouts, reversals — 14 signal types
Chip distributionsdk.chips.cn / hk / usProfit ratio / avg cost / cost ranges & concentration / chip peak
Code listssdk.codes.cn / us / hk / fundPer-market symbol lists
Boardssdk.board.industry.* / sdk.board.concept.*Industry / concept board list, spot, constituents, K-line
Fund flowsdk.fundFlow.individual / market / rank / sectorRankStock / market / rank / sector fund flow
Northboundsdk.northbound.minute / summary / holdingRank / individualStock Connect / northbound capital
Market eventssdk.marketEvent.ztPool / stockChanges / boardChanges / unusualFluctuationLimit-up pool / stock changes / board changes / regulatory fluctuation alerts
Dragon-Tigersdk.dragonTiger.detail / stockStats / institution / branchRankDragon-Tiger list details and stats
Block tradesdk.blockTrade.marketStat / detail / dailyStatBlock-trade stats and details
Marginsdk.margin.accountInfo / targetListMargin account info and target list
Optionssdk.options.index.* / etf.* / commodity.* / cffex.* / lhbIndex / ETF / commodity / CFFEX options
Futuressdk.futures.kline / globalSpot / globalKline / inventoryDomestic/global futures quotes and inventory
Fund extrassdk.fund.dividendList / navHistory / rankHistory / profile / theme.*Fund dividends / NAV / ranking / deep profile / theme funds
Trading calendarsdk.calendar.isTradingDay / nextTradingDay / marketStatusTrading-day checks and market status
Referencesdk.reference.dividendDetail / tradingCalendarDividend detail / A-share trading calendar
Searchsdk.search(keyword)Search stocks / funds by keyword

Tool call semantics ​

  • Pass stock codes as strings such as "600519" or "AAPL". The server validates array entries and nested indicator fields against inputSchema. Errors identify the field path, such as codes[0] or indicators.ma.periods[0].
  • Argument mapping: tools/call looks up the manifest by name, and invoke(sdk, args) maps named parameters explicitly onto the SDK method's positional arguments — no runtime reflection.
  • Result: a successful result is wrapped as { content: [{ type: 'text', text: JSON.stringify(result) }] }; the text is the result serialized per the v2 data contract (unified Quote discriminated union, timestamp: number | null, percentages as percentage numbers, no raw field — exact fields follow the implementation).
  • Error semantics: a tool execution failure returns { content, isError: true }, handing the error to the model; only unknown-tool / protocol-level errors use a JSON-RPC error.

Time series and large results ​

  • When K-lines or signals exceed 200 rows or 80,000 characters, the server returns the newest records in ascending order under sample.total counts the rows before truncation, returned counts the returned rows, and start and end give the first and last dates or times. The result includes truncated: true. Complete results remain arrays.
  • Rankings such as fund-flow rankings keep the top rows in their original rank order. The sample includes up to 200 rows and shrinks further to fit the character limit. Use page and pageSize on tools that support pagination to request a specific slice.
  • get_fund_nav_history and get_fund_rank_history retain code, name, and items and add coverage: { total, returned, start, end, truncated }. total counts rows after date filtering and before truncation. An empty interval yields empty items with null for start and end.

The fund history tools accept optional, inclusive startDate and endDate in YYYY-MM-DD or YYYYMMDD format. For example, call get_fund_nav_history({ code: "110022", startDate: "2026-09-01", endDate: "2026-10-31" }). The dates filter the MCP response. The SDK methods fund.navHistory(code) and fund.rankHistory(code) return full histories.

Shared manifest with the CLI ​

Register a MethodSpec in src/spec/methods.ts to derive both CLI and MCP entries. The indicator K-line tool defines a custom schema for its nested indicators object.

Next steps ​