World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
Java ai-catalogdata-catalogdatalakefederated-querylakehousemetadatametalakemodel-catalogopendatacatalogskycomputingstratosphere
[#7949] feat(mcp-server): Support tag operations for MCP server (#7963)
Mini Yu6f3326444642
diff --git a/mcp-server/.gitignore b/mcp-server/.gitignoreindex fbec15eb6e..cc92df8da8 100644--- a/mcp-server/.gitignore+++ b/mcp-server/.gitignore@@ -31,6 +31,7 @@ buildlogs/*.log*.err+gravitino_mcp_server.egg-info# Unit test / coverage reportshtmlcov/diff --git a/mcp-server/mcp_server/client/__init__.py b/mcp-server/mcp_server/client/__init__.pyindex b43254c558..5b9c4dbbcb 100644--- a/mcp-server/mcp_server/client/__init__.py+++ b/mcp-server/mcp_server/client/__init__.py@@ -19,3 +19,4 @@ from mcp_server.client.catalog_operation import CatalogOperationfrom mcp_server.client.gravitino_operation import GravitinoOperationfrom mcp_server.client.schema_operation import SchemaOperationfrom mcp_server.client.table_operation import TableOperation+from mcp_server.client.tag_operation import TagOperationdiff --git a/mcp-server/mcp_server/client/gravitino_operation.py b/mcp-server/mcp_server/client/gravitino_operation.pyindex a8bec9f88d..a0c0ef8944 100644--- a/mcp-server/mcp_server/client/gravitino_operation.py+++ b/mcp-server/mcp_server/client/gravitino_operation.py@@ -20,6 +20,7 @@ from abc import ABC, abstractmethodfrom mcp_server.client.catalog_operation import CatalogOperationfrom mcp_server.client.schema_operation import SchemaOperationfrom mcp_server.client.table_operation import TableOperation+from mcp_server.client.tag_operation import TagOperationclass GravitinoOperation(ABC):@@ -56,3 +57,13 @@ class GravitinoOperation(ABC):CatalogOperation: Interface for performing catalog-level operations"""pass++ @abstractmethod+ def as_tag_operation(self) -> TagOperation:+ """+ Access the tag operation interface of this Gravitino operation.++ Returns:+ TagOperation: Interface for performing tag-level operations+ """+ passdiff --git a/mcp-server/mcp_server/client/plain/plain_rest_client_operation.py b/mcp-server/mcp_server/client/plain/plain_rest_client_operation.pyindex e0e7b7f203..2bdc37b46b 100644--- a/mcp-server/mcp_server/client/plain/plain_rest_client_operation.py+++ b/mcp-server/mcp_server/client/plain/plain_rest_client_operation.py@@ -22,6 +22,7 @@ from mcp_server.client import (GravitinoOperation,SchemaOperation,TableOperation,+ TagOperation,)from mcp_server.client.plain.plain_rest_client_catalog_operation import (PlainRESTClientCatalogOperation,@@ -32,6 +33,9 @@ from mcp_server.client.plain.plain_rest_client_schema_operation import (from mcp_server.client.plain.plain_rest_client_table_operation import (PlainRESTClientTableOperation,)+from mcp_server.client.plain.plain_rest_client_tag_operation import (+ PlainRESTClientTagOperation,+)class PlainRESTClientOperation(GravitinoOperation):@@ -53,3 +57,8 @@ class PlainRESTClientOperation(GravitinoOperation):return PlainRESTClientSchemaOperation(metalake_name=self.metalake_name, rest_client=self.rest_client)++ def as_tag_operation(self) -> TagOperation:+ return PlainRESTClientTagOperation(+ metalake_name=self.metalake_name, rest_client=self.rest_client+ )diff --git a/mcp-server/mcp_server/client/plain/plain_rest_client_tag_operation.py b/mcp-server/mcp_server/client/plain/plain_rest_client_tag_operation.pynew file mode 100644index 0000000000..13493307aa--- /dev/null+++ b/mcp-server/mcp_server/client/plain/plain_rest_client_tag_operation.py@@ -0,0 +1,97 @@+# Licensed to the Apache Software Foundation (ASF) under one+# or more contributor license agreements. See the NOTICE file+# distributed with this work for additional information+# regarding copyright ownership. The ASF licenses this file+# to you under the Apache License, Version 2.0 (the+# "License"); you may not use this file except in compliance+# with the License. You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing,+# software distributed under the License is distributed on an+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+# KIND, either express or implied. See the License for the+# specific language governing permissions and limitations+# under the License.++from mcp_server.client.plain.utils import extract_content_from_response+from mcp_server.client.tag_operation import TagOperation+++class PlainRESTClientTagOperation(TagOperation):+ def __init__(self, metalake_name: str, rest_client):+ self.metalake_name = metalake_name+ self.rest_client = rest_client++ async def get_list_of_tags(self) -> str:+ response = await self.rest_client.get(+ f"/api/metalakes/{self.metalake_name}/tags?details=true"+ )+ return extract_content_from_response(response, "tags", [])++ async def get_tag_by_name(self, tag_name: str) -> str:+ response = await self.rest_client.get(+ f"/api/metalakes/{self.metalake_name}/tags/{tag_name}"+ )+ return extract_content_from_response(response, "tag", {})++ async def create_tag(+ self, tag_name: str, tag_comment: str, tag_properties: dict+ ) -> str:+ response = await self.rest_client.post(+ f"/api/metalakes/{self.metalake_name}/tags",+ json={+ "name": tag_name,+ "comment": tag_comment,+ "properties": tag_properties,+ },+ )+ return extract_content_from_response(response, "tag", {})++ async def alter_tag(self, tag_name: str, updates: list) -> str:+ response = await self.rest_client.put(+ f"/api/metalakes/{self.metalake_name}/tags/{tag_name}",+ json={+ "updates": updates,+ },+ )+ return extract_content_from_response(response, "tag", {})++ async def delete_tag(self, name: str) -> None:+ response = await self.rest_client.delete(+ f"/api/metalakes/{self.metalake_name}/tags/{name}"+ )+ if response.status_code != 200:+ raise Exception(f"Failed to delete tag {name}: {response.text}")+ return None++ async def associate_tag_with_metadata(+ self,+ metadata_full_name: str,+ metadata_type: str,+ tags_to_associate: list,+ tags_to_disassociate: list,+ ) -> str:+ response = await self.rest_client.post(+ f"/api/metalakes/{self.metalake_name}/objects/{metadata_type}/{metadata_full_name}/tags",+ json={+ "tagsToAdd": tags_to_associate,+ "tagsToRemove": tags_to_disassociate,+ },+ )+ return extract_content_from_response(response, "names", [])++ async def list_tags_for_metadata(+ self, metadata_full_name: str, metadata_type: str+ ) -> str:+ response = await self.rest_client.get(+ f"/api/metalakes/{self.metalake_name}/objects/{metadata_type}/{metadata_full_name}/tags?details=true"+ )+ return extract_content_from_response(response, "names", [])++ async def list_metadata_by_tag(self, tag_name: str) -> str:+ response = await self.rest_client.get(+ f"/api/metalakes/{self.metalake_name}/tags/{tag_name}/objects"+ )+ return extract_content_from_response(response, "metadataObjects", [])diff --git a/mcp-server/mcp_server/client/tag_operation.py b/mcp-server/mcp_server/client/tag_operation.pynew file mode 100644index 0000000000..613dda7f5a--- /dev/null+++ b/mcp-server/mcp_server/client/tag_operation.py@@ -0,0 +1,143 @@+# Licensed to the Apache Software Foundation (ASF) under one+# or more contributor license agreements. See the NOTICE file+# distributed with this work for additional information+# regarding copyright ownership. The ASF licenses this file+# to you under the Apache License, Version 2.0 (the+# "License"); you may not use this file except in compliance+# with the License. You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing,+# software distributed under the License is distributed on an+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+# KIND, either express or implied. See the License for the+# specific language governing permissions and limitations+# under the License.++from abc import ABC, abstractmethod+++class TagOperation(ABC):+ """+ Abstract base class for Gravitino tag operations.+ """++ @abstractmethod+ async def create_tag(+ self, name: str, comment: str, properties: dict+ ) -> str:+ """+ Create a new tag within the specified metalake.++ Args:+ name: Name of the tag to be created+ comment: Description or comment for the tag+ properties: Dictionary of key-value pairs representing tag properties++ Returns:+ str: JSON-formatted string containing the created tag information+ """+ pass++ @abstractmethod+ async def get_tag_by_name(self, name: str) -> str:+ """+ Load a tag by its name.++ Args:+ name: Name of the tag to get++ Returns:+ str: JSON-formatted string containing the tag information+ """+ pass++ @abstractmethod+ async def get_list_of_tags(self) -> str:+ """+ Retrieve the list of tags within the metalake++ Returns:+ str: JSON-formatted string containing tag list information+ """+ pass++ @abstractmethod+ async def alter_tag(self, name: str, updates: list) -> str:+ """+ Alter an existing tag within the specified metalake.++ Args:+ name: Name of the tag to be altered+ updates: List of update operations to be applied to the tag++ Returns:+ str: JSON-formatted string containing the altered tag information+ """+ pass++ @abstractmethod+ async def delete_tag(self, name: str) -> None:+ """+ Delete a tag by its name.++ Args:+ name: Name of the tag to delete++ Returns:+ None+ """+ pass++ @abstractmethod+ async def associate_tag_with_metadata(+ self,+ metadata_full_name: str,+ metadata_type: str,+ tags_to_associate: list,+ tags_to_disassociate: list,+ ) -> str:+ """+ Associate tags with metadata.++ Args:+ metadata_full_name: Full name of the metadata item (e.g., table, column)+ metadata_type: Type of the metadata (e.g., "table", "column")+ tags_to_associate: List of tag names to associate with the metadata+ tags_to_disassociate: List of tag names to disassociate from the metadata++ Returns:+ str: JSON formatted string containing list of tag names that were+ successfully associated with the metadata+ """+ pass++ @abstractmethod+ async def list_tags_for_metadata(+ self, metadata_full_name: str, metadata_type: str+ ) -> str:+ """+ List all tags associated with a specific metadata item.++ Args:+ metadata_full_name: Full name of the metadata item (e.g., table, column)+ metadata_type: Type of the metadata (e.g., "table", "column")++ Returns:+ str: JSON formatted string containing list of tag names associated with the metadata+ """+ pass++ @abstractmethod+ async def list_metadata_by_tag(self, tag_name: str) -> str:+ """+ List all metadata items associated with a specific tag.++ Args:+ tag_name: Name of the tag to filter metadata by++ Returns:+ str: JSON formatted string containing list of metadata items associated with the tag+ """+ passdiff --git a/mcp-server/mcp_server/tools/__init__.py b/mcp-server/mcp_server/tools/__init__.pyindex b4f3212f34..38170e214a 100644--- a/mcp-server/mcp_server/tools/__init__.py+++ b/mcp-server/mcp_server/tools/__init__.py@@ -18,11 +18,15 @@from fastmcp import FastMCPfrom mcp_server.tools.catalog import load_catalog_tools+from mcp_server.tools.metadata import load_metadata_toolfrom mcp_server.tools.schema import load_schema_toolsfrom mcp_server.tools.table import load_table_tools+from mcp_server.tools.tag import load_tag_tooldef load_tools(mcp: FastMCP):load_catalog_tools(mcp)load_schema_tools(mcp)load_table_tools(mcp)+ load_tag_tool(mcp)+ load_metadata_tool(mcp)diff --git a/mcp-server/mcp_server/tools/metadata.py b/mcp-server/mcp_server/tools/metadata.pynew file mode 100644index 0000000000..71320cdcb2--- /dev/null+++ b/mcp-server/mcp_server/tools/metadata.py@@ -0,0 +1,44 @@+# Licensed to the Apache Software Foundation (ASF) under one+# or more contributor license agreements. See the NOTICE file+# distributed with this work for additional information+# regarding copyright ownership. The ASF licenses this file+# to you under the Apache License, Version 2.0 (the+# "License"); you may not use this file except in compliance+# with the License. You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing,+# software distributed under the License is distributed on an+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+# KIND, either express or implied. See the License for the+# specific language governing permissions and limitations+# under the License.++from fastmcp import Context, FastMCP+++def load_metadata_tool(mcp: FastMCP):+ @mcp.tool(tags={"metadata"})+ async def metadata_type_to_fullname_formats(ctx: Context) -> dict:+ """+ Get metadata type to full name formats.+ This tool provides the fullname format strings for different metadata types+ such as catalog, schema, table, model, topic, fileset, and column.++ Args:+ ctx (Context): Context object containing request metadata.+ Returns:+ dict: Dictionary containing formats for different metadata types.+ Key is the metadata type and value is the fullname format string.+ """++ return {+ "catalog": "{catalog}",+ "schema": "{catalog}.{schema}",+ "table": "{catalog}.{schema}.{table}",+ "model": "{catalog}.{schema}.{model}",+ "topic": "{catalog}.{schema}.{topic}",+ "fileset": "{catalog}.{schema}.{fileset}",+ "column": "{catalog}.{schema}.{table}.{column}",+ }diff --git a/mcp-server/mcp_server/tools/tag.py b/mcp-server/mcp_server/tools/tag.pynew file mode 100644index 0000000000..95395b7891--- /dev/null+++ b/mcp-server/mcp_server/tools/tag.py@@ -0,0 +1,368 @@+# Licensed to the Apache Software Foundation (ASF) under one+# or more contributor license agreements. See the NOTICE file+# distributed with this work for additional information+# regarding copyright ownership. The ASF licenses this file+# to you under the Apache License, Version 2.0 (the+# "License"); you may not use this file except in compliance+# with the License. You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing,+# software distributed under the License is distributed on an+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+# KIND, either express or implied. See the License for the+# specific language governing permissions and limitations+# under the License.++from fastmcp import Context, FastMCP+++def load_tag_tool(mcp: FastMCP):+ @mcp.tool(tags={"tag"}, enabled=False)+ async def create_tag(+ ctx: Context, name: str, comment: str, properties: dict+ ) -> str:+ """+ Create a new tag within the specified metalake.++ Args:+ ctx (Context): The request context object containing lifespan context+ and connector information.+ name (str): Name of the tag to be created+ comment (str): Description or comment for the tag+ properties (dict): Dictionary of key-value pairs representing tag properties++ Returns:+ str: JSON-formatted string containing the created tag information++ Example Return Value:+ {+ "name": "tag1",+ "comment": "This is a tag",+ "properties": {+ "key1": "value1",+ "key2": "value2"+ },+ "audit": {+ "creator": "anonymous",+ "createTime": "2025-08-07T06:20:18.330570Z"+ },+ "inherited": null+ }+ """+ client = ctx.request_context.lifespan_context.rest_client()+ return await client.as_tag_operation().create_tag(+ name, comment, properties+ )++ @mcp.tool(tags={"tag"})+ async def get_tag_by_name(ctx: Context, name: str) -> str:+ """+ Load a tag by its name.++ Args:+ ctx (Context): The request context object containing lifespan context+ and connector information.+ name (str): Name of the tag to get++ Returns:+ str: JSON-formatted string containing the tag information++ Example Return Value:+ {+ "name": "tag1",+ "comment": "This is a tag",+ "properties": {+ "key1": "value1",+ "key2": "value2"+ },+ "audit": {+ "creator": "anonymous",+ "createTime": "2025-08-07T06:20:18.330570Z"+ },+ "inherited": null+ }+ """+ client = ctx.request_context.lifespan_context.rest_client()+ return await client.as_tag_operation().get_tag_by_name(name)++ @mcp.tool(tags={"tag"})+ async def get_list_of_tags(ctx: Context) -> str:+ """+ Retrieve the list of tags within the metalake.++ Args:+ ctx (Context): The request context object containing lifespan context+ and connector information.++ Returns:+ str: JSON-formatted string containing tag list information++ Example Return Value:+ [+ {+ "name": "tag1",+ "comment": "This is a tag",+ "properties": {+ "key1": "value1",+ "key2": "value2"+ },+ "audit": {+ "creator": "anonymous",+ "createTime": "2025-08-07T06:20:18.330570Z"+ },+ "inherited": null+ },+ ...+ ]+ """+ client = ctx.request_context.lifespan_context.rest_client()+ return await client.as_tag_operation().get_list_of_tags()++ # Disable the alter_tag tool by default as it can be destructive.+ @mcp.tool(tags={"tag"}, enabled=False)+ async def alter_tag(ctx: Context, name: str, updates: list) -> str:+ """+ Alter an existing tag within the specified metalake.++ Args:+ ctx (Context): The request context object containing lifespan context+ and connector information.+ name (str): Name of the tag to be altered+ updates (list): List of update operations to be applied to the tag++ Example input for updates:+ [+ {+ "@type": "rename",+ "newName": "tag2"+ },+ {+ "@type": "updateComment",+ "newComment": "This is an updated tag"+ },+ {+ "@type": "setProperty",+ "property": "key3",+ "value": "value3"+ },+ {+ "@type": "removeProperty",+ "property": "key1"+ }+ ]++ Returns:+ str: JSON-formatted string containing the altered tag information++ Example Return Value:+ {+ "name": "tag1",+ "comment": "Updated comment",+ "properties": {+ "key1": "new_value1"+ },+ "audit": {+ "creator": "anonymous",+ "createTime": "2025-08-07T06:20:18.330570Z"+ },+ "inherited": null+ }+ """+ client = ctx.request_context.lifespan_context.rest_client()+ return await client.as_tag_operation().alter_tag(name, updates)++ # Disable the delete_tag tool by default as it can be destructive.+ @mcp.tool(tags={"tag"}, enabled=False)+ async def delete_tag(ctx: Context, name: str) -> None:+ """+ Delete a tag by its name.++ Args:+ ctx (Context): The request context object containing lifespan context+ and connector information.+ name (str): Name of the tag to delete++ Returns:+ None++ Raises:+ Exception: If the deletion fails, an exception is raised with an error message.+ """+ client = ctx.request_context.lifespan_context.rest_client()+ return await client.as_tag_operation().delete_tag(name)++ # Disable the associate_tag_with_metadata tool by default as it will change metadata state.+ @mcp.tool(tags={"tag"}, enabled=False)+ async def associate_tag_with_metadata(+ ctx: Context,+ metadata_full_name: str,+ metadata_type: str,+ tags_to_associate: list,+ ) -> str:+ """+ Associate or disassociate tags with metadata.++ Args:+ ctx (Context): The request context object containing lifespan context+ and connector information.+ metadata_full_name (str): Full name of the metadata object to associate tags with.+ It's typically in the format "catalog.schema.table" or "catalog.schema" or "catalog".+ or "catalog.schema.fileset". The "model", "topic" are also supported and the format+ is the same as for "catalog.schema.table". For more, please see tool+ `get_metadata_fullname_formats`.++ metadata_type (str): Type of the metadata object (e.g., "table", "schema", "catalog",+ "fileset", "model", "topic"). For More information, please see+ tool `list_all_metadata_types`.+ tags_to_associate (list): List of tag names to associate with the metadata.++ Example input:+ metadata_full_name: "catalog.schema.table"+ metadata_type: "table"+ tags_to_associate: ["tag1", "tag2"]+ tags_to_disassociate: ["tag3"]++ Returns:+ str: JSON-formatted string containing the names of associated tags.++ Example Return Value:+ [+ "tag1",+ "tag2"+ ]+ """+ client = ctx.request_context.lifespan_context.rest_client()+ return await client.as_tag_operation().associate_tag_with_metadata(+ metadata_full_name,+ metadata_type,+ tags_to_associate,+ [],+ )++ # Disable the disassociate_tag_from_metadata tool by default as it will change metadata state.+ @mcp.tool(tags={"tag"}, enabled=False)+ async def disassociate_tag_from_metadata(+ ctx: Context,+ metadata_full_name: str,+ metadata_type: str,+ tags_to_disassociate: list,+ ) -> str:+ """+ Disassociate tags from metadata.++ Args:+ ctx (Context): The request context object containing lifespan context+ and connector information.+ metadata_full_name (str): Full name of the metadata object to disassociate tags from.+ For more, please see tool `get_metadata_fullname_formats`.+ metadata_type (str): Type of the metadata object (e.g., "table", "schema", "catalog",+ "fileset", "model", "topic"). For More information, please see+ tool `list_all_metadata_types`.+ tags_to_disassociate (list): List of tag names to disassociate from the metadata.++ Example input:+ metadata_full_name: "catalog.schema.table"+ metadata_type: "table"+ tags_to_disassociate: ["tag1", "tag2"]++ Returns:+ str: JSON-formatted string containing the names of disassociated tags.++ Example Return Value:+ [+ "tag1",+ "tag2"+ ]+ """+ client = ctx.request_context.lifespan_context.rest_client()+ return await client.as_tag_operation().associate_tag_with_metadata(+ metadata_full_name, metadata_type, [], tags_to_disassociate+ )++ @mcp.tool(tags={"tag"})+ async def list_tags_for_metadata(+ ctx: Context, metadata_full_name: str, metadata_type: str+ ) -> str:+ """+ List all tags associated with a specific metadata item.++ Args:+ ctx (Context): The request context object containing lifespan context+ and connector information.+ metadata_full_name (str): Full name of the metadata item (e.g., table, column). For more, please see tool+ `get_metadata_fullname_formats`.+ metadata_type (str): Type of the metadata (e.g., "table", "column"). For More information, please see+ tool `list_all_metadata_types`.++ Example input:+ metadata_full_name: "catalog.schema.table"+ metadata_type: "table"++ Returns:+ str: JSON-formatted string containing the list of tags associated with the metadata.++ Example Return Value:+ [+ {+ "name": "import",+ "comment": "Import tag for data governance",+ "properties": {},+ "audit": {+ "creator": "anonymous",+ "createTime": "2025-08-12T11:41:09.257235Z"+ },+ "inherited": false+ }+ ]+ """+ client = ctx.request_context.lifespan_context.rest_client()+ return await client.as_tag_operation().list_tags_for_metadata(+ metadata_full_name, metadata_type+ )++ @mcp.tool(tags={"tag"})+ async def list_metadata_by_tag(ctx: Context, tag_name: str) -> str:+ """+ List all metadata items associated with a specific tag.++ Args:+ ctx (Context): The request context object containing lifespan context+ and connector information.+ tag_name (str): Name of the tag to filter metadata by.++ Returns:+ str: JSON-formatted string containing the list of metadata items associated with the tag.++ Example Return Value:+ [+ {+ "fullName": "model_catalog",+ "type": "catalog"+ },+ {+ "fullName": "catalog.schema.table",+ "type": "table"+ },+ {+ "fullName": "catalog.schema.fileset",+ "type": "fileset"+ },+ {+ "fullName": "catalog.schema.model",+ "type": "model"+ },+ {+ "fullName": "catalog.schema.topic",+ "type": "topic"+ }+ {+ "fullName": "catalog.schema",+ "type": "schema"+ }+ ...+ ]+ """+ client = ctx.request_context.lifespan_context.rest_client()+ return await client.as_tag_operation().list_metadata_by_tag(tag_name)diff --git a/mcp-server/tests/unit/tools/mock_operation.py b/mcp-server/tests/unit/tools/mock_operation.pyindex dc1acda0a2..4539686042 100644--- a/mcp-server/tests/unit/tools/mock_operation.py+++ b/mcp-server/tests/unit/tools/mock_operation.py@@ -21,6 +21,7 @@ from mcp_server.client import (SchemaOperation,TableOperation,)+from mcp_server.client.tag_operation import TagOperationclass MockOperation(GravitinoOperation):@@ -36,6 +37,9 @@ class MockOperation(GravitinoOperation):def as_catalog_operation(self) -> CatalogOperation:return MockCatalogOperation()+ def as_tag_operation(self) -> TagOperation:+ return MockTagOperation()+class MockCatalogOperation(CatalogOperation):async def get_list_of_catalogs(self) -> str:@@ -57,3 +61,39 @@ class MockTableOperation(TableOperation):self, catalog_name: str, schema_name: str, table_name: str) -> str:return "mock_table"+++class MockTagOperation(TagOperation):+ async def get_list_of_tags(self) -> str:+ return "mock_tags"++ async def create_tag(+ self, name: str, comment: str, properties: dict+ ) -> str:+ return f"mock_tag_created: {name}"++ async def get_tag_by_name(self, name: str) -> str:+ return f"mock_tag: {name}"++ async def alter_tag(self, name: str, updates: list) -> str:+ return f"mock_tag_altered: {name} with updates {updates}"++ async def delete_tag(self, name: str) -> str:+ return f"mock_tag_deleted: {name}"++ async def associate_tag_with_metadata(+ self,+ metadata_full_name: str,+ metadata_type: str,+ tags_to_associate: list,+ tags_to_disassociate,+ ) -> str:+ return f"mock_associated_tags: {tags_to_associate} with metadata {metadata_full_name} of type {metadata_type}"++ async def list_tags_for_metadata(+ self, metadata_full_name: str, metadata_type: str+ ) -> str:+ return f"mock_tags_for_metadata: {metadata_full_name} of type {metadata_type}"++ async def list_metadata_by_tag(self, tag_name: str) -> str:+ return f"mock_metadata_by_tag: {tag_name}"