Skip to content

Provide Language Model Tools for LLM/VS Code Agent to Manage .NET#2557

Open
nagilson wants to merge 31 commits intodotnet:mainfrom
nagilson:nagilson-mcp-for-installing
Open

Provide Language Model Tools for LLM/VS Code Agent to Manage .NET#2557
nagilson wants to merge 31 commits intodotnet:mainfrom
nagilson:nagilson-mcp-for-installing

Conversation

@nagilson
Copy link
Member

@nagilson nagilson commented Feb 6, 2026

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 - 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 languageModelTools contribution point.
See https://code.visualstudio.com/api/extension-guides/ai/tools

Tested

  • I made sure that running vscode unelevated didn't confuse the llm when the tools require an admin prompt dialog box to continue.
  • I tested failure modes to see if the AI agent can properly recover using our errors (obviously hard to do for every error, which I did not)
  • I tested unsupported scenarios to make sure we don't make the llm worse for unsupported scenarios and instead guide it in the right direction
  • Before and after versions - before it would run several commands to check the machine state and require user permission, when the data was already available via our extension without requiring permission. The agent also preferred winget in the past even for admin installs of the SDK but it now prefers admin installed SDKs and local runtimes as that is what the extension supports. This is intentional.
  • Trying to manage out of support versions / global.json pinned versions - it took tweaking for the llm to not be annoying/reject requests/use latest instead.

Example:

Before:
image

  • 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:
image
image

  • 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

For unsupported scenarios, tooling is now aware of MS Learn and uses proper commands per distro / WSL instead of install script:
image

The unsupported text isn't great, it's finnicky to get it to stop saying that vs get confused and think that it shouldnt try to install .NET at all, vs it trying to run the tool in vscode when it doesn't work.

…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
@nagilson nagilson requested a review from a team February 13, 2026 20:47
nagilson added a commit to nagilson/vscode-dotnet-runtime that referenced this pull request Feb 23, 2026
We need to migrate to the new Linux image in CI so we can run tests on Linux again.
dotnet#2557
This PR initially had the changes but it should really be an isolated fix - was intending to put it there to improve PR merge velocity
@nagilson nagilson mentioned this pull request Feb 23, 2026
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.

2 participants