Skip to content

Conversation

@srnnkls
Copy link
Contributor

@srnnkls srnnkls commented Jan 23, 2026

Description

Add get_server_status MCP 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

  • New feature (non-breaking change that adds functionality)

Related Issues

N/A

Checklist

  • I have read the CONTRIBUTING guide
  • My code follows the project's coding style
  • I have added tests that prove my fix/feature works
  • All new and existing tests pass
  • I have updated the documentation accordingly
  • I have updated the CHANGELOG.md (for user-facing changes)

Additional Notes

Adds accessors for LspClient::state(), LspClient::config(), and DocumentTracker::documents()to support status reporting. The handler is async due toServerStatebeing behindArc<Mutex<_>>`.

@srnnkls srnnkls changed the title Feat/add status tool feat(mcp): add status tool Jan 23, 2026
@srnnkls srnnkls force-pushed the feat/add-status-tool branch from b5d59b6 to 3a67769 Compare January 23, 2026 11:53
Tasks: STATUS-001, STATUS-002, STATUS-003, STATUS-004, STATUS-005
Batch: 1/3
Tasks: STATUS-007
Batch: 3/3
Copy link

Copilot AI left a 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_status tool returning server state, command, and document counts for all registered LSP servers
  • Added accessor methods: LspClient::state(), LspClient::config(), and DocumentTracker::documents()
  • Implemented Display trait for ServerState to 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.

Comment on lines +3016 to +3025
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);
}
}
Copy link

Copilot AI Jan 23, 2026

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).

Copilot uses AI. Check for mistakes.
Comment on lines +2976 to +2981
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);
Copy link

Copilot AI Jan 23, 2026

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.

Copilot uses AI. Check for mistakes.
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