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
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"type": "object"
}
Implementation Reference
- src/bakery_data_mcp/server.py:537-569 (handler)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) )]
- src/bakery_data_mcp/server.py:225-232 (registration)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": {} }