Skip to content

Commit dddb664

Browse files
authored
Merge pull request #34760 from croblesm/crobles-0721-agent-update
MSSQL extension in VS Code - v1.34 release [publish on 2025-07-23 AM]
2 parents 68fe646 + d64049d commit dddb664

File tree

4 files changed

+76
-20
lines changed

4 files changed

+76
-20
lines changed

docs/tools/visual-studio-code-extensions/github-copilot/agent-mode.md

Lines changed: 76 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Learn how to use GitHub Copilot Agent Mode with the MSSQL extension
44
author: croblesm
55
ms.author: roblescarlos
66
ms.reviewer: randolphwest
7-
ms.date: 06/18/2025
7+
ms.date: 07/23/2025
88
ms.service: sql
99
ms.subservice: vs-code-sql-extensions
1010
ms.topic: quickstart
@@ -18,7 +18,7 @@ ai-usage: ai-assisted
1818

1919
# Quickstart: Use GitHub Copilot Agent Mode (Preview)
2020

21-
GitHub Copilot Agent Mode brings a contextual, action-driven chat experience into the MSSQL extension for Visual Studio Code. With Agent Mode, GitHub Copilot can go beyond suggesting code—it can securely execute real database tasks using natural language prompts or built-in tools. You can list all your connections, connect to specific server/databases and explore schemas without leaving your editor.
21+
GitHub Copilot Agent Mode brings a contextual, action-driven chat experience into the MSSQL extension for Visual Studio Code. With Agent Mode, GitHub Copilot can go beyond suggesting code—it can securely execute real database tasks using natural language prompts or built-in tools. You can list all your connections, connect to specific server/databases, and explore schemas without leaving your editor.
2222

2323
> [!TIP]
2424
> You don't need to mention a participant like `@mssql` to use SQL tools in Agent Mode. Once the MSSQL extension is active, its tools are automatically available in the Agent Mode interface. For more information, see [Agent Mode Tools](https://code.visualstudio.com/docs/copilot/chat/chat-agent-mode#_agent-mode-tools).
@@ -27,57 +27,81 @@ These actions are powered by tools contributed by the MSSQL extension and surfac
2727

2828
## What is Agent Mode?
2929

30-
Agent Mode enables GitHub Copilot to go beyond suggesting code. It can now perform secure, confirmed actions inside your SQL development environment, using either chat variables like `#mssql_connect` or natural phrases like "*Connect to my Library database using my LocalDev profile.*"
30+
Agent Mode enables GitHub Copilot to go beyond suggesting code. It can now perform secure, confirmed actions inside your SQL development environment, using either chat variables like `#mssql_connect`, or natural phrases like:
31+
32+
```copilot-prompt
33+
Connect to my Library database using my LocalDev profile
34+
```
3135

3236
:::image type="content" source="media/agent-mode/agent-tool-chat.png" alt-text="Screenshot of GitHub Copilot Agent Mode chat interface." lightbox="media/agent-mode/agent-tool-chat.png":::
3337

3438
## MSSQL Agent Mode tool reference
3539

3640
This section provides a detailed reference for the SQL-specific tools available in GitHub Copilot Agent Mode. The MSSQL extension contributes these tools, enabling GitHub Copilot to execute actions through chat variables or natural language prompts. All tools require user confirmation before execution.
3741

38-
:::image type="content" source="media/agent-mode/agent-tools.png" alt-text="Screenshot of list of SQL-specific tools contributed by the MSSQL extension in Copilot Agent Mode." lightbox="media/agent-mode/agent-tools.png":::
42+
:::image type="content" source="media/agent-mode/agent-tools.png" alt-text="Screenshot of list of SQL-specific tools contributed by the MSSQL extension in Copilot Agent Mode.":::
3943

4044
> [!TIP]
41-
> You can also use chat variables like `#mssql_connect` to invoke these tools directly, or write prompts in natural language such as "Connect to my development database." GitHub Copilot handles tool selection automatically.
45+
> You can also use chat variables like `#mssql_connect` to invoke these tools directly, or write prompts in natural language such as:
46+
>
47+
> ```copilot-prompt
48+
> Connect to my development database
49+
> ```
50+
51+
GitHub Copilot handles tool selection automatically.
4252
4353
### Connection management
4454
4555
| Tool name | Description |
4656
| --- | --- |
47-
| connect_server | Establishes a database connection using a saved connection profile or a specified server/database pair. |
48-
| disconnect_server | Terminates the current active connection session. |
49-
| list_servers | Lists all saved SQL Server connection profiles in your environment. |
57+
| `connect` | Establishes a database connection using a saved connection profile or a specified server/database pair. |
58+
| `disconnect` | Terminates the current active connection session. |
59+
| `change_database` | Changes the database for an existing connection session. |
60+
| `get_connection_details` | Gets connection details for a specific MSSQL connection. |
61+
| `list_servers` | Lists all saved SQL Server connection profiles in your environment. |
62+
| `list_databases` | Lists all available databases for a connected MSSQL server. |
5063
5164
#### Examples
5265
66+
The following phrases can be used to interact with GitHub Copilot.
67+
68+
```copilot-prompt
5369
- Connect to my LocalDev environment
5470
- Disconnect from my current database
5571
- List my available connection profiles
72+
- List all databases in the localhost server
73+
- Set the active connection to localhost
74+
- Set AdventureWorks as the active database
75+
- Get the connection string for AdventureWorks on localhost
76+
```
5677
5778
:::image type="content" source="media/agent-mode/agent-tool-connect.png" alt-text="Screenshot of example using an agent tool to connect to a database in the GitHub Copilot chat." lightbox="media/agent-mode/agent-tool-connect.png":::
5879

5980
#### How connection logic works
6081

6182
GitHub Copilot Agent Mode supports flexible ways to connect to your SQL database, either by referencing saved profiles or by specifying a server and database directly. Here's how the connection logic works:
6283

63-
##### Connect via saved profile
84+
When you connect via saved profile:
6485

65-
- A user can connect by referencing the name of a saved connection profile.
66-
- GitHub Copilot uses the `mssql_list_servers` tool to verify the profile exists.
67-
- The `mssql_connect` tool then uses the saved `profileId` and its parameters to establish the connection.
86+
1. A user can connect by referencing the name of a saved connection profile.
87+
1. GitHub Copilot uses the `mssql_list_servers` tool to verify the profile exists.
88+
1. The `mssql_connect` tool then uses the saved `profileId` and its parameters to establish the connection.
6889

69-
##### Connect via server/database specification
90+
When you connect via server/database specification:
7091

7192
- If a saved profile matches both the specified server and database:
72-
- GitHub Copilot uses `mssql_list_servers` to find the match.
73-
- It then calls `mssql_connect` using the full profile.
93+
94+
1. GitHub Copilot uses `mssql_list_servers` to find the match.
95+
1. It then calls `mssql_connect` using the full profile.
7496

7597
- If a saved profile matches only the server:
76-
- GitHub Copilot finds the matching server profile.
77-
- It attempts to connect by substituting the user-requested database into that profile.
78-
- If the connection fails, an error is shown.
98+
99+
1. GitHub Copilot finds the matching server profile.
100+
1. It attempts to connect by substituting the user-requested database into that profile.
101+
1. If the connection fails, an error is shown.
79102

80103
- If no profile matches the specified server:
104+
81105
- GitHub Copilot reports an error.
82106

83107
This flexible matching system allows GitHub Copilot to handle a range of connection scenarios, minimizing user effort while ensuring secure, confirmable actions.
@@ -86,14 +110,46 @@ This flexible matching system allows GitHub Copilot to handle a range of connect
86110

87111
| Tool name | Description |
88112
| --- | --- |
89-
| show_schema | Displays a high-level diagram of your connected database schema, including tables and relationships. |
113+
| `show_schema` | Displays a high-level diagram of your connected database schema, including tables and relationships. |
114+
| `list_schemas` | Lists all schemas in a database for a connected MSSQL server. |
115+
| `list_tables` | Lists all tables in a database for a connected MSSQL server. |
116+
| `list_views` | Lists all views in a database for a connected MSSQL server. |
117+
| `list_functions` | Lists all functions in a database for a connected MSSQL server. |
90118

91119
#### Examples
92120

121+
The following phrases can be used to interact with GitHub Copilot.
122+
123+
```copilot-prompt
93124
- Show me the schema for this database
125+
- Show me all tables in the current database
126+
- List all views from this MSSQL database
127+
- Give me a list of all the functions available in this schema
128+
- What schemas are available in this database?
129+
```
94130

95131
:::image type="content" source="media/agent-mode/agent-tool-schema.gif" alt-text="Screenshot of animation showing the database schema visualizer tool in Copilot Agent Mode." lightbox="media/agent-mode/agent-tool-schema.gif":::
96132

133+
### Query execution
134+
135+
| Tool name | Description |
136+
| --- | --- |
137+
| `run_query` | Executes a SQL query against the connected database. |
138+
139+
#### Examples
140+
141+
The following phrases can be used to interact with GitHub Copilot.
142+
143+
```copilot-prompt
144+
- Give me the top five posts published this week
145+
- Execute the current file to find how many comments each post has
146+
- Get all categories along with the number of posts in each
147+
```
148+
149+
:::image type="content" source="media/agent-mode/agent-tool-run-query-1.png" alt-text="Screenshot of example using an agent tool to connect to a database and retrieve data." lightbox="media/agent-mode/agent-tool-run-query-1.png":::
150+
151+
:::image type="content" source="media/agent-mode/agent-tool-run-query-2.png" alt-text="Screenshot of another example using an agent tool to connect to a database and retrieve data." lightbox="media/agent-mode/agent-tool-run-query-2.png":::
152+
97153
## How tools are managed in Agent Mode
98154

99155
GitHub Copilot can invoke MSSQL-specific tools and other extension-contributed tools while processing your request. These tools are visible in the Agent Mode interface under the Tools menu, where you can enable or disable specific tools.
@@ -113,7 +169,7 @@ When GitHub Copilot selects a tool, it prompts you with a confirmation dialog sh
113169
This confirmation step helps ensure secure, intentional interactions with your development environment.
114170

115171
> [!NOTE]
116-
> For more information on how confirmation works across all tools in Agent Mode, see the [official VS Code documentation on tool approvals](https://code.visualstudio.com/docs/copilot/chat/chat-agent-mode#_manage-tool-approvals).
172+
> For more information on how confirmation works across all tools in Agent Mode, see the [Visual Studio Code documentation on tool approvals](https://code.visualstudio.com/docs/copilot/chat/chat-agent-mode#_manage-tool-approvals).
117173
118174
## Related content
119175

26.3 KB
Loading
34.2 KB
Loading
4.15 KB
Loading

0 commit comments

Comments
 (0)