get_namespaces
Retrieve available namespaces from the Iceberg catalog to organize and access data lakehouse tables efficiently.
Instructions
Provides a list of namespaces from the Iceberg catalog.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- iceberg_mcp/iceberg_server.py:25-30 (handler)The main handler function for the 'get_namespaces' tool. It uses the get_catalog helper to list namespaces from the GlueCatalog and returns them as a newline-separated string. The @mcp.tool() decorator registers the tool with the MCP server.@mcp.tool() def get_namespaces() -> str: """Provides a list of namespaces from the Iceberg catalog.""" catalog = get_catalog() namespaces = catalog.list_namespaces() return "\n".join(ns[0] for ns in namespaces)
- Helper function to initialize the Iceberg GlueCatalog using AWS credentials obtained via boto3 session with profile from config and specified region.def get_catalog() -> GlueCatalog: try: session = boto3.Session(profile_name=iceberg_config.profile_name) credentials = session.get_credentials().get_frozen_credentials() catalog = GlueCatalog( "glue", **{ "client.access-key-id": credentials.access_key, "client.secret-access-key": credentials.secret_key, "client.session-token": credentials.token, "client.region": iceberg_config.region, }, ) except Exception as e: logger.error(f"Error creating AWS connection: {str(e)}") raise return catalog
- iceberg_mcp/iceberg_config.py:3-5 (helper)Configuration values for AWS profile and region used by get_catalog to create the catalog instance.profile_name = os.environ.get("ICEBERG_MCP_PROFILE") region = os.environ.get("ICEBERG_AWS_REGION") or 'us-east-1'