Skip to main content
Glama

describe_table

Analyze table structure by listing columns and data types from specified data sources to understand database schema for SQL queries and data visualization.

Instructions

Lists columns and their types in the specified table of specified data source.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
source_idYesThe data source
table_nameYesThe table in the data source

Implementation Reference

  • Primary MCP tool handler for 'describe_table'. Accepts source_id and table_name, retrieves data source from self.data_sources, calls the helper query_utils.describe_table, formats as markdown table, with error handling.
    def describe_table(self, source_id: Annotated[ str, Field(description='The data source') ], table_name: Annotated[ str, Field(description='The table in the data source') ] ) -> str: """ Lists columns and their types in the specified table of specified data source. """ try: source = self.data_sources.get(source_id) if not source: return f"Source {source_id} Not Found" result = query_utils.describe_table(source, table_name) return result.to_markdown(index=False) except Exception as e: return str(e)
  • Input schema via Pydantic Annotated and Field for source_id (str: The data source) and table_name (str: The table in the data source), with docstring describing purpose.
    def describe_table(self, source_id: Annotated[ str, Field(description='The data source') ], table_name: Annotated[ str, Field(description='The table in the data source') ] ) -> str: """ Lists columns and their types in the specified table of specified data source. """
  • MCP server registration: Instantiates ZaturnTools with sources, creates FastMCP, and registers all tools (including describe_table) using Tool.from_function.
    zaturn_tools = ZaturnTools(sources) zaturn_mcp = FastMCP() for tool_function in zaturn_tools.tools: zaturn_mcp.add_tool(Tool.from_function(tool_function)) return zaturn_mcp
  • Core helper logic: Dispatches to appropriate SQL DESCRIBE/PRAGMA/INFORMATION_SCHEMA query based on source['source_type'], invoking execute_query.
    def describe_table(source, table_name): match source['source_type']: case 'sqlite': return execute_query(source, f'PRAGMA table_info("{table_name}");' ) case 'postgresql' | 'mssql' | 'bigquery': return execute_query(source, f"SELECT column_name, data_type, is_nullable FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = '{table_name}';" ) case "mysql" | "duckdb" | "csv" | "parquet" | "clickhouse": if ' ' in table_name: table_name = f'`{table_name}`' return execute_query(source, f'DESCRIBE {table_name};' )
  • Initial registration of describe_table in Core class's self.tools list, which is then propagated to ZaturnTools and MCP.
    self.tools = [ self.list_data_sources, self.describe_table, self.run_query, ]

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/kdqed/zaturn'

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