Skip to content

Add scale to result of MSSQL MCP Server DescribeTable tool #62

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion MssqlMcp/dotnet/MssqlMcp/Tools/DescribeTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ FROM sys.tables t
WHERE t.name = @TableName and (s.name = @TableSchema or @TableSchema IS NULL) ";

// Query for columns
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
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
FROM sys.columns c
INNER JOIN sys.types ty ON c.user_type_id = ty.user_type_id
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'
Expand Down Expand Up @@ -133,6 +133,7 @@ GROUP BY
type = reader["type"],
length = reader["length"],
precision = reader["precision"],
scale = reader["scale"],
nullable = (bool)reader["nullable"],
description = reader["description"] is DBNull ? null : reader["description"]
});
Expand Down