Skip to main content
Glama
by t2hnd

get_schema

Retrieve database schema details like table structures and column definitions to understand bakery POS data organization for querying.

Instructions

Get the database schema information including table structures and column definitions.

Input Schema

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

{ "properties": {}, "type": "object" }

Implementation Reference

  • Handler for the 'get_schema' tool. Queries SQLite metadata to fetch table structures (CREATE SQL), column definitions (PRAGMA table_info), and row counts for each table, formats as JSON.
    elif name == "get_schema": # Get all table information cursor.execute(""" SELECT name, sql FROM sqlite_master WHERE type='table' ORDER BY name """) tables = cursor.fetchall() schema_info = { "tables": {} } for table in tables: table_name = table["name"] schema_info["tables"][table_name] = { "create_sql": table["sql"] } # Get column info cursor.execute(f"PRAGMA table_info({table_name})") columns = cursor.fetchall() schema_info["tables"][table_name]["columns"] = columns # Get row count cursor.execute(f"SELECT COUNT(*) as count FROM {table_name}") row_count = cursor.fetchone()["count"] schema_info["tables"][table_name]["row_count"] = row_count return [TextContent( type="text", text=json.dumps(schema_info, ensure_ascii=False, indent=2) )]
  • Registration of the 'get_schema' tool in list_tools(), including name, description, and input schema (no parameters required).
    Tool( name="get_schema", description="Get the database schema information including table structures and column definitions.", inputSchema={ "type": "object", "properties": {} } )
  • Input schema for get_schema tool: empty object (no input parameters).
    inputSchema={ "type": "object", "properties": {} }

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/t2hnd/bakery_data_mcp'

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