Skip to content

feat(mcp): generative-UI MVP demo tools#25

Open
razeone wants to merge 1 commit into
mainfrom
feat/mvp-mcp-tools
Open

feat(mcp): generative-UI MVP demo tools#25
razeone wants to merge 1 commit into
mainfrom
feat/mvp-mcp-tools

Conversation

@razeone
Copy link
Copy Markdown
Owner

@razeone razeone commented Apr 28, 2026

Adds 7 read-only SQL Server MCP tools that feed the generative-UI demo flows (Performance Tuning, Health Audit, Schema Discovery).

Tools added

Performance

  • top_queries — top-N by total worker time from sys.dm_exec_query_stats (capped 50)
  • missing_indexessys.dm_db_missing_index_* ordered by improvement_measure (top 50)
  • wait_statssys.dm_os_wait_stats with idle/system noise filtered (capped 50)
  • blocking_sessions — blocked sessions from sys.dm_exec_requests with blocker/blocked logins

Discovery

  • fk_graph — full FK graph (one row per FK column)
  • column_statssys.stats + sys.dm_db_stats_properties for a given table

Health

  • db_health_checks — 10 curated checks (auto_close, auto_shrink, recovery model, page verify, compat level, query store, last full/log backups, unused indexes, DBCC CHECKDB recency)

Safety

  • All values bound via SqlParameter — never concatenated.
  • Identifier args (column_stats) pass the existing SqlIdentifier allow-list AND an INFORMATION_SCHEMA existence check before being bracket-quoted.
  • SqlException details are logged in full but only Number + first-line message reach the client.
  • Per-check try/catch in db_health_checks so msdb / DBCC permission errors degrade to Info: skipped instead of failing the whole tool.
  • All tools strictly read-only (SELECT / DMV reads).

Verification

  • dotnet build src/CloudEngAgent.Mcp.Server
  • dotnet test tests/CloudEngAgent.Mcp.Server.Tests — 51/51 passed ✅
  • dotnet build CloudEngAgent.slnx

New tests cover identifier validation on column_stats, top-bounds on top_queries / wait_stats, and assembly-level discovery of all 7 tool names.

Adds top_queries, missing_indexes, wait_stats, blocking_sessions,
fk_graph, column_stats, db_health_checks. All tools are SELECT-only
with the existing identifier allow-list + SqlParameter discipline.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant