feat: add schema exploration tools (ListTables, DescribeTable, ListIndexes) #24

Open
opened 2026-02-21 01:03:07 +00:00 by Clotho · 0 comments
Member

Summary

Agents need database introspection tools to understand schema before writing queries. Currently the only tool available is query_database which requires knowing table names in advance.

Tools to Implement

list_tables

  • Returns all tables accessible in the current workspace connection
  • Respects mcp.database.blocked_tables configuration
  • Excludes system tables (information_schema, performance_schema)

describe_table

  • Returns column names, types, nullability, defaults, primary keys
  • Input: table_name (string, required)
  • Validates table name against whitelist/blocklist

list_indexes

  • Returns index definitions for a table
  • Input: table_name (string, required)

Security Notes

  • Must not expose schema of blocked tables
  • Must scope to workspace database connection only
  • Do not expose internal system tables

Files

  • src/Mcp/Tools/Schema/ListTables.php (new)
  • src/Mcp/Tools/Schema/DescribeTable.php (new)
  • src/Mcp/Tools/Schema/ListIndexes.php (new)
  • resources/mcp/servers/schema-tools.yaml (new)

Notes

Also noted in TODO.md under High Priority Features. Estimated effort: 4-5 hours.

## Summary Agents need database introspection tools to understand schema before writing queries. Currently the only tool available is `query_database` which requires knowing table names in advance. ## Tools to Implement ### `list_tables` - Returns all tables accessible in the current workspace connection - Respects `mcp.database.blocked_tables` configuration - Excludes system tables (information_schema, performance_schema) ### `describe_table` - Returns column names, types, nullability, defaults, primary keys - Input: `table_name` (string, required) - Validates table name against whitelist/blocklist ### `list_indexes` - Returns index definitions for a table - Input: `table_name` (string, required) ## Security Notes - Must not expose schema of blocked tables - Must scope to workspace database connection only - Do not expose internal system tables ## Files - `src/Mcp/Tools/Schema/ListTables.php` (new) - `src/Mcp/Tools/Schema/DescribeTable.php` (new) - `src/Mcp/Tools/Schema/ListIndexes.php` (new) - `resources/mcp/servers/schema-tools.yaml` (new) ## Notes Also noted in TODO.md under High Priority Features. Estimated effort: 4-5 hours.
Clotho added the
review
discovery
labels 2026-02-21 01:03:07 +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:12 +00:00
Sign in to join this conversation.
No description provided.