Provide Language Model Tools for LLM/VS Code Agent to Manage .NET#2557
Provide Language Model Tools for LLM/VS Code Agent to Manage .NET#2557nagilson wants to merge 51 commits intodotnet:mainfrom
Language Model Tools for LLM/VS Code Agent to Manage .NET#2557Conversation
…nstall # Add Language Model Tools for AI Agent Integration ## Summary This PR adds Language Model Tools (`languageModelTools`) support to the .NET Install Tool extension, enabling AI agents like GitHub Copilot to help users manage .NET installations through natural language interactions. This is an improvement upon dotnet#2375 - at the time of that PR, agents couldn't directly invoke vscode contributing commands, so this approach used an MCP server and a subprocess that could communicate with the MCP server. Now there's a more robust way of doing this. ## Changes ### New Features #### Language Model Tools (6 tools) Added support for VS Code's `languageModelTools` contribution point with the following tools: | Tool | Purpose | |------|---------| | `installDotNetSdk` | Install .NET SDK system-wide (MSI on Windows, PKG on macOS, apt/yum on Linux) | | `listDotNetVersions` | List available .NET SDK/Runtime versions from Microsoft with support phase info | | `listInstalledDotNetVersions` | Query installed SDKs/Runtimes for a given dotnet executable | | `findDotNetPath` | Find existing .NET installations that meet version/architecture requirements | | `uninstallDotNet` | Uninstall .NET SDK or Runtime versions | | `getDotNetSettingsInfo` | Comprehensive guide about settings, installation types, and troubleshooting | Each tool includes: - Detailed `modelDescription` with OS-specific guidance (MSI/PKG/apt/yum installers) - User-friendly `userDescription` - JSON schema for parameters - Comprehensive error handling with troubleshooting tips #### Comprehensive AI Agent Documentation The `getDotNetSettingsInfo` tool returns a detailed guide covering: - Difference between LOCAL (extension-managed) vs GLOBAL (system-wide) installs - `existingDotnetPath` setting explanation (commonly misunderstood) - SDK vs Runtime versioning relationship - `global.json` file handling - Common user scenarios and troubleshooting - "Uninstall trick" for registering global SDKs not in the extension's list
its hard to verify since it involves installing / uninstalling from the system state and requires user interaction. This may be overkill and im open to removing some of this.
This allows the extension to run properly on the new version of code + node js + ts that supports llm features
… llm worse for these
The plugin import is very old and was used during tslint to eslint migration so we don't need that
…nto nagilson-mcp-for-installing
the new CI image doesn't have dotnet preinstalled this made which dotnet fail so it didn't try to read the symlink causing the test to fail
why don't we want it to do that by default: 1. it wont show up in the terminal 2. users might have to configure the path or the results will be less consistent 3. this way it will always use the officially supported method to install .net (install scripts are not rly recommended) without the text it just ignores the guidance we give it.
|
@nagilson This is a very large pull request. To help reviewers, consider adding a list of agent tools this PR adds, along with their inputs and outputs (in a comment or in the PR body). That would make it easier to review the design of the tools. |
Thanks, @lbussell - the |
I see, these outline the dependencies that each distro needs? That's quite cool. I would love to link https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu-install?tabs=dotnet10&pivots=os-linux-ubuntu-2504#dependencies-1 the dependencies section in all the docs here, and the LLM would hopefully easily consume that info. |
|
I'm going to write a skill to consume that information. as well. I haven't figured out how to do that yet. I'll tell you when that happens. I have a skill to produce the infrormation. |
|
The overall workflow looks good and I'm curious to see it in action. I've haven't experienced |
webreidi
left a comment
There was a problem hiding this comment.
Looks great! Works great!
That's a great point. I looked at the experience again. The sudo experience right now: I'm hesitant to add a doc since this will likely evolve as VS Code improves their terminal built in tooling for sudo commands, and it's not something we own per se, it's somewhat up to the agent definition and vscode. This only happens when we can't run the commands for the user because the distro is unknown / wsl, but I'm glad to see the experience is working here. |
|
I wasn't asking you to write a doc. This is a trust boundary issue. At the very least, it makes sense to point to a doc that the VSC team maintains. Either way, we should get a review from @blowdart. This is a new experience. |
|
Try using it with any repo that needs multiple runtimes and it'll fail if you try to run or run tests from a runtime that doesn't match the sdk. global sdks can't / won't find "local" runtimes. It's not a pattern that works. |
Add Language Model Tools for AI Agent Integration in VS Code
Summary
This PR adds Language Model Tools (
languageModelTools) support to the .NET Install Tool extension, enabling AI agents like GitHub Copilot to help users manage .NET installations through natural language interactions.This is an improvement upon #2375 (inspired by a convo with Rich) - at the time of that PR, agents couldn't directly invoke vscode contributing commands, so this approach used an MCP server and a subprocess that could communicate with the MCP server. Now there's a more robust way of doing this.
I also messed around with the agent window and setting up repos myself before adding this. The agent seemed to get very confused on what the existingPath setting did amongst other things, and it didn't understand how the dotnet hive / muxer worked and what installs were available where, and how they were used. I was somewhat inspired by a 'dogfooding' effort we did to try to use our own tooling. I've improved its knowledge of .NET now.
Changes
New Features
Language Model Tools (6 tools)
Added support for VS Code's
languageModelToolscontribution point.See https://code.visualstudio.com/api/extension-guides/ai/tools
Most Important Files
vscode-dotnet-runtime-extension/package.json <-- (defines tools)
vscode-dotnet-runtime-extension/src/LanguageModelTools.ts <-- implements tools
vscode-dotnet-runtime-extension/src/SettingsInfoContent.ts
Tools added:
install_dotnet_sdklist_available_dotnet_versions_to_installfind_dotnet_executable_pathuninstall_dotnetget_settings_info_for_dotnet_installation_managementlist_installed_dotnet_versionsTested
Example:
📦 It can install SDK / Find Installs
Before:
https://github.com/user-attachments/assets/5f45102a-77da-40a4-ba04-0229ace06748%20%20
Agent has to wait for 2 separate commands + approval to run from the user (tedious and disrupts workflow) to get info it already has
Now:
https://github.com/user-attachments/assets/781b2318-2515-4bad-b1e5-84b0cdce0ba7%20
https://github.com/user-attachments/assets/cb6c7fb8-b1f6-43ff-870b-1cae71441258
The agent is more consistently aware (from my anecdotal testing) of what installs the user might need and informs the user. This happened sometimes for me prior but not always, as shown in the ss above.
🐧 Linux PPA
Before the LLM always used install scripts with claude opus 4.5, 4.6, chat codex 5. Sometimes this hit pathing issues.

Now it correctly follows our guidance, and tries to run the commands to either set up backport PPA or use the official feeds:
🗺️ Global.Json Paths Feature
If the user tries to use their own custom SDK it helps point them to the new 'paths' feature in global.json.
This text shows the LLM is able to receive the errors we return and move forward/provide guidance.

--
These can be disabled in the extension settings of the .NET Install Tool:

Guidance
I followed the best practices as outlined by Anthropic to write these tools.
https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices
https://resources.anthropic.com/hubfs/The-Complete-Guide-to-Building-Skill-for-Claude.pdf
https://code.claude.com/docs/en/memory#write-effective-instructions