Skip to content

[MCP] Newly added tools not included in subsequent completion calls #261611

Closed

Description

@lukasz-zoglowek

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version:
    1.104.0 (Insider)
  • OS Version:
    Windows 11

Steps to Reproduce:

  1. Create an MCP server that can update its tools dynamically.
    For example, the server starts with 3 tools: "greet", "calculate", and "get-status".
    After calling any of these tools, a new tool is added — for example, "followup".
  2. Add the MCP server to your workspace.
  3. Run this prompt:
Greet Lukasz and then do a follow-up
  1. Check the debug logs.
    On the second completion call, you’ll see that only the original 3 tools are included, even though all 4 tools were discovered.
Image

Note: The timing in the output window is UTC+2h

Activity

  1. changed the title [-][MCP] Tools list is not updated on the next completion call[/-] [+][MCP] Newly added tools not included in subsequent completion calls[/+] on Aug 14, 2025
  2. connor4312 commented on Aug 14, 2025

    @connor4312
    Member

    Please share some repro code, thanks

  3. lukasz-zoglowek commented on Aug 22, 2025

    @lukasz-zoglowek
    Author

    Connor Peet (@connor4312) did you have a chance to repro the issue?

  4. connor4312 commented on Aug 22, 2025

    @connor4312
    Member

    My guess is this is just a race condition on your device since this scenario works in other cases. We need to make sure that the tool list change notification is received and processed, and that new tools are retrieved, before the next agent turn happens.

  5. lukasz-zoglowek commented on Sep 11, 2025

    @lukasz-zoglowek
    Author

    Connor Peet (@connor4312) This might be a race condition, but I'm able to reproduce it consistently. Would you have some time to investigate this further?

  6. connor4312 commented on Sep 23, 2025

    @connor4312
    Member

    I'm going to add logic such that if the tool list changed notification is received before the response to the tool call, we'll wait for the tools to refresh before proceeding.

  7. added
    bugIssue identified by VS Code Team member as probable bug
    and removed
    info-neededIssue requires more information from poster
    on Sep 23, 2025
  8. TylerLeonhardt commented on Sep 23, 2025

    @TylerLeonhardt
    Member

    I can probably validate this using our playwright vscode MCP server when a change comes around since I saw it there as well

  9. connor4312 commented on Sep 23, 2025

    @connor4312
    Member

    Note that this is going to be inherently hit-and-miss (and often miss) with HTTP MCP servers that deliver out-of-bounds notifications, like the example server, because the notification for the tool list changed is sent on the separate streamable HTTP endpoint from the one the tool call request is sent to. There is nothing we can do about this aside from adding some arbitrary delay to tool calls in hopes that we might get a changed notifications. I'm not going to implement that and would instead suggest (for now) that servers that need this case add some short delay if they have a tool call that is expected to enable additional tools, or deliver it as part of a response stream from the tool call.

  10. added
    unreleasedPatch has not yet been released in VS Code Insiders
    insiders-releasedPatch has been released in VS Code Insiders
    and removed
    unreleasedPatch has not yet been released in VS Code Insiders
    on Sep 23, 2025
  11. TylerLeonhardt commented on Oct 1, 2025

    @TylerLeonhardt
    Member

    the important detail here is sending the "tools changed" event to the client before the completion of the tool that triggered it. Doing so seems to work.

  12. locked and limited conversation to collaborators on Nov 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugIssue identified by VS Code Team member as probable buginsiders-releasedPatch has been released in VS Code InsidersverifiedVerification succeeded

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions