-
Notifications
You must be signed in to change notification settings - Fork 4
feat(mcp): add status tool #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
b5d59b6 to
3a67769
Compare
Tasks: STATUS-001, STATUS-002, STATUS-003, STATUS-004, STATUS-005 Batch: 1/3
Tasks: STATUS-006 Batch: 2/3
Tasks: STATUS-007 Batch: 3/3
3a67769 to
f613959
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a new get_server_status MCP tool that provides visibility into registered LSP servers and their current state. It also includes shortened tool descriptions across all MCP tools to improve AI agent context window compatibility.
Changes:
- Added
get_server_statustool returning server state, command, and document counts for all registered LSP servers - Added accessor methods:
LspClient::state(),LspClient::config(), andDocumentTracker::documents() - Implemented
Displaytrait forServerStateto provide lowercase string representations - Shortened all MCP tool descriptions for better AI agent compatibility
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/user-guide/tools-reference.md | Added complete documentation for get_server_status tool, updated tool count to 17 |
| crates/mcpls-core/src/mcp/tools.rs | Added ServerStatusParams with custom deserialization for empty parameters |
| crates/mcpls-core/src/mcp/server.rs | Added get_server_status handler, shortened all tool descriptions |
| crates/mcpls-core/src/lsp/lifecycle.rs | Added Display implementation for ServerState with lowercase output |
| crates/mcpls-core/src/lsp/client.rs | Added state() async method and config() getter with comprehensive tests |
| crates/mcpls-core/src/bridge/translator.rs | Implemented handle_server_status with per-language document counting |
| crates/mcpls-core/src/bridge/state.rs | Added documents() accessor for DocumentTracker |
| README.md | Added get_server_status to Server Monitoring Tools table |
| CHANGELOG.md | Documented new feature and tool description changes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| let status = result.unwrap(); | ||
| assert_eq!(status.total_servers, 2); | ||
|
|
||
| for server in &status.servers { | ||
| if server.language_id == "rust" { | ||
| assert_eq!(server.document_count, 1); | ||
| } else if server.language_id == "python" { | ||
| assert_eq!(server.document_count, 1); | ||
| } | ||
| } |
Copilot
AI
Jan 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test verifies per-server document counts but doesn't assert the total document_count field in ServerStatusResult. Consider adding an assertion like assert_eq!(status.document_count, 2); after line 3017 to ensure the total document count matches the expected value (sum of all open documents across all languages).
| let status = result.unwrap(); | ||
| assert_eq!(status.servers.len(), 1); | ||
|
|
||
| let rust_server = &status.servers[0]; | ||
| assert_eq!(rust_server.language_id, "rust"); | ||
| assert_eq!(rust_server.document_count, 2); |
Copilot
AI
Jan 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test verifies the per-server document count but doesn't assert the total document_count field in ServerStatusResult. Consider adding an assertion like assert_eq!(status.document_count, 2); after line 2977 to verify the total document count across all servers matches the expected value.
Description
Add
get_server_statusMCP tool that shows which LSP servers are registered and their current status. Returns JSON with server list (language_id, status, command, document_count), total server count, and total document count.Type of Change
Related Issues
N/A
Checklist
Additional Notes
Adds accessors for
LspClient::state(),LspClient::config(), and DocumentTracker::documents()to support status reporting. The handler is async due toServerStatebeing behindArc<Mutex<_>>`.