Skip to content

Tools should be conditionally available based on connection state and LSP server capabilities #94

@linw1995

Description

@linw1995

Problem

Currently, all MCP tools are available immediately upon server initialization, regardless of:

  • Whether a Neovim connection is established
  • Whether the connected LSP server supports required capabilities

This causes:

  • Unnecessary token usage when tools requiring connections are called prematurely
  • Failed operations when LSP tools are invoked on servers lacking required capabilities

Solution

Implement dynamic tool availability using MCP's tool list change notifications:

  1. Connection-aware tools: Only make tools requiring connections available after a successful Neovim connection is established
  2. LSP capability validation: Only make LSP tools available after verifying the connected LSP server supports the required capabilities
  3. Dynamic updates: Use MCP's tool list change notifications to update available tools as connection state and capabilities change

Implementation approach

  • Track connection state and LSP server capabilities
  • Filter tool availability based on current state
  • Send notifications when availability changes
  • Update tool descriptors to include connection/capability requirements

This would eliminate wasted tokens and provide better user experience by only showing tools that can actually succeed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions