Skip to main content
Glama

get_db_schema

Retrieve the complete database schema to understand table structures and relationships for Turso-hosted LibSQL databases.

Instructions

Get the schema for all tables in the database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.ts:66-81 (registration)
    Registration of the 'get_db_schema' tool, which calls the dbSchema helper function from utils.ts and formats the result as JSON content.
    server.addTool({ name: "get_db_schema", description: "Get the schema for all tables in the database", parameters: z.object({}), execute: async () => { try { const schema = await dbSchema(db); return content(JSON.stringify({ schema }, null, 2)); } catch (error) { return content( `Error getting schema: ${error instanceof Error ? error.message : String(error)}`, true, ); } }, });
  • Core handler logic for retrieving SQL CREATE statements for all user tables from sqlite_master.
    export async function dbSchema(client: Client): Promise<string[]> { const result = await client.execute({ sql: "SELECT sql FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%'", args: [], }); return result.rows.map((row) => row.sql as string); }

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/nbbaier/mcp-turso'

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