Skip to main content
Glama
ryft-io

IcebergMCP

by ryft-io

get_table_schema

Retrieve the schema for an Apache Iceberg table by specifying its namespace and table name. This tool helps users understand table structure and data types for querying and analysis in data lakehouses.

Instructions

Provides the schema for a given Iceberg table

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
namespaceYes
table_nameYes

Implementation Reference

  • The handler function that loads the Iceberg table and extracts its schema fields into the defined SchemaField format.
    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
  • Registers the get_table_schema function as an MCP tool using the FastMCP decorator.
    @mcp.tool()
  • Defines the output schema structure for table schema fields.
    class SchemaField(TypedDict):
        id: int
        name: str
        type: str
        required: bool
        doc: str | None
  • Helper function to initialize the GlueCatalog using AWS credentials from config.
    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

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

C2.8/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It only states the purpose but does not disclose any behavioral aspects like read-only nature, required permissions, or whether the schema is returned in a specific format. No side effects mentioned.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence with no extra words, making it concise. However, it may be too minimal, sacrificing helpfulness for brevity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema, annotations, or parameter descriptions, the tool description fails to provide sufficient context for the agent to understand return values or parameter constraints. It is minimally complete for a very simple tool but lacks elaboration.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%. The description does not explain the 'namespace' and 'table_name' parameters beyond implying they identify a table. This leaves the agent without necessary context for correct invocation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description explicitly states the tool provides the schema for a given Iceberg table. It clearly identifies the specific resource (schema) and action (provides), and distinguishes from sibling tools that list tables or partitions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus siblings like get_iceberg_tables or get_table_partitions. Does not mention prerequisites such as the namespace and table_name must exist or that the table must be an Iceberg table.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.