Repository navigation
feat(mcp): views in list_tables, describe_table and sample_rows (#1133) - #1268
Merged
Merged
Conversation
…1133) The MCP catalog read only base tables, so a model could not see a view the user's database is organised around. list_tables now also returns views (PostgreSQL materialized views included) with kind: view; describe_table gives their columns (no keys, no indexes) and sample_rows reads them. A name that is already a table stays a table. The views come from one extra catalog query per call (ErdCatalog.viewColumnsSql), read on the same read-only MCP session.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
First slice of MCP v2 (#1133): the docs said "views are not listed yet". A model could not see a view that an application's reads go through.
list_tablesreturns views next to tables, marked"kind": "view"(PostgreSQL materialized views included); tables keep their exact shape.describe_tableof a view returns its columns, with no primary key and no index query.sample_rowsreads a view through its validated, quoted name, like a table: the name must come from the catalog, so model input never reaches SQL unchecked.ErdCatalog.viewColumnsSql, on the same read-only MCP session. A name that is already a table stays a table.docs/mcp-server.mdand the tool description say so.Tests (
mcp_query_service_test): views listed withkind, a view that is also a table stays a table,describe_tableof a view runs no index query,sample_rowsquotes the view.Test plan
mcp_security_testand the SQLite read-only test on a real database (no local runs, per team rule)