Skip to main content
Glama
ryft-io

IcebergMCP

by ryft-io

get_table_partitions

Retrieve and display partitions for a specified Iceberg table using namespace and table name inputs to analyze data organization and structure.

Instructions

Provides the partitions for a given Iceberg table

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
namespaceYes
table_nameYes

Implementation Reference

  • The handler function for the 'get_table_partitions' tool. It retrieves partitions from an Iceberg table using the Glue catalog, formats them into a list of dictionaries containing partition details, record count, and size in bytes.
    @mcp.tool() def get_table_partitions( namespace: str, table_name: str ) -> list[dict[str, int]]: """Provides the partitions for a given Iceberg table""" catalog: Catalog = get_catalog() table_obj = catalog.load_table((namespace, table_name)) partitions = table_obj.inspect.partitions().to_pylist() result = [] for p in partitions: result.append( { "partition": p['partition'], "record_count": p['record_count'], "size_in_bytes": p['total_data_file_size_in_bytes'], } ) return result
  • Registers the 'get_table_partitions' tool with the FastMCP server using the @mcp.tool() decorator.
    @mcp.tool()
  • Helper function used by the tool to initialize and return the GlueCatalog instance for accessing Iceberg tables.
    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

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ryft-io/iceberg-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server