Skip to main content
Glama
ryft-io

IcebergMCP

by ryft-io

get_table_schema

Retrieve schema details for a specific Iceberg table by specifying its namespace and table name, enabling efficient metadata queries within the IcebergMCP server.

Instructions

Provides the schema for a given Iceberg table

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
namespaceYes
table_nameYes

Implementation Reference

  • The handler function for the 'get_table_schema' tool, decorated with @mcp.tool(). It loads the Iceberg table from the Glue catalog and extracts the schema fields into SchemaField dicts.
    @mcp.tool() def get_table_schema( namespace: str, table_name: str ) -> list[SchemaField]: """Provides the schema for a given Iceberg table""" catalog: Catalog = get_catalog() table_obj = catalog.load_table((namespace, table_name)) schema = table_obj.schema() fields = [] for field in schema.fields: fields.append( { "id": field.field_id, "name": field.name, "type": str(field.field_type), "required": field.required, "doc": field.doc if field.doc else None, } ) return fields
  • TypedDict used as the return type for schema fields in get_table_schema tool.
    class SchemaField(TypedDict): id: int name: str type: str required: bool doc: str | None
  • Helper function called by get_table_schema to create and return the GlueCatalog instance.
    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