Skip to content

Conversation

@Jye10032
Copy link
Contributor

@Jye10032 Jye10032 commented Dec 22, 2025

feat: add 6 new LSP tools
Add the following new MCP tools to match Claude Code's built-in LSP capabilities:

  • get_hover: Get hover information (documentation, type info) for a symbol
  • find_workspace_symbols: Search for symbols across the entire workspace
  • find_implementation: Find implementations of interfaces/abstract methods
  • prepare_call_hierarchy: Get call hierarchy item at a position
  • get_incoming_calls: Find all callers of a function
  • get_outgoing_calls: Find all functions called by a function

Changes:

  • src/types.ts: Add CallHierarchyItem, CallHierarchyIncomingCall, CallHierarchyOutgoingCall types
  • src/lsp-client.ts: Add hover(), workspaceSymbol(), findImplementation(), prepareCallHierarchy(), incomingCalls(), outgoingCalls() methods
  • index.ts: Add MCP tool definitions and handlers for all new tools

@Jye10032 Jye10032 force-pushed the feature/add-lsp-tools branch 2 times, most recently from bcdc88b to f32c6ba Compare December 22, 2025 10:47
Add the following new MCP tools to match Claude Code's built-in LSP capabilities:

- get_hover: Get hover information (documentation, type info) for a symbol
- find_workspace_symbols: Search for symbols across the entire workspace
- find_implementation: Find implementations of interfaces/abstract methods
- prepare_call_hierarchy: Get call hierarchy item at a position
- get_incoming_calls: Find all callers of a function
- get_outgoing_calls: Find all functions called by a function

Changes:
- src/types.ts: Add CallHierarchyItem, CallHierarchyIncomingCall, CallHierarchyOutgoingCall types
- src/lsp-client.ts: Add hover(), workspaceSymbol(), findImplementation(), prepareCallHierarchy(), incomingCalls(), outgoingCalls() methods
- index.ts: Add MCP tool definitions and handlers for all new tools
@Jye10032 Jye10032 force-pushed the feature/add-lsp-tools branch from f32c6ba to 3512e85 Compare December 22, 2025 10:48
@ktnyt
Copy link
Owner

ktnyt commented Jan 2, 2026

@Jye10032 Hi sorry for the late response.
I wanted your opinion on this project, as this PR suggests Claude Code has built-in LSP capabilities.
If Claude Code's built-in tools are just a simple wrapper of LSPs, I think cclsp still has it's place as the way it finds symbols is tuned to work well with coding agents.
In the meanwhile I'll review this PR and add some tests.

Would be happy to hear back from you!

Copy link
Owner

@ktnyt ktnyt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

レビューコメント

全体的に良い実装ですが、いくつか改善点があります:

重要な問題

  1. URIからファイルパスの変換: incomingCallsoutgoingCallsitem.uri.replace('file://', '')を使っていますが、これはWindowsパスで正しく動作しません。既存のuriToPathユーティリティ関数を使うべきです。

改善提案

  1. workspaceSymbolの複数サーバー対応: 複数のLSPサーバーが実行されている場合、すべてのサーバーから結果を取得する方が良いでしょう。

  2. ensureFileOpenの戻り値: PR #30の変更と整合性を取るため、hoverfindImplementationprepareCallHierarchyでもファイルが初めて開かれた場合の待機時間を検討してください。

  3. パフォーマンス最適化: get_incoming_callsget_outgoing_callsprepareCallHierarchyを毎回呼び出していますが、キャッシュを検討できます。

良い点

  • 型定義が適切に追加されている
  • エラーハンドリングが一貫している
  • デバッグログが適切に追加されている
  • 既存のコードスタイルと整合している

特に1番の問題は修正が必要です。他の点は改善提案です。

@ktnyt ktnyt changed the base branch from main to feature/add-lsp-tools January 2, 2026 05:34
@ktnyt ktnyt merged commit c9cee49 into ktnyt:feature/add-lsp-tools Jan 2, 2026
0 of 10 checks passed
ktnyt added a commit that referenced this pull request Jan 2, 2026
…ementation, prepareCallHierarchy, incomingCalls, outgoingCalls)

Add comprehensive test coverage for the 6 new LSP methods added in PR #28:
- hover: Test hover information retrieval and null handling
- workspaceSymbol: Test workspace-wide symbol search with multiple scenarios
- findImplementation: Test implementation finding with array and object results
- prepareCallHierarchy: Test call hierarchy preparation
- incomingCalls: Test incoming calls retrieval (includes uriToPath usage verification)
- outgoingCalls: Test outgoing calls retrieval (includes uriToPath usage verification)

All tests follow the existing test patterns using mocks for getServer,
ensureFileOpen, and sendRequest methods.
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.

2 participants