fix: resolve get_database_schema resource validation errors #22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The
get_database_schemaresource was failing with query validation errors:::regclasswhich only works for tables/materialized views, not regular viewsobj_descriptionfunction was not in SafeSqlDriver's allowed functions list, causing validation failuresSolution
database_resources.pyto usepg_classdirectly via LEFT JOINs instead of::regclasspg_namespaceandpg_classobj_description,col_description, andshobj_descriptionto SafeSqlDriver allowed functionsChanges
src/postgres_mcp/resources/database_resources.py: Fixed SQL query to handle all table typessrc/postgres_mcp/sql/safe_sql.py: Added description functions to allowed functions listTesting
get_database_schemaresource now works correctly for databases with tables and viewsdatabase://schemaresource