Skip to content

Commit cb029bd

Browse files
committed
Add scale to result of MSSQL MCP Server DescribeTable tool
We already have precision, to accurately describe decimal data types we also need scale.
1 parent 5a4ba3f commit cb029bd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

MssqlMcp/dotnet/MssqlMcp/Tools/DescribeTable.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ FROM sys.tables t
3939
WHERE t.name = @TableName and (s.name = @TableSchema or @TableSchema IS NULL) ";
4040

4141
// Query for columns
42-
const string ColumnsQuery = @"SELECT c.name, ty.name AS type, c.max_length AS length, c.precision, c.is_nullable AS nullable, p.value AS description
42+
const string ColumnsQuery = @"SELECT c.name, ty.name AS type, c.max_length AS length, c.precision, c.scale, c.is_nullable AS nullable, p.value AS description
4343
FROM sys.columns c
4444
INNER JOIN sys.types ty ON c.user_type_id = ty.user_type_id
4545
LEFT JOIN sys.extended_properties p ON p.major_id = c.object_id AND p.minor_id = c.column_id AND p.name = 'MS_Description'
@@ -133,6 +133,7 @@ GROUP BY
133133
type = reader["type"],
134134
length = reader["length"],
135135
precision = reader["precision"],
136+
scale = reader["scale"],
136137
nullable = (bool)reader["nullable"],
137138
description = reader["description"] is DBNull ? null : reader["description"]
138139
});

0 commit comments

Comments
 (0)