Skip to content

VS Code MCP client stale tool registry after server restart #259

@sbroenne

Description

@sbroenne

Problem Description

After multiple MCP server restarts during a long conversation, some tools become unavailable while others continue to work.

Symptoms

  • excel_range and excel_table return: "Tool disabled by user or not available"
  • excel_file continues to work in the same session
  • Session is confirmed active (excel_file Open and Test actions succeed)
  • Error originates from VS Code's tool framework, not from the MCP server

Observations

  1. The MCP server is running and responding correctly
  2. Active session confirmed with open workbook
  3. The "disabled" error comes from VS Code's internal tool framework, not the MCP server
  4. This occurred after multiple MCP server restarts during a long conversation
  5. Reloading VS Code window or starting a new chat session resolves the issue

Root Cause Analysis

This appears to be a VS Code MCP client issue where the tool registry becomes stale after server restarts:

  1. Partial tool re-registration: Some tools (excel_file) remain registered while others (excel_range, excel_table) are marked disabled
  2. Cached tool state not refreshing: VS Code's internal cache doesn't update properly on reconnect
  3. Race condition: Possible timing issue during server restart handshake

Investigation Points

VS Code MCP Client Side:

  • Tool registration is handled by VS Code's vscode.lm.registerMcpServerDefinitionProvider
  • When server restarts, VS Code should re-enumerate all tools via tools/list MCP method
  • Some tools may be getting dropped during this re-enumeration

MCP Server Side:

  • All 12 tools are registered via [McpServerToolType] attributes
  • Tool discovery uses .WithToolsFromAssembly() which reflects over the assembly
  • Server announces all tools atomically at startup

Workaround

For Users:

  1. Reload VS Code window: Ctrl+Shift+P then "Developer: Reload Window"
  2. Or start a new chat session

Possible Mitigations

  1. Extension-side health check: Periodically verify all tools are available
  2. Reconnect handler: Force tool re-registration when server connection is restored
  3. User notification: Detect partial tool availability and prompt for reload

Environment

  • VS Code with GitHub Copilot Chat
  • ExcelMCP VS Code extension
  • Windows (required for Excel COM)

Notes

This may require coordination with VS Code team if the issue is in the MCP client implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions