Skip to content

feat(tools): add visual studio terminal tools #103

Description

@CalvinAllen

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions