Skip to content

[#12371] feat(mcp-server): write tools for views - #12372

Draft
bharos wants to merge 1 commit into
apache:mainfrom
bharos:mcp-view-write-tools
Draft

[#12371] feat(mcp-server): write tools for views#12372
bharos wants to merge 1 commit into
apache:mainfrom
bharos:mcp-view-write-tools

Conversation

@bharos

@bharos bharos commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Add create_view, alter_view and drop_view MCP tools, following the existing
pattern: ViewOperation interface -> PlainRESTClientViewOperation -> FastMCP
tools in tools/view.py, plus mock and unit tests. They call the existing
ViewOperations REST endpoints, so no server-side change is needed. The tool
table in docs/gravitino-mcp-server.md is updated.

Why are the changes needed?

View is the only schema-level entity in the MCP server with read tools but no
write tools: catalog, schema, table and fileset have create/alter/drop, and
topic, model and tag have their equivalents. #12129 added list_of_views and
load_view and left the write side as a follow-up.

Fix: #12371

Does this PR introduce any user-facing change?

Yes, three new MCP tools. They carry the existing view tag, so
--include-tool-tags view picks them up. No new configuration.

How was this patch tested?

Unit tests: 3 tool tests plus 3 client tests covering URL encoding of the view
name, omission of unset default_catalog/default_schema, and the dropped
response key. Full suite is 173 tests; isort, black and pylint (10.00/10) clean.

End to end against a local Gravitino with a lakehouse-iceberg catalog (JDBC
backend), driving the MCP server over streamable-http with a real client:
create (both with and without the optional defaults) -> list_of_views ->
alter_view with setProperty and rename -> load_view -> drop_view.
drop_view returns true for an existing view and false for a missing one,
and a create with empty representations surfaces the server's validation
error as a tool error. Full results are recorded in
#12371 (comment)

@bharos
bharos marked this pull request as draft August 5, 2026 06:22
Add create_view, alter_view and drop_view tools backed by the existing
ViewOperations REST endpoints, so view has the same write coverage as the
other schema-level entities.
@bharos
bharos force-pushed the mcp-view-write-tools branch from f14996b to 1275ad9 Compare August 5, 2026 06:58
@bharos
bharos marked this pull request as ready for review August 5, 2026 07:04
@bharos
bharos requested a review from yuqi1129 August 5, 2026 07:05
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Code Coverage Report

Overall Project 68.17% 🟢
Files changed No Java source files changed -

Module Coverage
aliyun 1.72% 🔴
api 49.34% 🟢
authorization-common 85.96% 🟢
aws 42.04% 🟢
azure 2.47% 🔴
catalog-common 9.92% 🔴
catalog-fileset 79.74% 🟢
catalog-glue 68.95% 🟢
catalog-hive 79.4% 🟢
catalog-jdbc-common 45.7% 🟢
catalog-jdbc-doris 81.8% 🟢
catalog-jdbc-mysql 79.33% 🟢
catalog-jdbc-postgresql 83.39% 🟢
catalog-jdbc-starrocks 79.16% 🟢
catalog-kafka 77.01% 🟢
catalog-lakehouse-generic 59.18% 🟢
catalog-lakehouse-hudi 79.1% 🟢
catalog-lakehouse-iceberg 85.86% 🟢
catalog-lakehouse-paimon 84.23% 🟢
catalog-model 77.72% 🟢
cli 44.48% 🟢
client-java 78.27% 🟢
common 52.13% 🟢
core 83.22% 🟢
filesystem-hadoop3 77.28% 🟢
flink 0.0% 🔴
flink-common 48.68% 🟢
flink-runtime 0.0% 🔴
gcp 14.12% 🔴
hadoop-auth 68.0% 🟢
hadoop-common 12.7% 🔴
hive-metastore-common 53.4% 🟢
iceberg-common 64.75% 🟢
iceberg-rest-server 75.03% 🟢
idp-basic 86.02% 🟢
integration-test-common 0.0% 🔴
jobs 62.92% 🟢
lance-common 24.5% 🔴
lance-rest-server 64.23% 🟢
lineage 53.02% 🟢
optimizer 83.24% 🟢
optimizer-api 21.95% 🔴
server 85.76% 🟢
server-common 76.45% 🟢
spark 28.57% 🔴
spark-common 45.89% 🟢
tencent 69.84% 🟢
trino-connector 40.29% 🟢

@yuqi1129

yuqi1129 commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

@bharos
Hi, bharos, is this feature needed by your business? In principle, we need to be careful with write operations because MCP servers generally do not handle modification operations, so I also blocked a write PR raised long ago

@bharos

bharos commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

@bharos Hi, bharos, is this feature needed by your business? In principle, we need to be careful with write operations because MCP servers generally do not handle modification operations, so I also blocked a write PR raised long ago

Got it, I Thought we were supporting write operations as well. No, I don't have any immediate need. We can wait on this PR until we decide to support write tools

@bharos
bharos marked this pull request as draft August 10, 2026 22:55
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.

[Subtask] feat(mcp-server): write tools for views (create/alter/drop)

2 participants