test: add integration tests for QueryDatabase tool #15

Open
opened 2026-02-21 00:59:35 +00:00 by Clotho · 0 comments
Member

Summary

The QueryDatabase tool (src/Mcp/Tools/QueryDatabase.php, 417 lines) lacks integration tests despite being the most critical tool in the package.

What needs testing

  • Full SELECT query execution flow
  • EXPLAIN plan analysis output
  • Connection validation before query
  • Result formatting (columns, rows, metadata)
  • Workspace context enforcement
  • Tier-based row limit truncation
  • Query timeout handling
  • Audit log entry creation on success/failure
  • Blocked query response format
  • Error handling for invalid SQL
  • Schema exploration queries

Notes

Also noted in TODO.md under Medium Priority. Estimated effort: 3-4 hours.

Files

  • src/Mcp/Tools/QueryDatabase.php
  • src/Mcp/Tests/Unit/QueryDatabaseToolTest.php (to be created)
## Summary The `QueryDatabase` tool (src/Mcp/Tools/QueryDatabase.php, 417 lines) lacks integration tests despite being the most critical tool in the package. ## What needs testing - Full SELECT query execution flow - EXPLAIN plan analysis output - Connection validation before query - Result formatting (columns, rows, metadata) - Workspace context enforcement - Tier-based row limit truncation - Query timeout handling - Audit log entry creation on success/failure - Blocked query response format - Error handling for invalid SQL - Schema exploration queries ## Notes Also noted in TODO.md under Medium Priority. Estimated effort: 3-4 hours. ## Files - `src/Mcp/Tools/QueryDatabase.php` - `src/Mcp/Tests/Unit/QueryDatabaseToolTest.php` (to be created)
Clotho added the
testing
discovery
labels 2026-02-21 00:59:35 +00:00
Snider added the
clotho
label 2026-02-21 01:23:16 +00:00
Charon added the
agent-ready
label 2026-02-21 01:30:16 +00:00
Sign in to join this conversation.
No description provided.