Part of #95.
Add tools for running commands in the Visual Studio integrated terminal.
Proposed tools
| Tool |
Behavior |
terminal_create |
Create a terminal (optional name, profile, working directory) |
terminal_list |
List open terminal instances |
terminal_send |
Send a command to a terminal |
terminal_show |
Bring a terminal into view |
terminal_close |
Close a terminal |
Implementation notes
ITerminalService is a brokered service — moniker Microsoft.VisualStudio.Terminal.TerminalService, obtained via TerminalServiceDescriptors.TerminalServiceDescriptor:
Task<Guid> CreateTerminalAsync(CancellationToken ct, string name, ProfileConfig profile, string workingDirectory);
Task AttachTerminalStreamAsync(Guid terminalGuid, Stream stream, CancellationToken ct);
Task<IEnumerable<Guid>> GetTerminalGuidsAsync(CancellationToken ct);
Task<...> GetProfilesAsync(CancellationToken ct);
Task ShowAsync(Guid terminalGuid, ...);
Task CloseAsync(Guid terminalGuid, ...);
Task CloseAllInstancesAsync(CancellationToken ct);
Task ResizeAsync(Guid terminalGuid, ...);
AttachTerminalStreamAsync gives a bidirectional stream — write commands in, read output back.
Public surface is identical between VS 2022 17.14 and VS 2026 18.0. Microsoft.VisualStudio.Terminal has both a binding redirect and a codeBase entry in devenv.exe.config in both versions, so referencing it from the VS install directory resolves cleanly.
Important limitation
This is a raw PTY stream: ANSI escape sequences, no command boundaries, no exit codes. It is good for "run this and let the user watch it happen in VS" and bad for "run this and tell me whether it succeeded."
Recommendation: treat this as a visibility feature, and add a separate process-execution tool (plain System.Diagnostics.Process) for cases where the agent needs a real exit code and clean stdout/stderr. The original ask in #95 was to run things like OpenCover and read the result — that use case wants the process tool, not this one.
Worth deciding up front whether both ship, or only the process tool. Splitting that out if we go that route.
Part of #95.
Add tools for running commands in the Visual Studio integrated terminal.
Proposed tools
terminal_createterminal_listterminal_sendterminal_showterminal_closeImplementation notes
ITerminalServiceis a brokered service — monikerMicrosoft.VisualStudio.Terminal.TerminalService, obtained viaTerminalServiceDescriptors.TerminalServiceDescriptor:AttachTerminalStreamAsyncgives a bidirectional stream — write commands in, read output back.Public surface is identical between VS 2022 17.14 and VS 2026 18.0.
Microsoft.VisualStudio.Terminalhas both a binding redirect and acodeBaseentry indevenv.exe.configin both versions, so referencing it from the VS install directory resolves cleanly.Important limitation
This is a raw PTY stream: ANSI escape sequences, no command boundaries, no exit codes. It is good for "run this and let the user watch it happen in VS" and bad for "run this and tell me whether it succeeded."
Recommendation: treat this as a visibility feature, and add a separate process-execution tool (plain
System.Diagnostics.Process) for cases where the agent needs a real exit code and clean stdout/stderr. The original ask in #95 was to run things like OpenCover and read the result — that use case wants the process tool, not this one.Worth deciding up front whether both ship, or only the process tool. Splitting that out if we go that route.