Skip to main content
Glama

describe_table

Analyze table structures by listing columns and their data types within a specified data source for better data understanding and query optimization.

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

  • The handler function for the describe_table tool. It retrieves the specified data source, calls the helper query_utils.describe_table, and returns the schema as a Markdown table.
    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)
  • Pydantic input schema definition for the describe_table tool parameters using Annotated and Field for MCP tool schema.
    source_id: Annotated[ str, Field(description='The data source') ], table_name: Annotated[ str, Field(description='The table in the data source') ] ) -> str:
  • Registration of the describe_table handler as part of the Core class tools list.
    self.tools = [ self.list_data_sources, self.describe_table, self.run_query, ]
  • The ZaturnMCP function registers all ZaturnTools.tools (including describe_table) into the FastMCP server 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
  • Supporting utility that performs the actual table description by running source-type-specific SQL queries via 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};' )

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

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