Skip to content

feat(tools): add 6 stock-detail tools - #43

Merged
hogan-yuan merged 18 commits into
mainfrom
feat/stock-detail-tools
May 15, 2026
Merged

feat(tools): add 6 stock-detail tools#43
hogan-yuan merged 18 commits into
mainfrom
feat/stock-detail-tools

Conversation

@hogan-yuan

@hogan-yuan hogan-yuan commented May 12, 2026

Copy link
Copy Markdown
Member

Summary

Implements 6 new tools from docs/stock-detail-mcp-prompt.md:

Tool Path
business_segments GET /v1/quote/fundamentals/business-segments
business_segments_history GET /v1/quote/fundamentals/business-segments/history
institutional_views GET /v1/quote/ratings/institutional
industry_rank GET /v1/quote/industry/rank
industry_peers GET /v1/quote/industries/peers
financial_report_snapshot GET /v1/quote/financials/earnings-snapshot

Details

  • counter.rs: added bk_symbol_to_counter / bk_counter_to_symbol for IN00xxx.US ↔ BK/US/IN00xxx conversion
  • industry_rank: recursively converts BK counter_id fields to symbol in response
  • locales: zh-CN and zh-HK entries added for all 6 tools
  • cargo test locales_match_live_tool_schema

🤖 Generated with Claude Code

hogan-yuan and others added 10 commits May 15, 2026 10:21
…nal views, industry rank/peers, earnings snapshot

- fundamental: business_segments, business_segments_history, institutional_views, industry_peers, financial_report_snapshot
- market: industry_rank (with BK counter_id → IN00xxx.MARKET conversion)
- counter: bk_symbol_to_counter, bk_counter_to_symbol
- locales: zh-CN/zh-HK entries for all 6 new tools

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
- Cursor Directory approved: https://cursor.directory/plugins/longbridge
- README/server.json: 127 → 133 tools
- toolCategories: fundamental 16→19, market 9→10

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Host header was being forwarded to upstream causing 400 Bad Request.
Also exclude content-type, accept, authorization, mcp-session-id and
other headers that must not cross the MCP-server↔upstream boundary.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…onse structure

New API returns fo_revenue/fo_ebit/fo_eps + fr_* financial ratios instead
of ai_summary/peer_companies/forecast_data
@hogan-yuan
hogan-yuan force-pushed the feat/stock-detail-tools branch from b085e85 to 72f1829 Compare May 15, 2026 02:21
hogan-yuan and others added 8 commits May 15, 2026 11:29
- industry_peers: accept BK counter_ids (BK/US/IN00258) directly,
  or symbol (IN00446.US) — same logic as terminal CLI
- industry_rank: preserve counter_id in response alongside symbol
  so callers can pass it directly to industry_peers
- counter.rs: remove bk_symbol_to_counter / bk_counter_to_symbol
  (BK counter_ids are now passed through directly)

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
- industry_rank: clarify counter_id(BK/US/IN00258) in response, direct passthrough to industry_peers
- industry_peers: clarify accepts BK counter_id or symbol, per-node stock_num/chg/ytd_chg

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
transform_json renames counter_id → symbol, so industry_rank output
contains IN00258.US instead of BK/US/IN00258. Detect IN-prefix symbols
and convert to BK/<market>/<code> directly.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
transform_json renames counter_id→symbol, losing the BK format.
Reconstruct counter_id from IN-prefix symbols so callers can pass
it directly to industry_peers without any conversion.

Also simplify industry_peers: BK counter_id or IN-prefix symbol
both work, IN detection is now only needed as fallback.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…bk_counter_ids

Use raw HTTP response to preserve BK counter_ids as-is.
Removes the pointless counter_id→symbol→counter_id round-trip.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@hogan-yuan
hogan-yuan merged commit 69b3de7 into main May 15, 2026
1 check passed
@hogan-yuan
hogan-yuan deleted the feat/stock-detail-tools branch May 15, 2026 07:56
hogan-yuan added a commit that referenced this pull request Jul 6, 2026
## Summary

Implements 6 new tools from `docs/stock-detail-mcp-prompt.md`:

| Tool | Path |
|------|------|
| `business_segments` | `GET /v1/quote/fundamentals/business-segments` |
| `business_segments_history` | `GET
/v1/quote/fundamentals/business-segments/history` |
| `institutional_views` | `GET /v1/quote/ratings/institutional` |
| `industry_rank` | `GET /v1/quote/industry/rank` |
| `industry_peers` | `GET /v1/quote/industries/peers` |
| `financial_report_snapshot` | `GET
/v1/quote/financials/earnings-snapshot` |

### Details
- `counter.rs`: added `bk_symbol_to_counter` / `bk_counter_to_symbol`
for `IN00xxx.US ↔ BK/US/IN00xxx` conversion
- `industry_rank`: recursively converts BK `counter_id` fields to
`symbol` in response
- `locales`: zh-CN and zh-HK entries added for all 6 tools
- `cargo test locales_match_live_tool_schema` ✅

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant