You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: MssqlMcp/MssqlMcp/Tools/ListTables.cs
+6-1Lines changed: 6 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,12 @@ public partial class Tools
12
12
{
13
13
privateconststringListTablesQuery=@"SELECT TABLE_SCHEMA, TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' ORDER BY TABLE_SCHEMA, TABLE_NAME";
14
14
15
-
[McpServerTool,Description("Lists all tables in the SQL Database.")]
15
+
[McpServerTool(
16
+
Title="List Tables",
17
+
ReadOnly=true,
18
+
Idempotent=true,
19
+
Destructive=false),
20
+
Description("Lists all tables in the SQL Database.")]
@@ -56,7 +60,6 @@ e.g. your MCP settings should look like this if "MSSQL MCP" is your own MCP Serv
56
60
---
57
61
```json
58
62
"mcp": {
59
-
60
63
"servers": {
61
64
"MSSQL MCP": {
62
65
"type": "stdio",
@@ -69,11 +72,10 @@ e.g. your MCP settings should look like this if "MSSQL MCP" is your own MCP Serv
69
72
```
70
73
---
71
74
72
-
And example of using a connection string for Azure SQL Database:
75
+
An example of using a connection string for Azure SQL Database:
73
76
---
74
77
```json
75
78
"mcp": {
76
-
77
79
"servers": {
78
80
"MSSQL MCP": {
79
81
"type": "stdio",
@@ -88,13 +90,13 @@ And example of using a connection string for Azure SQL Database:
88
90
89
91
**Run the MCP Server**
90
92
91
-
Save the Settings file, and then you should see the "Start" button appear in the Settings json. Click "start" to start the MCP Server.
93
+
Save the Settings file, and then you should see the "Start" button appear in the settings.json. Click "Start" to start the MCP Server. (You can then click on "Running" to view the Output window).
92
94
93
95
Start Chat (Ctrl+Shift+I), make sure Agent Mode is selected.
94
96
95
97
Click the tools icon, and ensure the "MSSQL MCP" tools are selected.
96
98
97
-
Then type in the chat window "List tables in DB" and hit enter.
99
+
Then type in the chat window "List tables in the database" and hit enter. (If you have other tools loaded, you may need to specify "MSSQL MCP" in the initial prompt, e.g. "Using MSSQL MCP, list tables").
98
100
99
101
3. Claude Desktop: **Add MCP Server config to Claude Desktop**
100
102
@@ -116,12 +118,13 @@ Add a new MCP Server with the following settings:
116
118
}
117
119
}
118
120
```
121
+
---
119
122
120
-
Save the file, start a new Chat, you'll see the "Tools" icon, it should list 8 MSSQL MCP tools.
123
+
Save the file, start a new Chat, you'll see the "Tools" icon, it should list 7 MSSQL MCP tools.
121
124
122
125
# Troubleshooting
123
126
124
-
1. If you get a connection reset error using "Active Directory Default", try "Active Directory Interactive"
127
+
1. If you get a "Task canceled" error using "Active Directory Default", try "Active Directory Interactive".
0 commit comments